X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0a98952530fb465fa31566fa5e0192bea9fc16e4..615e280721c4be51556e2c31b4baffa69dd0d6d8:/apps/workbench/app/models/pipeline_instance_work_unit.rb diff --git a/apps/workbench/app/models/pipeline_instance_work_unit.rb b/apps/workbench/app/models/pipeline_instance_work_unit.rb index 8285424a29..1d75f58433 100644 --- a/apps/workbench/app/models/pipeline_instance_work_unit.rb +++ b/apps/workbench/app/models/pipeline_instance_work_unit.rb @@ -1,11 +1,15 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + class PipelineInstanceWorkUnit < ProxyWorkUnit def children - return self.my_children if self.my_children + return @my_children if @my_children items = [] jobs = {} - results = Job.where(uuid: self.proxied.job_ids.values).results + results = Job.where(uuid: @proxied.job_ids.values).with_count("none").results results.each do |j| jobs[j.uuid] = j end @@ -18,18 +22,29 @@ class PipelineInstanceWorkUnit < ProxyWorkUnit if job[:uuid] and jobs[job[:uuid]] items << jobs[job[:uuid]].work_unit(name) else - items << JobWorkUnit.new(job, name) + items << JobWorkUnit.new(job, name, uuid) end else - items << ProxyWorkUnit.new(c, name) + items << JobWorkUnit.new(c, name, uuid) end else - self.unreadable_children = true + @unreadable_children = true break end end - self.my_children = items + @my_children = items + end + + def outputs + items = [] + components = get(:components) + components.each do |name, c| + if c.is_a?(Hash) + items << c[:output_uuid] if c[:output_uuid] + end + end + items end def uri @@ -40,4 +55,26 @@ class PipelineInstanceWorkUnit < ProxyWorkUnit def title "pipeline" end + + def template_uuid + get(:pipeline_template_uuid) + end + + def state_label + if get(:state) != "Failed" + return super + end + if get(:components_summary).andand[:failed].andand > 0 + return super + end + # Show "Cancelled" instead of "Failed" if there are no failed + # components. #12840 + get(:components).each do |_, c| + jstate = c[:job][:state] rescue nil + if jstate == "Failed" + return "Failed" + end + end + "Cancelled" + end end