SwissDataScienceCenter / renku-python

A Python library for the Renku collaborative data science platform.
https://renku-python.readthedocs.io/
Apache License 2.0
37 stars 29 forks source link

implement a command to update the version of renku-python in interactive environments #1370

Closed rokroskar closed 3 years ago

rokroskar commented 4 years ago

After https://github.com/SwissDataScienceCenter/renku-project-template/pull/86 is merged, it should be straightforward to update the renku-python version installed in users' docker images. We should have a command that checks if the current version needs to be updated and update it if that is the case. In the case of released versions this is trivial, it's not so obvious what to do when renku migrate is called from a development version, since the corresponding development release may not exist on PyPI.

Panaetius commented 4 years ago

I'm not sure this should be a part of regular renku migrate, which focuses on migrating the metadata and consists of migrations that are done once and then not repeated again. Since this increases the project version, but a new renku-python release does not necessarily need migrations or change the project version, renku migrate does not seem too suitable for this task. Unless we write a migration for this for each renku release, which I personally don't like too much.

Maybe a different, dedicated command to update the Dockerfile might make more sense.

rokroskar commented 4 years ago

we've talked about having some sub-commands for handling the interactive environments - maybe this could fall under that use-case? e.g.

renku interactive launch

would spin up the jupyter notebook server

and

renku interactive update

would do the Dockerfile change.

Panaetius commented 4 years ago

Timeboxed to 2 for design

rokroskar commented 4 years ago

@Panaetius I changed the title and description to reflect your proposal

Panaetius commented 4 years ago

Discussed in https://sdsc.atlassian.net/wiki/spaces/RENKU/pages/680067073/2020-08-06+Design+Meeting+notes design meeting

ciyer commented 4 years ago

It seems the scope of this issue became a little larger and includes the possibility to update the a new version of the template as well as a newer version of renku. For the UI it makes sense to have some more information from the service.

cache.migrations_check This currently just returns migration_required: bool, but we would need to get:

This will allow us to communicate to the user what the migration will do and what to do if an automatic migration is not possible.

cache.migrate This currently returns migration_status: string , migration_error: string, but we also need:

The operation should be all or nothing (and reflected in migration_status), but we will want to tell the user what worked, what didn't work, and what they need to do to migrate the project.

See https://github.com/SwissDataScienceCenter/renku-ui/issues/1026 for UI perspective.

Panaetius commented 4 years ago

Templates have two new fields:

The template version used is stored in the project metadata. Additionally, checksums for all templated files are saved to check for changes. The original metadata used for instantiating from the template is also stored.

cache.migrations_check will return:

An important point is, docker_update_possible=False and migration_required=True means the project is out of date with the current renku-version, but the Dockerfile does not support updating the renku-version (e.g. if it's a custom Dockerfile that does not contain the renku version string). In this case, we shouldn't execute migrations, as it'd bring the repo into a state that doesn't work. so docker_update_possible supersedes migration_required.

cache.migrate has new parameters:

All of the above default to False

So skip_template_update=True && skip_docker_update=True && skip_migrations=False would give the same behavior as the current endpoint.

Exceptions on this endpoint will look like:

{
    "code": -32100,
    "reason": "...error string...",
    "template_update_failed": False,
    "dockerfile_update_failed": True,
    "migrations_failed": False
}

So the 3 flags determine which part it was that failed (only one of them is True on error). This differs a bit from what was described above, but it's in line with how we dealt with errors before and should still cover everything that's needed.

I'm not sure what new_template_url: string (URL) mentioned above should contain? The template URL stays the same through all this.

ciyer commented 3 years ago

On the UI, we would like to

  1. Let them know what has changed in the template
  2. inform the user how they can update the template manually if it is necessary.

The idea is that new_template_url would provide documentation of the new features and instructions for manually upgrading.

rokroskar commented 3 years ago

@ciyer who should provide this? For our templates it's clear, but what about templates created by others? Should it just be a changelog in the template repo?

ciyer commented 3 years ago

I guess we cannot require a changelog, but we should encourage it. At least we can show a diff between the two template versions.

rokroskar commented 3 years ago

I think if we had a clearly-communicated convention for the changelog that would be fine. The diff could very well be incomprehensible to a normal user.

Panaetius commented 3 years ago

We couldn't use a CHANGELOG.md in the template as that would just be a template file, I think.

So the only place right now that we could keep that information is in the template manifest. There's no versioning of templates, though they are somewhat implicitly version by git commit at the moment. So we might be able to have a changelog in the manifest and return a diff of the changelog entry?

But I'd rather do this in a separate issue, with proper design, not duct-tape it onto this one.

rokroskar commented 3 years ago

Sure there's a place for the changelog, same place as the README and the manifest file (as in https://github.com/SwissDataScienceCenter/renku-project-template)

Panaetius commented 3 years ago

But that'd be a changelog for all templates? We'd want one per template, probably

rokroskar commented 3 years ago

Personally, I would be ok if I received information like

Python template bumps jupyter version to x.x.x; R images now include an improved RStudio server proxy

etc.

Panaetius commented 3 years ago

Having it in a machine readable format (yaml?) would probably still be a good idea.

rokroskar commented 3 years ago

Maybe eventually - then we'd need to sort out the formatting (which would be different than a typical changelog) and expect that people conform to it (and what do we do when they don't). It would be much simpler to just show the relevant section of the changelog in plaintext, at least as a starting point.