[ARVADOS] created: f31475dfeb37c0e4d6b5244cba3bbd06e323b8e8
Git user
git at public.curoverse.com
Mon Mar 20 14:59:49 EDT 2017
at f31475dfeb37c0e4d6b5244cba3bbd06e323b8e8 (commit)
commit f31475dfeb37c0e4d6b5244cba3bbd06e323b8e8
Author: Lucas Di Pentima <lucas at curoverse.com>
Date: Mon Mar 20 15:56:55 2017 -0300
11170: Set up a thread to reap the status of squeue runs so that they don't become zombie processes.
diff --git a/services/api/lib/crunch_dispatch.rb b/services/api/lib/crunch_dispatch.rb
index 21843de..a66b4a0 100644
--- a/services/api/lib/crunch_dispatch.rb
+++ b/services/api/lib/crunch_dispatch.rb
@@ -963,7 +963,10 @@ class CrunchDispatch
# An array of job_uuids in squeue
def squeue_jobs
if Rails.configuration.crunch_job_wrapper == :slurm_immediate
- File.popen(['squeue', '-a', '-h', '-o', '%j']).readlines.map do |line|
+ p = File.popen(['squeue', '-a', '-h', '-o', '%j'])
+ # Avoid zombie processes stack up
+ Process.detach(p.pid)
+ p.readlines.map do |line|
line.strip
end
else
@@ -973,7 +976,10 @@ class CrunchDispatch
def scancel slurm_name
cmd = sudo_preface + ['scancel', '-n', slurm_name]
- puts File.popen(cmd).read
+ p = File.popen(cmd)
+ # Avoid zombie processes stack up
+ Process.detach(p.pid)
+ puts p.read
if not $?.success?
Rails.logger.error "scancel #{slurm_name.shellescape}: $?"
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list