diff --git a/gateway/api/views.py b/gateway/api/views.py index 8869beb90..93ebd7ada 100644 --- a/gateway/api/views.py +++ b/gateway/api/views.py @@ -415,6 +415,9 @@ def logs(self, request, pk=None): # pylint: disable=invalid-name,unused-argumen logs = job.logs return Response({"logs": logs}) + def get_runtime_job(self, job): + return RuntimeJob.objects.filter(job=job) + @action(methods=["POST"], detail=True) def stop(self, request, pk=None): # pylint: disable=invalid-name,unused-argument """Stops job""" @@ -426,6 +429,11 @@ def stop(self, request, pk=None): # pylint: disable=invalid-name,unused-argumen job.status = Job.STOPPED job.save(update_fields=["status"]) message = "Job has been stopped." + runtime_jobs = self.get_runtime_job(job) + for runtime_job_entry in runtime_jobs: + print(runtime_job_entry.runtime_job) + + if job.compute_resource: if job.compute_resource.active: job_handler = get_job_handler(job.compute_resource.host)