X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/df591042778408d03d410d5c22a669d85652d1ea..068e72307f9ce91538e45cb461b99cf92d2f5666:/apps/workbench/app/models/container_work_unit.rb diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb index 7f1052ebcd..c564dc12e4 100644 --- a/apps/workbench/app/models/container_work_unit.rb +++ b/apps/workbench/app/models/container_work_unit.rb @@ -14,6 +14,7 @@ class ContainerWorkUnit < ProxyWorkUnit @container = Container.find(container_uuid) end end + @container = nil if !defined?(@container) @child_proxies = child_objects end @@ -23,7 +24,7 @@ class ContainerWorkUnit < ProxyWorkUnit items = [] container_uuid = if @proxied.is_a?(Container) then uuid else get(:container_uuid) end if container_uuid - cols = ContainerRequest.columns.map(&:name) - %w(id updated_at mounts secret_mounts) + cols = ContainerRequest.columns.map(&:name) - %w(id updated_at mounts secret_mounts runtime_token) my_children = @child_proxies || ContainerRequest.select(cols).where(requesting_container_uuid: container_uuid).results if !my_children my_child_containers = my_children.map(&:container_uuid).compact.uniq grandchildren = {} @@ -117,12 +118,35 @@ class ContainerWorkUnit < ProxyWorkUnit else 'Failed' end + when 'Running' + if runtime_status[:error] + 'Failing' + elsif runtime_status[:warning] + 'Warning' + else + state + end else - # Cancelled, Running, or Uncommitted (no container assigned) + # Cancelled, or Uncommitted (no container assigned) state end end + def runtime_status + return get(:runtime_status, @container) || get(:runtime_status, @proxied) + end + + def state_bootstrap_class + case state_label + when 'Failing' + 'danger' + when 'Warning' + 'warning' + else + super + end + end + def exit_code get_combined(:exit_code) end