Skip to content

Commit f24a2f5

Browse files
author
Vasileios Karakasis
authored
Merge branch 'master' into doc/system-variables
2 parents 4663099 + 46a00d1 commit f24a2f5

File tree

5 files changed

+35
-16
lines changed

5 files changed

+35
-16
lines changed

reframe/core/runtime.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,17 @@ def modules_system(self):
162162
'''
163163
return self._system.modules_system
164164

165-
def get_option(self, option):
165+
def get_option(self, option, default=None):
166166
'''Get a configuration option.
167167
168168
:arg option: The option to be retrieved.
169+
:arg default: The value to return if ``option`` cannot be retrieved.
169170
:returns: The value of the option.
171+
172+
.. versionchanged:: 3.11.0
173+
Add ``default`` named argument.
170174
'''
171-
return self._site_config.get(option)
175+
return self._site_config.get(option, default=default)
172176

173177

174178
# Global resources for the current host

reframe/core/schedulers/slurm.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -502,25 +502,25 @@ def _do_cancel_if_blocked(self, job, reason_descr):
502502
if node_match:
503503
node_names = node_match['node_names']
504504
if node_names:
505-
# Retrieve the info of the unavailable nodes
506-
# and check if they are indeed down
505+
# Retrieve the info of the unavailable nodes and check
506+
# if they are indeed down. According to Slurm's docs
507+
# this should not be necessary, but we check anyways
508+
# to be on the safe side.
507509
self.log(f'Checking if nodes {node_names!r} '
508510
f'are indeed unavailable')
509511
nodes = self._get_nodes_by_name(node_names)
510512
if not any(n.is_down() for n in nodes):
511513
return
512-
else:
513-
# List of unavailable nodes is empty; assume job
514-
# is pending
515-
return
516514

517-
self.cancel(job)
518-
reason_msg = ('job cancelled because it was blocked due to '
519-
'a perhaps non-recoverable reason: ' + reason)
520-
if reason_details is not None:
521-
reason_msg += ', ' + reason_details
515+
self.cancel(job)
516+
reason_msg = (
517+
'job cancelled because it was blocked due to '
518+
'a perhaps non-recoverable reason: ' + reason
519+
)
520+
if reason_details is not None:
521+
reason_msg += ', ' + reason_details
522522

523-
job._exception = JobBlockedError(reason_msg, job.jobid)
523+
job._exception = JobBlockedError(reason_msg, job.jobid)
524524

525525
def wait(self, job):
526526
# Quickly return in case we have finished already

reframe/frontend/cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,11 @@ def restrict_logging():
772772
if config_param == 'all':
773773
printer.info(str(rt.site_config))
774774
else:
775-
value = rt.get_option(config_param)
776-
if value is None:
775+
# Create a unique value to differentiate between configuration
776+
# parameters with value `None` and invalid ones
777+
default = {'token'}
778+
value = rt.get_option(config_param, default)
779+
if value is default:
777780
printer.error(
778781
f'no such configuration parameter found: {config_param}'
779782
)

reframe/schemas/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@
571571
"systems/partitions/max_jobs": 8,
572572
"systems/partitions/prepare_cmds": [],
573573
"systems/partitions/processor": {},
574+
"systems/partitions/time_limit": null,
574575
"systems/partitions/devices": [],
575576
"systems/partitions/extras": {}
576577
}

unittests/test_cli.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,17 @@ def test_show_config_unknown_param(run_reframe):
620620
assert returncode == 0
621621

622622

623+
def test_show_config_null_param(run_reframe):
624+
returncode, stdout, stderr = run_reframe(
625+
more_options=['--show-config=general/report_junit'],
626+
system='testsys'
627+
)
628+
assert 'null' in stdout
629+
assert 'Traceback' not in stdout
630+
assert 'Traceback' not in stderr
631+
assert returncode == 0
632+
633+
623634
def test_verbosity(run_reframe):
624635
returncode, stdout, stderr = run_reframe(
625636
more_options=['-vvvvv'],

0 commit comments

Comments
 (0)