[ARVADOS] updated: 79e53c0eed77396cb37f60b48be0c60fe7e0ab89

Git user git at public.curoverse.com
Mon Mar 20 17:41:23 EDT 2017


Summary of changes:
 services/api/lib/crunch_dispatch.rb | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

       via  79e53c0eed77396cb37f60b48be0c60fe7e0ab89 (commit)
      from  f31475dfeb37c0e4d6b5244cba3bbd06e323b8e8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 79e53c0eed77396cb37f60b48be0c60fe7e0ab89
Author: Lucas Di Pentima <lucas at curoverse.com>
Date:   Mon Mar 20 18:39:43 2017 -0300

    11170: Treat the squeue/scancel calls as files instead of treating them as processes. Calling close when finished reading from them.

diff --git a/services/api/lib/crunch_dispatch.rb b/services/api/lib/crunch_dispatch.rb
index a66b4a0..7c9fa0a 100644
--- a/services/api/lib/crunch_dispatch.rb
+++ b/services/api/lib/crunch_dispatch.rb
@@ -963,11 +963,10 @@ class CrunchDispatch
   # An array of job_uuids in squeue
   def squeue_jobs
     if Rails.configuration.crunch_job_wrapper == :slurm_immediate
-      p = File.popen(['squeue', '-a', '-h', '-o', '%j'])
-      # Avoid zombie processes stack up
-      Process.detach(p.pid)
-      p.readlines.map do |line|
-        line.strip
+      IO.popen(['squeue', '-a', '-h', '-o', '%j']) do |squeue_pipe|
+        squeue_pipe.readlines.map do |line|
+          line.strip
+        end
       end
     else
       []
@@ -976,10 +975,9 @@ class CrunchDispatch
 
   def scancel slurm_name
     cmd = sudo_preface + ['scancel', '-n', slurm_name]
-    p = File.popen(cmd)
-    # Avoid zombie processes stack up
-    Process.detach(p.pid)
-    puts p.read
+    IO.popen(cmd) do |scancel_pipe|
+      puts scancel_pipe.read
+    end
     if not $?.success?
       Rails.logger.error "scancel #{slurm_name.shellescape}: $?"
     end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list