-
Notifications
You must be signed in to change notification settings - Fork 217
Set $___EASYBUILD___ environment variable to 'EasyBuild' to indicate that you're in an EasyBuild session
#5058
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
Conversation
easybuild/framework/easyblock.py
Outdated
| self.orig_modulepath = os.getenv('MODULEPATH') | ||
|
|
||
| # keep track of initial environment we start in, so we can restore it if needed | ||
| os.environ['___EASYBUILD___'] = "EasyBuild" # set an environment variable to know we are in an EB session |
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.
We need this before copying the initial environment as that environment gets restored before loading the module (which is exactly where we want to target a conditional load)
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.
@ocaisa Let's move this up, as the very first thing we do in __init__, just to make sure that we never do anything that involves calling out to external tools (which could take this into account) before this is set.
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.
Actually, this should be done way earlier, in main.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.
easybuild/framework/easyblock.py
Outdated
| self.orig_modulepath = os.getenv('MODULEPATH') | ||
|
|
||
| # keep track of initial environment we start in, so we can restore it if needed | ||
| os.environ['___EASYBUILD___'] = "EasyBuild" # set an environment variable to know we are in an EB session |
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.
@ocaisa Let's move this up, as the very first thing we do in __init__, just to make sure that we never do anything that involves calling out to external tools (which could take this into account) before this is set.
$___EASYBUILD___ environment variable to EasyBuild to indicate that you're in an EasyBuild session
$___EASYBUILD___ environment variable to EasyBuild to indicate that you're in an EasyBuild session$___EASYBUILD___ environment variable to 'EasyBuild' to indicate that you're in an EasyBuild session
set `$___EASYBUILD___` via `prepare_main` in `main.py`
boegel
left a comment
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.
lgtm
The use case for this is
buildenvin EESSI (https://gitlab.com/eessi/support/-/issues/213), where you might want to auto-load abuildenvwith your compiler, but not if you are in an EasyBuild session.