-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SHPC New Feature - Upgrade Functionality #673
base: main
Are you sure you want to change the base?
Conversation
* Create upgrade.py * Milestone 1.1 * Fixed a bug * fixing bug * fixing bug * another bug fix * Milestone 1.1.2 * fixing bug 1.1.2 * fixing bugs 1.1.2 * fixing bugs * Trying capture stdout * fixing bugs * fixing bugs * milestone 1.1.3 * fix * fixx * another fix * and another fix * Milestone 1.2 * Milestone 1.3 * minor changes * Ensuring proper control flow of upgrade * Made uninstall function to return boolean values inorder to fix a control flow bug in upgrade.py * Using functions for cleaner code * Using functions for cleaner code 2 * upgrade all feature * fixing bug * fixing bug * upgrade preview * enhancing upgrade all * allowing user to upgrade without uninstalling old versions * typo * changing the logic of checking for the latest version since user can now keep older versions * Adding logic to check if user has modules installed first before upgrade * Replacing most print statements with logger * Making sure user does not include a version when doing shpc upgrade * fixing bug * Handling argument combinations * user-friendly message for preview * changing a preview message * Modfied warning message in main * Renaming refactoring the source code * refactoring invalid argument combination error messages * Allowing shpc upgrade software --dry-run * making logger info message clearer * Allowing shpc upgrade --all --dry-run * removing wrong comment * making logger info clearer * fixing typo in help * fixing a comment * rename refactoring * fixing unknown recipe error * changing error message for unknown recipe * fixing error message bug and cleaning code * Making shpc upgrade software -d output message clearer * removing redudant code after changing the above output message * Removing redundant arguements, adding installation of latest version to views, fixing print messages * fixing error message * removing shpc upgrade --dry-run since its similar to shpc upgrade --all --dry-run * making help message clearer * Creating test files for upgrade * refactoring inner functions within upgrade to become outer functions. For reusability outside upgrade.py * Tests for upgrading single software * fixing bug * fixing bug * fixing bug by adding force as a parameter to upgrade function * debugging * Testing * fixing bug * fixing bug * testing * debugging * debugging * testing * testing * debug statements * testing * testing * testing * testing * testing * testing * testing * testing * testing * testing * testing * testing * tests for upgrade * fixing bug * removing temporary file * removing commented out code * Removing Upgrade's --dry-run and adding it to the shpc command loop for --dry-run * Fixing issue to allow it successfully run the test * changing dry_run variable to dryrun. To keep it consistent with the rest of the code * Making incomplete command error message consistent even when user has no software installed * removing redundant code * Implementing Matthieu's suggested changes * fixing minor bug * fixing parameter and argument name (dryrun) * removing redundant code from the test * Making function "return" changes for consistency * fixing shpc linting issue * Apply automatic formatting with black and fixing SHPC linting issue * fixing lintint issue * adding upgrade tests to main test file and removing temporary test files
Changing back to the default header for new file
Thanks @Ausbeth ! This introduces a confusing point for the user - having "update" and "upgrade" (that have different interactions). What exactly is upgrade doing that update is not, and did you think about a way to consolidate the need? It might help to start at the beginning and tell me the problem you needed to solve. |
Hi @vsoch, currently in SHPC, a user who wants to install the latest version of one of their installed software must manually perform the entire version-checking and installation process. This is rather time consuming as the user may potentially have to perform three commands to achieve their aim: The new upgrade feature aimed to solve this problem by automating the process. It checks the container.yaml recipe for the latest version of software the user has installed. If there is a new “latest” and the user does not have it installed, This is different from |
I don't think I'm convinced by needing this addition, especially if (as you say) the same can be accomplished with an
That is probably what you want to work on - if install is doing a reinstall when latest is already installed, then it should not. |
Hi @vsoch . The use case is still the same as in #501 (comment) . Following up on
For people using the remote registry, the In our case, we keep a local copy of the registry with only the software and versions we want installed, but the principle remains the same. At regular intervals we update the "latest" tags in all Under the hood, yes, |
Thanks for the reference! I think that discussion was still oriented around the (current) update comment. For this bit:
I like the idea, but what I don't like is having update and upgrade. Ubuntu / debian has that with apt and it's generally confusing. I'd be open to other proposals to get that same functionality. This would warrant something more simple like: shpc install --upgrade Which scopes it under install (where I think it should be, since it's essentially doing install for new versions?) and explicitly says "install the latest (upgrade) for my modules. I'm open to other ideas too - I just don't like having |
Is this the interface you're proposing ?
Since you're suggesting expanding the
|
Let's start with just the install set - I'm not sure about the latter. For this one:
Why would we need to have |
|
The analogy is homebrew, which offers:
|
hmm :/ @marcodelapierre what do you think? |
Hi there :) I have read the thread, and I like this landing point:
I see the value in providing an automated way to check for SHASUM updates of given versions and install them, for one or better many installed images. I like how Questions:
Finally, I would consider also having |
One more thought. If the registry in use is already updated (as it should -- better to have the registry sync separate, right?), how are Ultimately, isn't it the same functionality? There could be a "module only"-like flag to just re-generate module and wrapper scripts. |
The new image will be added to the same views from which the old images were uninstalled. Indeed, this is transparent for the user and shouldn't need any flag.
First, there's the
They're different in our current implementations:
|
Sounds like we have a path forward! Let's start with:
|
Thanks for your suggestions, @vsoch, @muffato, and @marcodelapierre. Before going ahead, I have some undying questions I would like to address.
|
|
@vsoch @muffato @marcodelapierre My apologies for the slow progress, I had a hectic schedule these past two weeks. However, I have completed:
|
) | ||
|
||
|
||
def upgrade(name, cli, args, dryrun=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (to me) in how it's designed here looks like it better belongs in an associated helper script. It's not a core part of shpc, it's written as a kind of helper function that uses the client.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @vsoch, thank you for the response. Could you please shed more light on this? I assume you're saying upgrade()
should be defined in a different script rather than in install.py?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't think I'm convinced this belongs in core shpc. The implementation here reflects that - it's a big block of code that uses shpc and would better serve as a supplementary helper script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I'm not disagreeing with your suggestion, I just wanted to understand your thought process more in order to know the next steps.
From your suggestion, where should the upgrade function be placed, just so we can all be on the same page @vsoch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likely a new subdirectory of https://github.com/singularityhub/singularity-hpc/tree/main/example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great thanks, will work on that.
Should I also add def get_latest_version(name, config)
, which I added to install.py for this upgrade feature in the new subdirectory? @vsoch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @vsoch . If the functionality moves to a separate script outside of shpc install
, then no need to name the option "install --upgrade", right ? We can change the name back to "shpc-upgrade.py".
@Ausbeth : compared to where things were in sanger-tol#3, you would need to:
-
move
shpc/client/upgrade.py
toexample/shpc-upgrade.py
, and embed- the argparse stuff from
shpc/client/__init__.py
- the help text from
shpc/client/help.py
- the argparse stuff from
-
move the tests as well
Probably easier to start from 081dc2d rather than the current state of the branch
Hello @vsoch,
I am Ausbeth Aguguo, a collaborator with the Wellcome Sanger Institute. I contributed to this amazing project under the guidance of Matthieu Muffato, Guoying Qi and the Tree of Life Informatics Infrastructure Team.
In this pull request, I am introducing a robust functionality for SHPC, which uses
shpc upgrade
command to implement an intuitive upgrade logic that helps users manage installed and available software versions within SHPC. Here’s a breakdown:shpc list
User performs
shpc upgrade quay.io/biocontainers/samtools
User performs
shpc upgrade -- all
User performs
shpc upgrade quay.io/biocontainers/samtools -- dry-run
User performs
shpc upgrade -- all -- dry-run
Additional Information:
shpc upgrade
cannot be performed when a user’s software list is empty. However, it will prompt the user to install the software the user tried to upgrade.shpc upgrade
gives the user the option to either uninstall or preserve previous versions of software during the upgrade process.shpc upgrade
gives the user the option to either install or not install the latest version of software to the views the previous versions were installed inshpc upgrade
does not allow the user to include the version of a software as a recipe, this is because the goal is to check the software itself and install the latest version available. It does not upgrade the specific version of the software. Therefore, this command is invalid: 'shpc upgrade quay.io/biocontainers/samtools:1.20--h50ea8bc_0'shpc upgrade does not allow these argument combinations, to maintain clarity in command execution:
Finally, this upgrade functionality has been tested locally, including both manual tests and unit tests.