Skip to content

Commit 97f4e6c

Browse files
authored
Merge pull request #346 from ExaWorks/ensure_job_is_new_before_submit
Check that the job is in a new state before submitting.
2 parents 3fcb831 + 6137089 commit 97f4e6c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/psij/job_executor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from psij import InvalidJobException
99
from psij.descriptor import Descriptor, _VersionEntry
1010
from psij._plugins import _register_plugin, _get_plugin_class, _print_plugin_status
11+
from psij.job_state import JobState
1112
from psij.job_status import JobStatus
1213
from psij.job import Job, JobStatusCallback, FunctionJobStatusCallback
1314
from psij.job_executor_config import JobExecutorConfig
@@ -88,6 +89,8 @@ def _check_job(self, job: Job) -> JobSpec:
8889
-------
8990
A non-null job specification
9091
"""
92+
if job.status.state != JobState.NEW:
93+
raise InvalidJobException('Job must be in NEW state')
9194
spec = job.spec
9295
if not spec:
9396
raise InvalidJobException('Missing specification')

0 commit comments

Comments
 (0)