projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'main' from workbench2.git
[arvados.git]
/
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 dbc81c52a376940231094dbf4415e5625016814f..292bc3679bc3710dacf2b59077726fd77d89b5e1 100644
(file)
--- 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 = Container.find(container_uuid)
end
end
+ @container = nil if !defined?(@container)
@child_proxies = child_objects
end
@child_proxies = child_objects
end
@@
-23,12
+24,12
@@
class ContainerWorkUnit < ProxyWorkUnit
items = []
container_uuid = if @proxied.is_a?(Container) then uuid else get(:container_uuid) end
if container_uuid
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)
- my_children = @child_proxies || ContainerRequest.select(cols).where(requesting_container_uuid: container_uuid).results if !my_children
+ 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).
with_count("none").
results if !my_children
my_child_containers = my_children.map(&:container_uuid).compact.uniq
grandchildren = {}
my_child_containers.each { |c| grandchildren[c] = []} if my_child_containers.any?
my_child_containers = my_children.map(&:container_uuid).compact.uniq
grandchildren = {}
my_child_containers.each { |c| grandchildren[c] = []} if my_child_containers.any?
- reqs = ContainerRequest.select(cols).where(requesting_container_uuid: my_child_containers).results if my_child_containers.any?
+ reqs = ContainerRequest.select(cols).where(requesting_container_uuid: my_child_containers).
order(["requesting_container_uuid", "uuid"]).with_count("none").
results if my_child_containers.any?
reqs.each {|cr| grandchildren[cr.requesting_container_uuid] << cr} if reqs
my_children.each do |cr|
reqs.each {|cr| grandchildren[cr.requesting_container_uuid] << cr} if reqs
my_children.each do |cr|
@@
-117,12
+118,35
@@
class ContainerWorkUnit < ProxyWorkUnit
else
'Failed'
end
else
'Failed'
end
+ when 'Running'
+ if runtime_status[:error]
+ 'Failing'
+ elsif runtime_status[:warning]
+ 'Warning'
+ else
+ state
+ end
else
else
- # Cancelled,
Running,
or Uncommitted (no container assigned)
+ # Cancelled, or Uncommitted (no container assigned)
state
end
end
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
def exit_code
get_combined(:exit_code)
end