X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/3e7478a9a822686e1b5291fb0909a2ee2fcfeace..002f863605469cee7e112f4c16a78e3b6278672c:/sdk/cli/bin/arv-run-pipeline-instance diff --git a/sdk/cli/bin/arv-run-pipeline-instance b/sdk/cli/bin/arv-run-pipeline-instance index 3e8bdbfcae..f0ada5d12a 100755 --- a/sdk/cli/bin/arv-run-pipeline-instance +++ b/sdk/cli/bin/arv-run-pipeline-instance @@ -413,15 +413,23 @@ class WhRunPipelineInstance end def setup_instance - @instance ||= PipelineInstance. - create(:components => @components, + if $options[:submit] + @instance ||= PipelineInstance. + create(:components => @components, + :pipeline_template_uuid => @template[:uuid]) + else + @instance ||= PipelineInstance. + create(:components => @components, :pipeline_template_uuid => @template[:uuid], - :active => true) + :state => 'RunningOnClient') + end self end def run moretodo = true + interrupted = false + while moretodo moretodo = false @components.each do |cname, c| @@ -437,7 +445,7 @@ class WhRunPipelineInstance # No job yet associated with this component and is component inputs # are fully specified (any output_of script_parameters are resolved # to real value) - job = JobCache.create { + job = JobCache.create({ :script => c[:script], :script_parameters => c[:script_parameters], :script_version => c[:script_version], @@ -457,7 +465,7 @@ class WhRunPipelineInstance :minimum_script_version => c[:minimum_script_version], :exclude_script_versions => c[:exclude_minimum_script_versions], :find_or_create => !(@options[:no_reuse] || c[:nondeterministic]), - } + }) if job debuglog "component #{cname} new job #{job[:uuid]}" c[:job] = job @@ -544,7 +552,9 @@ class WhRunPipelineInstance sleep 10 rescue Interrupt debuglog "interrupt", 0 - abort + interrupted = true + break + #abort end end end @@ -565,11 +575,30 @@ class WhRunPipelineInstance end end - if ended == @components.length or failed > 0 - @instance[:active] = false - @instance[:success] = (succeeded == @components.length) + success = (succeeded == @components.length) + + if interrupted + if success + @instance[:active] = false + @instance[:success] = success + @instance[:state] = "Complete" + else + @instance[:active] = nil + @instance[:success] = nil + @instance[:state] = 'Paused' + end + else + if ended == @components.length or failed > 0 + @instance[:active] = false + @instance[:success] = success + @instance[:state] = success ? "Complete" : "Failed" + end end + # set components_summary + components_summary = {"todo" => @components.length - ended, "done" => succeeded, "failed" => failed} + @instance[:components_summary] = components_summary + @instance.save end