Skip to content

Commit abbfbc6

Browse files
authored
Merge pull request #344 from ExaWorks/check_state_before_cancelling
Check if the job is in a final state before attempting to ask the exe…
2 parents 1d9bdd8 + fd0526d commit abbfbc6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/psij/job.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ def cancel(self) -> None:
154154
155155
:raises psij.SubmitException: if the job has not yet been submitted.
156156
"""
157+
if self.status.final:
158+
return
157159
if not self.executor:
158160
raise SubmitException('Cannot cancel job: not bound to an executor.')
159161
else:

0 commit comments

Comments
 (0)