Skip to content

Commit

Permalink
Kill jobs on cancel (#85)
Browse files Browse the repository at this point in the history
* Kill jobs on cancel

* Catch additional response types
  • Loading branch information
fivegrant authored Apr 15, 2024
1 parent 20ec339 commit 55365ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions service/models/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ class Status(Enum):
def from_rq(rq_status):
rq_status_to_tds_status = {
"canceled": "cancelled",
"stopped": "cancelled",
"complete": "complete",
"error": "error",
"queued": "queued",
"running": "running",
"working": "running",
"failed": "failed",
"started": "running",
"finished": "complete",
Expand Down
2 changes: 2 additions & 0 deletions service/utils/rq_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from rq import Queue
from rq.exceptions import NoSuchJobError
from rq.job import Job
from rq.command import send_stop_job_command

from settings import settings
from utils.tds import update_tds_status, create_tds_job, cancel_tds_job
Expand Down Expand Up @@ -102,6 +103,7 @@ def kill_job(job_id, redis_conn):
)
else:
job.cancel()
send_stop_job_command(redis_conn, job_id)

cancel_tds_job(str(job_id))

Expand Down

0 comments on commit 55365ab

Please sign in to comment.