-
Notifications
You must be signed in to change notification settings - Fork 4
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
Deactivate Conda Env In HPC Init Script #388
Conversation
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 think this is likely fine.
I would prefer to be a bit more user-friendly, by issuing some kind of warning maybe (probably only if environment name != flepimop-env)? Like some stderr text along the lines of "Detected an active conda environment $X; this will be deactivated and the flepimop-env will be activated".
I don't think it needs to be a "proceed [Y/n]" situation, but my concern here is that we're introducing a subtle side-effect.
Marking this as approved - open to addressing the above in this PR (either fix or convincing me wontfix) or as own issue.
1e8cbd8
to
1c81583
Compare
@pearsonca I've incorporated a message now if the active environment does not match the one being activated. The new after is: (test-env) [twillard@longleaf-login6 flepiMoP]$ source batch/hpc_init.sh longleaf
An explicit $FLEPI_PATH was not provided, please set one (or press enter to use '/work/users/t/w/twillard/flepiMoP'):
Using '/work/users/t/w/twillard/flepiMoP' for $FLEPI_PATH.
An explicit $FLEPI_CONDA was not provided, please set one (or press enter to use 'flepimop-env'):
Using 'flepimop-env' for $FLEPI_CONDA.
Detected an active conda environment 'test-env'. This will be deactivated and the 'flepimop-env' environment will be activated.
Please set a project path (relative to '/work/users/t/w/twillard'):
... |
This is to address a bug where a currently active env would cause the hpc init script to load the flepimop env not cleanly. Determine the currently active env if there is one and if it is not the flepimop env deactivate it with message to the user.
looks good to merge to me; @TimothyWillard feel free to trigger unless you have some additional tweaks in mind. |
1c81583
to
d4c3c7f
Compare
I'm still testing/modifying the changes requested. I shouldn't have requested a re-review yet and this is not ready to merge. |
1) No env active, just activate the flepiMoP env. 2) The flepiMoP env is active, go ahead and refresh it because `module load anaconda` modifies the paths. 3) Another conda env is active, deactivate it with a message.
I apologize for the confusion. This is now tested and ready for review. The three cases look like:
[twillard@longleaf-login4 flepiMoP]$ conda activate test-env
(test-env) [twillard@longleaf-login4 flepiMoP]$ source batch/hpc_init.sh longleaf
An explicit $FLEPI_PATH was not provided, please set one (or press enter to use '/work/users/t/w/twillard/flepiMoP'):
Using '/work/users/t/w/twillard/flepiMoP' for $FLEPI_PATH.
An explicit $FLEPI_CONDA was not provided, please set one (or press enter to use 'flepimop-env'):
Using 'flepimop-env' for $FLEPI_CONDA.
Detected an active conda environment 'test-env'. This will be deactivated and the 'flepimop-env' environment wil be activated.
Please set a project path (relative to '/work/users/t/w/twillard'): ^C
(flepimop-env) [twillard@longleaf-login4 flepiMoP]$ source batch/hpc_init.sh longleaf
An explicit $FLEPI_PATH was not provided, please set one (or press enter to use '/work/users/t/w/twillard/flepiMoP'):
Using '/work/users/t/w/twillard/flepiMoP' for $FLEPI_PATH.
An explicit $FLEPI_CONDA was not provided, please set one (or press enter to use 'flepimop-env'):
Using 'flepimop-env' for $FLEPI_CONDA.
Detected the activate conda environment is 'flepimop-env' already, but will refresh.
Please set a project path (relative to '/work/users/t/w/twillard'): ^C
[twillard@longleaf-login4 flepiMoP]$ source batch/hpc_init.sh longleaf
An explicit $FLEPI_PATH was not provided, please set one (or press enter to use '/work/users/t/w/twillard/flepiMoP'):
Using '/work/users/t/w/twillard/flepiMoP' for $FLEPI_PATH.
An explicit $FLEPI_CONDA was not provided, please set one (or press enter to use 'flepimop-env'):
Using 'flepimop-env' for $FLEPI_CONDA.
Please set a project path (relative to '/work/users/t/w/twillard'): ^C As always feedback from ops is greatly appreciated, especially since this script is designed for ops use. |
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 think this is very clear!
Thanks, this is great :) |
Describe your changes.
This is to address a bug where a currently active env would cause the HPC init script to uncleanly load the flepiMoP env. Simplest solution is to always deactivate before activating. Redundant in the case that the flepiMoP env is already active, but easier than trying to determine the current env. No downside if no env is active.
What does your pull request address? Tag relevant issues.
No issue to tag, just noticed this issue while working on GH-365. Before this change (notice the
flepimop-env
is active):and after:
Tag relevant team members.
@anjalika-nande, @emprzy, @fang19911030, @jcblemai, @pearsonca, @saraloo