diff --git a/reframe/core/schedulers/local.py b/reframe/core/schedulers/local.py index 2105e45a7f..5ace2c917a 100644 --- a/reframe/core/schedulers/local.py +++ b/reframe/core/schedulers/local.py @@ -12,7 +12,7 @@ import reframe.core.schedulers as sched import reframe.utility.osext as osext from reframe.core.backends import register_scheduler -from reframe.core.exceptions import ReframeError +from reframe.core.exceptions import JobError, ReframeError class _TimeoutExpired(ReframeError): @@ -187,9 +187,12 @@ def _poll_job(self, job): # Job has not finished; check if we have reached a timeout t_elapsed = time.time() - job.submit_time if job.time_limit and t_elapsed > job.time_limit: - self.log(f'Job {job.jobid} timed out; kill it') self._kill_all(job) job._state = 'TIMEOUT' + job._exception = JobError( + f'job timed out ({t_elapsed:.6f}s > {job.time_limit}s)', + job.jobid + ) return diff --git a/unittests/test_schedulers.py b/unittests/test_schedulers.py index 545c6d2033..797fecd2b2 100644 --- a/unittests/test_schedulers.py +++ b/unittests/test_schedulers.py @@ -487,7 +487,9 @@ def test_submit_timelimit(minimal_job, local_only): t_job = time.time() submit_job(minimal_job) assert minimal_job.jobid is not None - minimal_job.wait() + with pytest.raises(JobError): + minimal_job.wait() + t_job = time.time() - t_job assert t_job >= 2 assert t_job < 3