earthlab / hub-ops

Infrastructure and operations for the Earth Lab JupyterHub
https://earthlab-hub-ops.readthedocs.io/en/latest/
4 stars 8 forks source link

issue with gitpuller & file conflicts #255

Open lwasser opened 4 years ago

lwasser commented 4 years ago

@kcranston i think i know why this is happening. we made some big changes to the edsc repo where gitpuller is connected. @nkorinek and i changes some things and i knew it would cause conflicts.

well it's now causing the hub to hang. I know a future way to avoid this but for now... i was just going to create a new directory name for gitpuller to avoid this issue. does that seem reasonable?


]) for Container "notebook" in Pod "jupyter-lwasser_edsc-hub(4da182e9-d0f5-11ea-86b0-42010a80001b)" failed - error: command 'sh -c gitpuller https://github.com/earthlab/edsc-summer-2020 master edsc-resources;
' exited with 1: Traceback (most recent call last):
  File "/opt/conda/bin/gitpuller", line 10, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.7/site-packages/nbgitpuller/pull.py", line 251, in main
    args.repo_dir
  File "/opt/conda/lib/python3.7/site-packages/nbgitpuller/pull.py", line 81, in pull
    yield from self.update()
  File "/opt/conda/lib/python3.7/site-packages/nbgitpuller/pull.py", line 230, in update
    ], cwd=self.repo_dir)
  File "/opt/conda/lib/python3.7/site-packages/nbgitpuller/pull.py", line 43, in execute_cmd
    raise subprocess.CalledProcessError(ret, cmd)
subprocess.CalledProcessError: Command '['git', '-c', 'user.email=nbgitpuller@nbgitpuller.link', '-c', 'user.name=nbgitpuller', 'merge', '-Xours', 'origin/master']' returned non-zero exit status 1.
, message: "$ git fetch\n\nFrom https://github.com/earthlab/edsc-summer-2020\n\n   a6fdec1..52e7c72  master                -> origin/master\n\n   dbdee8b..7e3a674  reorg                 -> origin/reorg\n\n * [new branch]      variable-name-cleanup -> origin/variable-name-cleanup\n\n$ git -c user.email=nbgitpuller@nbgitpuller.link -c user.name=nbgitpuller commit -am Automatic commit by nbgitpuller --allow-empty\n\n[master 7556902] Automatic commit by nbgitpuller\n\n$ git -c user.email=nbgitpuller@nbgitpuller.link -c user.name=nbgitpuller merge -Xours origin/master\n\nCONFLICT (modify/delete): raster-data/02-open-and-crop-all.ipynb deleted in origin/master and modified in HEAD. Version HEAD of raster-data/02-open-and-crop-all.ipynb left in tree.\n\nCONFLIC
T (modify/delete): raster-data/01-open-lidar-raster-data-python.ipynb deleted in origin/master and modified in HEAD. Version HEAD of raster-data/01-open-lidar-raster-data-python.ipynb left in
 tree.\n\nRemoving plotting/03-plot-data-activity-timeseries.ipynb\n\nRemoving plotting/02-plot-data-activity-spatial-data.ipynb\n\nCONFLICT (modify/delete): plotting/01-intro-plotting-matplo
tlib.ipynb deleted in origin/master and modified in HEAD. Version HEAD of plotting/01-intro-plotting-matplotlib.ipynb left in tree.\n\nRemoving loops/01-wtf-activity.ipynb\n\nCONFLICT (modify
/delete): data-types/04-FIXED-data-types-exercise.ipynb deleted in origin/master and modified in HEAD. Version HEAD of data-types/04-FIXED-data-types-exercise.ipynb left in tree.\n\nCONFLICT 
(modify/delete): data-types/02-FIXED-intro-vector-data.ipynb deleted in origin/master and modified in HEAD. Version HEAD of data-types/02-FIXED-intro-vector-data.ipynb left in tree.\n\nAutoma
tic merge failed; fix conflicts and then commit the result.\n\nTraceback (most recent call last):\n  File \"/opt/conda/bin/gitpuller\", line 10, in <module>\n    sys.exit(main())\n  File \"/o
pt/conda/lib/python3.7/site-packages/nbgitpuller/pull.py\", line 251, in main\n    args.repo_dir\n  File \"/opt/conda/lib/python3.7/site-packages/nbgitpuller/pull.py\", line 81, in pull\n    
yield from self.update()\n  File \"/opt/conda/lib/python3.7/site-packages/nbgitpuller/pull.py\", line 230, in update\n    ], cwd=self.repo_dir)\n  File \"/opt/conda/lib/python3.7/site-package
s/nbgitpuller/pull.py\", line 43, in execute_cmd\n    raise subprocess.CalledProcessError(ret, cmd)\nsubprocess.CalledProcessError: Command '['git', '-c', 'user.email=nbgitpuller@nbgitpuller.
link', '-c', 'user.name=nbgitpuller', 'merge', '-Xours', 'origin/master']' returned non-zero exit status 1.\n"
4m3s        Normal    Killing                  pod/jupyter-lwasser                    FailedPostStartHook
2m22s       Normal    NoPods                   poddisruptionbudget/user-placeholder   No matching pods found
lwasser commented 4 years ago

ok that fixed it as far as i can tell. teh issue is that when you start modifying existing files gitpuller has a hard time deciding what to do. then the entire hub hangs while trying to load. @nkorinek this is why i wasn't merging that pr because i was uncertain. for the future we will have to be more careful about modifying existing files on the hub in a repo when they are connected to gitpuller. i'm closign this for now but we could also think about some docs around this as well.

kcranston commented 4 years ago

Good catch (and fix!). I can only imagine the internal mess that gitpuller can get itself into...

Makes me want to re-evaluate the idea of wrapping that gitpuller step in some sort of python script that would fail gracefully and allow the pod startup to continue.

lwasser commented 4 years ago

@kcranston yes it's funny because in this case - i had intentionally waited to merge that PR because i was afraid of this happening. we made a lot of updates to the lessons and to the dir structure. but gitpuller failing is definitely a problem because it completely stops the pod launch. In this case oddly -- if you wanted long enough it somehow resolved and loaded the pod but for most students (and me even) it was too much time and starting and restarting the pod.

i wonder if we could either run a shell script there or something via python with a try except?

i'm happy that i know enough now to troubleshoot however!! our docs ROCK!! yay!