projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '11221-always-restart-services'
[arvados.git]
/
services
/
api
/
lib
/
crunch_dispatch.rb
diff --git
a/services/api/lib/crunch_dispatch.rb
b/services/api/lib/crunch_dispatch.rb
index cf19cc409efd92566a1798d60e89aae9e3b3587b..bea1657de22b72c0d5296a4c571afcee3ffc0993 100644
(file)
--- 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
# 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
end
else
-
squeue =
[]
+ []
end
end
def scancel slurm_name
cmd = sudo_preface + ['scancel', '-n', slurm_name]
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
if not $?.success?
Rails.logger.error "scancel #{slurm_name.shellescape}: $?"
end