[ARVADOS] created: c685ee1c4445712da0b135206b4e032b3af21b9b

git at public.curoverse.com git at public.curoverse.com
Mon Aug 25 10:05:29 EDT 2014


        at  c685ee1c4445712da0b135206b4e032b3af21b9b (commit)


commit c685ee1c4445712da0b135206b4e032b3af21b9b
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Aug 25 10:05:14 2014 -0400

    crunch-dispatch can run --jobs, --pipelines, or both.

diff --git a/services/api/script/crunch-dispatch.rb b/services/api/script/crunch-dispatch.rb
index ddc0f3a..bfb0dc1 100755
--- a/services/api/script/crunch-dispatch.rb
+++ b/services/api/script/crunch-dispatch.rb
@@ -2,6 +2,21 @@
 
 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
+
 $warned = {}
 $signal = {}
 %w{TERM INT}.each do |sig|
@@ -34,8 +49,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
+    end
+    @todo_pipelines = []
+    if $options[:pipelines]
+      @todo_pipelines = PipelineInstance.queue
+    end
   end
 
   def sinfo

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list