ubcecon / computing_and_datascience

Sandbox and workspace for computing and datascience infrastructure and course materials.
MIT License
8 stars 12 forks source link

Test the nbgitpuller interface and workflow with syzygy #92

Closed jlperla closed 5 years ago

jlperla commented 5 years ago

Using nbgitpuller is pretty easy. We just need to give students a link. I think that the following work To do the basic pull with

Ian says that these https://github.com/jupyterhub/nbgitpuller/ basically does git pull or git clone operations, so you should be able to reason it out with that.


Test that out and play around with the notebooks, but I found it pretty stable. The bigger issue is to think through the workflow of modified notebooks to figure out how to update them. By design nbgitpuller will not overwrite local changes without some manual steps.

There are two updating scenarios to consider:

Now, there are at least 2 different scenarios

So the question is: how do we tell students to update their notebooks if

  1. They want to get the latest for anything they have not made a local change to... I think this may just be clicking on the link again? BUt needs to be tested
  2. They want to overwrite any local changes they have. This needs to work for both notebooks that were changed from the last time they pulled, and ones that weren't. I.e. both a revert and a forced update.

    Here is what Ian said about this:

  1. If content has changed in both places, prefer local changes over remote changes.
  2. If a file was deleted locally but present in the remote, remote file is restored to local repository. This allows users to get a 'fresh copy' of a file by just deleting the file locally & clicking the link again.
  3. If a file exists locally but is untracked by git (maybe someone uploaded it manually), then rename the file, and pull in remote copy.

So for your first point, yes, it will do a pull and attempt to merge preferring local mods. For the second and third points, in some cases you can just delete the file and click the link again. The resulting pull should restore a "fresh" copy. Deeper than that there are always going to be cases where the fix would have to be at the CLI (either in a terminal or wrapped in a python cell). The only alternative to that I can think of would be to delete or rename the entire repository and clone it again.

I played around with this and had trouble getting the files to overwrite.

The other option is that we have a notebook or just code to run that does a github operation for the revert and overwrite. For example, a file called notebook_utilities.ipynb with a cell something like

!git fetch origin; git reset --hard HEAD; git pull

I couldn't get this to work immediately, but it is an approach to consider. In fact, it may be a better option than having them manually delete files.

jlperla commented 5 years ago

BTW, the sequence of steps to get things working may involve shutting down kernels and/or the server, but we should find the minimal steps necessary.

arnavs commented 5 years ago

As discussed, the home-brewed nbutils.ipynb isn't so bad of an idea for this.

Uploaded one with some basic commands to the ECON427 repo. We can iterate on it depending on what you think the students need.

jlperla commented 5 years ago

Does it consistently work on both syzygy and a local desktop with git installed? If so, it might make more sense to have this in the underlying lecture notes repos (for both julia and the datascience one)?

arnavs commented 5 years ago

I just tested it on syzygy. Will give it a spin on the local machine, but my gut says we're good and that's the right approach.

arnavs commented 5 years ago

Yep, seems to work fine.

arnavs commented 5 years ago

Closing as this has been tested, we can open a new issue when the time comes to get this polished/figure out what commands we need etc.