Skip to content

Commit

Permalink
Terminate job only when job id available
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessioDelConte committed Feb 4, 2025
1 parent afd6771 commit 0315d6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drmaatic/job/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def destroy(self, request, *args, **kwargs):
"""
job: Job = self.get_object()

if not job.has_finished():
if not job.has_finished() and job.drm_job_id:
terminate_job(job.drm_job_id)

job.delete_from_user()
Expand All @@ -147,7 +147,7 @@ def stop(self, request, *args, **kwargs):
"""
job: Job = self.get_object()

if not job.has_finished():
if not job.has_finished() and job.drm_job_id:
try:
terminate_job(job.drm_job_id)
except InternalException: # The job can be already finished
Expand Down

0 comments on commit 0315d6d

Please sign in to comment.