X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/3a31db02591a2f57d51b98ba9add7d835c5c6c26..a8378b8deaa2bbf9d2c154d9d9bb072538c288cc:/services/api/lib/crunch_dispatch.rb diff --git a/services/api/lib/crunch_dispatch.rb b/services/api/lib/crunch_dispatch.rb index cf19cc409e..bea1657de2 100644 --- a/services/api/lib/crunch_dispatch.rb +++ b/services/api/lib/crunch_dispatch.rb @@ -963,17 +963,22 @@ class CrunchDispatch # An array of job_uuids in squeue def squeue_jobs if Rails.configuration.crunch_job_wrapper == :slurm_immediate - squeue = File.popen(['squeue', '-a', '-h', '-o', '%j']).readlines.map do |line| - line.strip + p = IO.popen(['squeue', '-a', '-h', '-o', '%j']) + begin + p.readlines.map {|line| line.strip} + ensure + p.close end else - squeue = [] + [] end end def scancel slurm_name cmd = sudo_preface + ['scancel', '-n', slurm_name] - puts File.popen(cmd).read + IO.popen(cmd) do |scancel_pipe| + puts scancel_pipe.read + end if not $?.success? Rails.logger.error "scancel #{slurm_name.shellescape}: $?" end