X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a4f061a5bf48f0335238da72b8d03ca349fa7553..695702b379a7be5abd96742ffee7f4f4bfcef2a8:/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 9d6db39572..dd5685ac3d 100644 --- a/apps/workbench/app/models/pipeline_instance_work_unit.rb +++ b/apps/workbench/app/models/pipeline_instance_work_unit.rb @@ -1,14 +1,16 @@ class PipelineInstanceWorkUnit < ProxyWorkUnit def 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).results results.each do |j| jobs[j.uuid] = j end - components = (self.proxied.components if self.proxied.respond_to?(:components)) || self.proxied[:components] + components = get(:components) components.each do |name, c| if c.is_a?(Hash) job = c[:job] @@ -19,53 +21,38 @@ class PipelineInstanceWorkUnit < ProxyWorkUnit items << JobWorkUnit.new(job, name) end else - items << ProxyWorkUnit.new(c, name) + items << JobWorkUnit.new(c, name) end else + @unreadable_children = true break end end - items + @my_children = items end - def progress - state = (self.proxied.state if self.proxied.respond_to?(:state)) || self.proxied[:state] - if state == 'Complete' - return 1.0 - end - - done = 0 - failed = 0 - todo = 0 - children.each do |c| - if c.success?.nil? - todo = todo+1 - elsif c.success? - done = done+1 - else - failed = failed+1 + 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 - - if done + failed + todo > 0 - total = done + failed + todo - (done+failed).to_f / total - else - 0.0 - end - end - - def can_cancel? - true + items end def uri - uuid = (self.proxied.uuid if self.proxied.respond_to?(:uuid)) || self.proxied[:uuid] + uuid = get(:uuid) "/pipeline_instances/#{uuid}" end def title "pipeline" end + + def template_uuid + get(:pipeline_template_uuid) + end end