Skip to content

Commit

Permalink
return False when run launchers try to terminate a run that is alread…
Browse files Browse the repository at this point in the history
…y finished

Summary:
Make this is a no-op rather than moving a run from a terminal state into a non-terminal state.
  • Loading branch information
gibsondan committed Jul 18, 2024
1 parent c4328ab commit 893888b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def terminate(self, run_id):
return False

run = self._instance.get_run_by_id(run_id)
if not run:
if not run or run.is_finished:
return False

self._instance.report_run_canceling(run)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def terminate(self, run_id):
tags = self._get_run_tags(run_id)

run = self._instance.get_run_by_id(run_id)
if not run:
if not run or run.is_finished:
return False

self._instance.report_run_canceling(run)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def terminate(self, run_id):
check.str_param(run_id, "run_id")

run = self._instance.get_run_by_id(run_id)
if not run:
if not run or run.is_finished:
return False

self._instance.report_run_canceling(run)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def _get_container(self, run):
def terminate(self, run_id):
run = self._instance.get_run_by_id(run_id)

if not run:
if not run or run.is_finished:
return False

self._instance.report_run_canceling(run)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def terminate(self, run_id):
check.str_param(run_id, "run_id")
run = self._instance.get_run_by_id(run_id)

if not run:
if not run or run.is_finished:
return False

self._instance.report_run_canceling(run)
Expand Down

0 comments on commit 893888b

Please sign in to comment.