-
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?
Changes from all commits
62d84da
3d39bee
282a6d8
d9af480
4dc634d
6659e91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,11 +1,13 @@ | ||||||||||||||||||||||||||
from reframe.core.builtins import parameter, run_after, variable | ||||||||||||||||||||||||||
from reframe.core.exceptions import ReframeFatalError | ||||||||||||||||||||||||||
from reframe.core.exceptions import ReframeFatalError, SanityError | ||||||||||||||||||||||||||
from reframe.core.pipeline import RegressionMixin | ||||||||||||||||||||||||||
from reframe.utility.sanity import make_performance_function | ||||||||||||||||||||||||||
import reframe.utility.sanity as sn | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
from eessi.testsuite import hooks | ||||||||||||||||||||||||||
from eessi.testsuite.constants import DEVICE_TYPES, SCALES, COMPUTE_UNIT, TAGS | ||||||||||||||||||||||||||
from eessi.testsuite.utils import log | ||||||||||||||||||||||||||
from eessi.testsuite import __version__ as testsuite_version | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
# Hooks from the Mixin class seem to be executed _before_ those of the child class | ||||||||||||||||||||||||||
|
@@ -42,6 +44,14 @@ class EESSI_Mixin(RegressionMixin): | |||||||||||||||||||||||||
bench_name = None | ||||||||||||||||||||||||||
bench_name_ci = None | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
# Create ReFrame variables for logging runtime environment information | ||||||||||||||||||||||||||
cvmfs_repo_name = variable(str, value='None') | ||||||||||||||||||||||||||
cvmfs_software_subdir = variable(str, value='None') | ||||||||||||||||||||||||||
full_modulepath = variable(str, value='None') | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
# Make sure the version of the EESSI test suite gets logged in the ReFrame report | ||||||||||||||||||||||||||
eessi_testsuite_version = variable(str, value=testsuite_version) | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
# Note that the error for an empty parameter is a bit unclear for ReFrame 4.6.2, but that will hopefully improve | ||||||||||||||||||||||||||
# see https://github.com/reframe-hpc/reframe/issues/3254 | ||||||||||||||||||||||||||
# If that improves: uncomment the following to force the user to set module_name | ||||||||||||||||||||||||||
|
@@ -165,3 +175,46 @@ def assign_tasks_per_compute_unit(self): | |||||||||||||||||||||||||
def request_mem(self): | ||||||||||||||||||||||||||
"""Call hook to request the required amount of memory per node""" | ||||||||||||||||||||||||||
hooks.req_memory_per_node(self, app_mem_req=self.required_mem_per_node()) | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
@run_after('setup') | ||||||||||||||||||||||||||
def log_runtime_info(self): | ||||||||||||||||||||||||||
"""Log additional runtime information: which CVMFS repo was used (or if it was testing local software), | ||||||||||||||||||||||||||
path to the modulefile, EESSI software subdir, EESSI testsuite version""" | ||||||||||||||||||||||||||
self.postrun_cmds.append('echo "EESSI_CVMFS_REPO: $EESSI_CVMFS_REPO"') | ||||||||||||||||||||||||||
self.postrun_cmds.append('echo "EESSI_SOFTWARE_SUBDIR: $EESSI_SOFTWARE_SUBDIR"') | ||||||||||||||||||||||||||
if self.module_name: | ||||||||||||||||||||||||||
# 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%:*}"' | ||||||||||||||||||||||||||
self.postrun_cmds.append(get_full_modpath) | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
@run_after('run') | ||||||||||||||||||||||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
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 | ||||||||||||||||||||||||||
Comment on lines
+197
to
+203
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'd like to make a distinction between
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm... confused. If Why is it useful to distinguish in the logged data between an unset and empty |
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
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 | ||||||||||||||||||||||||||
Comment on lines
+205
to
+211
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||||||||||||||||||||||||||
Comment on lines
+213
to
+220
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
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: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.
Lol, I was looking for something like this option, and couldn't find it. How did I overlook this option, while it's right there in the
--help
...