X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/35336cd73e444534cb2eda20e3730464cc4e6553..6a18fc0d6f3f9859e905d4762796d813a157605b:/services/api/script/crunch-dispatch.rb diff --git a/services/api/script/crunch-dispatch.rb b/services/api/script/crunch-dispatch.rb index 693dfbdb7f..9eb1c28cb2 100755 --- a/services/api/script/crunch-dispatch.rb +++ b/services/api/script/crunch-dispatch.rb @@ -298,7 +298,6 @@ class Dispatcher job_done = j_done[:job] $stderr.puts "dispatch: child #{pid_done} exit" $stderr.puts "dispatch: job #{job_done.uuid} end" - $redis.publish job_done.uuid, "end" # Ensure every last drop of stdout and stderr is consumed read_pipes @@ -309,9 +308,18 @@ class Dispatcher # Wait the thread j_done[:wait_thr].value + jobrecord = Job.find_by_uuid(job_done.uuid) + jobrecord.running = false + jobrecord.finished_at ||= Time.now, + # Don't set 'jobrecord.success = false' because if the job failed to run due to an + # issue with crunch-job or slurm, we want the job to stay in the queue. + jobrecord.save! + # Invalidate the per-job auth token j_done[:job_auth].update_attributes expires_at: Time.now + $redis.publish job_done.uuid, "end" + @running.delete job_done.uuid end @@ -360,8 +368,6 @@ class Dispatcher end end - - protected def did_recently(thing, min_interval)