Skip to content

Commit 6c306b6

Browse files
committed
Merge branch 'master' into doc/whats-new-4.0
2 parents ee8ae5e + a7e49b9 commit 6c306b6

File tree

7 files changed

+77
-12
lines changed

7 files changed

+77
-12
lines changed

docs/regression_test_api.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ Environments and Systems
206206
:members:
207207
:show-inheritance:
208208

209-
-------------------------------------
210-
Job Schedulers and Parallel Launchers
211-
-------------------------------------
209+
---------------------------
210+
Jobs and Parallel Launchers
211+
---------------------------
212212

213213
.. automodule:: reframe.core.schedulers
214214
:members:

reframe/core/pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ def hashcode(self):
11941194
return self._rfm_hashcode
11951195

11961196
m = hashlib.sha256()
1197-
if self.is_fixture:
1197+
if self.is_fixture():
11981198
m.update(self.unique_name.encode('utf-8'))
11991199
else:
12001200
basename, *params = self.display_name.split(' %')

reframe/core/schedulers/__init__.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222

2323

2424
class JobMeta(RegressionTestMeta, abc.ABCMeta):
25-
'''Job metaclass.'''
25+
'''Job metaclass.
26+
27+
:meta private:
28+
'''
2629

2730

2831
class JobSchedulerMeta(abc.ABCMeta):
@@ -354,34 +357,45 @@ def create(cls, scheduler, launcher, *args, **kwargs):
354357

355358
@property
356359
def name(self):
360+
'''The name of this job.'''
357361
return self._name
358362

359363
@property
360364
def workdir(self):
365+
'''The working directory for this job.'''
361366
return self._workdir
362367

363368
@property
364369
def cli_options(self):
370+
'''The scheduler options passed through the :option:`-J` command line
371+
options.'''
365372
return self._cli_options
366373

367374
@property
368375
def script_filename(self):
376+
'''The filename of the generated job script.'''
369377
return self._script_filename
370378

371379
@property
372380
def stdout(self):
381+
'''The file where the standard output of the job is saved.'''
373382
return self._stdout
374383

375384
@property
376385
def stderr(self):
386+
'''The file where the standard error of the job is saved.'''
377387
return self._stderr
378388

379389
@property
380390
def sched_flex_alloc_nodes(self):
391+
'''The argument of the :option:`--flex-alloc-nodes` command line
392+
option.'''
381393
return self._sched_flex_alloc_nodes
382394

383395
@property
384396
def sched_access(self):
397+
'''The partition's :attr:`~config.systems.partitions.access`
398+
options.'''
385399
return self._sched_access
386400

387401
@property
@@ -408,10 +422,16 @@ def completion_time(self):
408422

409423
@property
410424
def scheduler(self):
425+
'''The scheduler where this job is assigned to.'''
411426
return self._scheduler
412427

413428
@property
414429
def exception(self):
430+
'''The last exception that this job encountered.
431+
432+
The scheduler will raise this exception the next time the status of
433+
this job is queried.
434+
'''
415435
return self._exception
416436

417437
@property

reframe/frontend/executors/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,9 @@ def finalize(self):
386386

387387
self._current_stage = 'finalize'
388388
self._notify_listeners('on_task_success')
389-
self._perflogger.log_performance(logging.INFO, self,
390-
multiline=self._perflog_compat)
389+
if self.check.is_performance_check():
390+
self._perflogger.log_performance(logging.INFO, self,
391+
multiline=self._perflog_compat)
391392

392393
@logging.time_function
393394
def cleanup(self, *args, **kwargs):
@@ -397,8 +398,9 @@ def fail(self, exc_info=None):
397398
self._failed_stage = self._current_stage
398399
self._exc_info = exc_info or sys.exc_info()
399400
self._notify_listeners('on_task_failure')
400-
self._perflogger.log_performance(logging.INFO, self,
401-
multiline=self._perflog_compat)
401+
if self.check.is_performance_check():
402+
self._perflogger.log_performance(logging.INFO, self,
403+
multiline=self._perflog_compat)
402404

403405
def skip(self, exc_info=None):
404406
self._skipped = True

unittests/test_filters.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ def test_have_any_name_param_test(sample_param_cases):
8383
sample_param_cases)
8484
assert 0 == count_checks(filters.have_any_name(['_X@12']),
8585
sample_param_cases)
86-
assert 2 == count_checks(filters.have_any_name(['/023313dc', '/efddbc6c']),
86+
87+
# The /0951c7ff selects two tests as they both have x=1
88+
assert 3 == count_checks(filters.have_any_name(['/0951c7ff', '/37e9e1c6']),
8789
sample_param_cases)
8890
assert 2 == count_checks(filters.have_any_name(['_X@0', '_X@1']),
8991
sample_param_cases)

unittests/test_pipeline.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,6 +1902,33 @@ def set_defaults(self):
19021902
assert x.bar == 100
19031903

19041904

1905+
def test_hashcode():
1906+
# We always redefine _X0 here so that the test gets always the same base
1907+
# name (class name) and only the parameter values should change. We then
1908+
# use aliases to access the various definitions for our assertions.
1909+
1910+
class _X0(rfm.RunOnlyRegressionTest):
1911+
p = parameter([1])
1912+
1913+
class _X0(rfm.RunOnlyRegressionTest):
1914+
p = parameter([2])
1915+
1916+
_X1 = _X0
1917+
1918+
class _X0(rfm.RunOnlyRegressionTest):
1919+
p = parameter([1, 2])
1920+
1921+
_X2 = _X0
1922+
1923+
t0 = _X0(variant_num=0)
1924+
t1 = _X1(variant_num=0)
1925+
t2, t3 = (_X2(variant_num=i) for i in range(_X2.num_variants))
1926+
1927+
assert t0.hashcode != t1.hashcode
1928+
assert t2.hashcode == t0.hashcode
1929+
assert t3.hashcode == t1.hashcode
1930+
1931+
19051932
def test_variables_deprecation():
19061933
with pytest.warns(ReframeDeprecationWarning):
19071934
class _X(rfm.RunOnlyRegressionTest):

unittests/test_policies.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,20 @@ def perf1(self):
989989
return _MyTest()
990990

991991

992+
@pytest.fixture
993+
def simple_test():
994+
class _MySimpleTest(rfm.RunOnlyRegressionTest):
995+
valid_systems = ['*']
996+
valid_prog_environs = ['*']
997+
executable = 'echo hello'
998+
999+
@sanity_function
1000+
def validate(self):
1001+
return sn.assert_found(r'hello', self.stdout)
1002+
1003+
return _MySimpleTest()
1004+
1005+
9921006
@pytest.fixture
9931007
def config_perflog(make_config_file):
9941008
def _config_perflog(fmt, perffmt=None, logging_opts=None):
@@ -1178,7 +1192,7 @@ def test_perf_logging_no_perfvars(make_runner, make_exec_ctx, perf_test,
11781192

11791193

11801194
def test_perf_logging_multiline(make_runner, make_exec_ctx, perf_test,
1181-
config_perflog, tmp_path):
1195+
simple_test, config_perflog, tmp_path):
11821196
make_exec_ctx(
11831197
config_perflog(
11841198
fmt=(
@@ -1193,7 +1207,7 @@ def test_perf_logging_multiline(make_runner, make_exec_ctx, perf_test,
11931207
)
11941208
logging.configure_logging(rt.runtime().site_config)
11951209
runner = make_runner()
1196-
testcases = executors.generate_testcases([perf_test])
1210+
testcases = executors.generate_testcases([perf_test, simple_test])
11971211
runner.runall(testcases)
11981212

11991213
logfile = tmp_path / 'perflogs' / 'generic' / 'default' / '_MyTest.log'

0 commit comments

Comments
 (0)