-
Notifications
You must be signed in to change notification settings - Fork 11
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
Collect addional info in mixin #206
base: main
Are you sure you want to change the base?
Conversation
# Get full modulepath, stripping leading spaces with sed and trailing colon by string substitution | ||
get_full_modpath = f'modpath=$(module show {self.module_name} 2>&1 | ' | ||
get_full_modpath += 'grep ".lua" | ' | ||
get_full_modpath += 'sed "s/^[[:space:]]*//") && echo "FULL_MODULEPATH: ${modpath%:*}"' |
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 can be simplified using the --location
option:
# Get full modulepath, stripping leading spaces with sed and trailing colon by string substitution | |
get_full_modpath = f'modpath=$(module show {self.module_name} 2>&1 | ' | |
get_full_modpath += 'grep ".lua" | ' | |
get_full_modpath += 'sed "s/^[[:space:]]*//") && echo "FULL_MODULEPATH: ${modpath%:*}"' | |
# Get full modulepath | |
get_full_modpath = f'echo "FULL_MODULEPATH: $(module --location show {self.module_name})"' |
def extract_runtime_info_from_log(self): | ||
"""Extracts the printed runtime info from the job log and logs it as reframe variables""" | ||
# If EESSI_CVMFS_REPO environment variable was set, extract it and store it in self.cvmfs_repo_name | ||
# Try block is needed to surpress sanity error if there is no match |
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.
# Try block is needed to surpress sanity error if there is no match | |
# Try block is needed to suppress sanity error if there is no match |
try: | ||
repo_name = sn.extractsingle(r'EESSI_CVMFS_REPO: /cvmfs/(?P<repo>.*)$', f'{self.stagedir}/{self.stdout}', | ||
'repo', str) | ||
if repo_name: | ||
self.cvmfs_repo_name = f'{repo_name}' | ||
except SanityError: | ||
pass |
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'd like to make a distinction between 'None'
, indicating a failing sanity check, and an empty string, indicating that the EESSI CVMFS repo was not used:
try: | |
repo_name = sn.extractsingle(r'EESSI_CVMFS_REPO: /cvmfs/(?P<repo>.*)$', f'{self.stagedir}/{self.stdout}', | |
'repo', str) | |
if repo_name: | |
self.cvmfs_repo_name = f'{repo_name}' | |
except SanityError: | |
pass | |
try: | |
self.cvmfs_repo_name = sn.extractsingle(r'EESSI_CVMFS_REPO: /cvmfs/(?P<repo>.*)$', f'{self.stagedir}/{self.stdout}', | |
'repo', str) | |
except SanityError: | |
pass |
try: | ||
software_subdir = sn.extractsingle(r'EESSI_SOFTWARE_SUBDIR: (?P<subdir>.*)$', | ||
f'{self.stagedir}/{self.stdout}', 'subdir', str) | ||
if software_subdir: | ||
self.cvmfs_software_subdir = f'{software_subdir}' | ||
except SanityError: | ||
pass |
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.
same here
try: | ||
module_path = sn.extractsingle(r'FULL_MODULEPATH: (?P<modpath>.*)$', f'{self.stagedir}/{self.stdout}', | ||
'modpath', str) | ||
print(f"Full modulepath: {module_path}") | ||
if module_path: | ||
self.full_modulepath = f'{module_path}' | ||
except SanityError: | ||
pass |
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.
same here
Solves #196
Note that the nodenames on which the test is run are already logged by the ReFrame framework, so we don't need to do that.
Discussed on the ReFrame slack channel. The challenge is that we want the variables from the batch nodes, so it has to be printed with
postrun_cmds
. But then, we need to get it from the output, and into a ReFramevariable
so that it is logged. Those need to be initialized in the class body. Then can be updated with the output of the extracted information. We use sanity functions to extract from the output, catching the SanityError that is produced if there is no match (as we don't want the test to fail because of this). Note that SanityError's are actually expected for runs on local software stack, since then theEESSI_*
environment variables are not set, and the pattern match fails. That's fine, we just want the variables to read'None'
in those cases.