X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8d6ffdf2fba938e7fbb5f128664d828d2669bcfe..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 293a77c099..1d75f58433 100644 --- a/apps/workbench/app/models/pipeline_instance_work_unit.rb +++ b/apps/workbench/app/models/pipeline_instance_work_unit.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + class PipelineInstanceWorkUnit < ProxyWorkUnit def children return @my_children if @my_children @@ -5,7 +9,7 @@ class PipelineInstanceWorkUnit < ProxyWorkUnit items = [] jobs = {} - results = Job.where(uuid: @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 @@ -55,4 +59,22 @@ class PipelineInstanceWorkUnit < ProxyWorkUnit 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