X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e7d6f7ade14cd2c513ad10d39da23b926e47b679..7aea6d3d35bc622818dbb62929a7f7fc75a4aeaf:/services/api/script/crunch-dispatch.rb diff --git a/services/api/script/crunch-dispatch.rb b/services/api/script/crunch-dispatch.rb index ddc0f3a899..bb7ce7e12d 100755 --- a/services/api/script/crunch-dispatch.rb +++ b/services/api/script/crunch-dispatch.rb @@ -2,6 +2,23 @@ include Process +$options = {} +(ARGV.any? ? ARGV : ['--jobs', '--pipelines']).each do |arg| + case arg + when '--jobs' + $options[:jobs] = true + when '--pipelines' + $options[:pipelines] = true + else + abort "Unrecognized command line option '#{arg}'" + end +end +if not ($options[:jobs] or $options[:pipelines]) + abort "Nothing to do. Please specify at least one of: --jobs, --pipelines." +end + +ARGV.reject! { |a| a =~ /--jobs|--pipelines/ } + $warned = {} $signal = {} %w{TERM INT}.each do |sig| @@ -34,8 +51,14 @@ class Dispatcher end def refresh_todo - @todo = Job.queue.select do |j| j.repository end - @todo_pipelines = PipelineInstance.queue + @todo = [] + if $options[:jobs] + @todo = Job.queue.select(&:repository) + end + @todo_pipelines = [] + if $options[:pipelines] + @todo_pipelines = PipelineInstance.queue + end end def sinfo