Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill jobs on cancel #85

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading