Consume all arguments after arv-mount --exec, and fork subprocess
[arvados.git] / sdk / cli / bin / arv-run-pipeline-instance
index a1790be3dcf0a188e75da5aee2b356b88ecf807c..d2b1109e1630e2fbba84fcfa626d10e7bbe45bc6 100755 (executable)
@@ -131,6 +131,7 @@ end
 # this program, that is, not the pipeline component parameters).
 
 p = Trollop::Parser.new do
+  version __FILE__
   opt(:dry_run,
       "Do not start any new jobs or wait for existing jobs to finish. Just find out whether jobs are finished, queued, or running for each component.",
       :type => :boolean,
@@ -447,7 +448,7 @@ class WhRunPipelineInstance
             if candidate_job[:success]
               unless @options[:no_reuse_finished]
                 job = candidate_job
-                debuglog "component #{cname} satisfied by job #{job[:uuid]} version #{job[:script_version]}"
+                $stderr.puts "using #{job[:uuid]} (finished at #{job[:finished_at]}) for component #{cname}"
                 c[:job] = job
               end
             else
@@ -457,7 +458,7 @@ class WhRunPipelineInstance
           end
           if not c[:job] and second_place_job
             job = second_place_job
-            debuglog "component #{cname} satisfied by job #{job[:uuid]} version #{job[:script_version]}"
+            $stderr.puts "using #{job[:uuid]} (running since #{job[:started_at]}) for component #{cname}"
             c[:job] = job
           end
           if not c[:job]
@@ -480,7 +481,8 @@ class WhRunPipelineInstance
           c[:wait] = true
         end
         if c[:job] and c[:job][:uuid]
-          if not c[:job][:finished_at] and not c[:job][:cancelled_at]
+          if (c[:job][:running] or
+              not (c[:job][:finished_at] or c[:job][:cancelled_at]))
             c[:job] = JobCache.get(c[:job][:uuid])
           end
           if c[:job][:success]
@@ -542,6 +544,7 @@ class WhRunPipelineInstance
 
     if @options[:status_text] != '/dev/null'
       File.open(@options[:status_text], 'w') do |f|
+        f.puts ""
         f.puts "#{Time.now} -- pipeline_instance #{@instance[:uuid]}"
         namewidth = @components.collect { |cname, c| cname.size }.max
         @components.each do |cname, c|