X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9b2aa42213a7d333bbe93e040c2d152a70e9b5af..a8378b8deaa2bbf9d2c154d9d9bb072538c288cc:/services/api/lib/crunch_dispatch.rb diff --git a/services/api/lib/crunch_dispatch.rb b/services/api/lib/crunch_dispatch.rb index 21843de67e..bea1657de2 100644 --- a/services/api/lib/crunch_dispatch.rb +++ b/services/api/lib/crunch_dispatch.rb @@ -963,8 +963,11 @@ 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| - line.strip + p = IO.popen(['squeue', '-a', '-h', '-o', '%j']) + begin + p.readlines.map {|line| line.strip} + ensure + p.close end else [] @@ -973,7 +976,9 @@ class CrunchDispatch 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