1 class ContainerWorkUnit < ProxyWorkUnit
2 attr_accessor :container
4 def initialize proxied, label, parent
6 if @proxied.is_a?(ContainerRequest)
7 container_uuid = get(:container_uuid)
9 @container = Container.where(uuid: container_uuid).first
15 return @my_children if @my_children
18 container_uuid = if @proxied.is_a?(Container) then uuid else get(:container_uuid) end
22 reqs = ContainerRequest.where(requesting_container_uuid: container_uuid).results
24 items << cr.work_unit(cr.name || 'this container')
38 return nil unless uuid
40 if @proxied.class.respond_to? :table_name
41 "/#{@proxied.class.table_name}/#{uuid}"
43 resource_class = ArvadosBase.resource_class_for_uuid(uuid)
44 "#{resource_class.table_name}/#{uuid}" if resource_class
49 @proxied.is_a?(ContainerRequest) && @proxied.state == "Committed" && @proxied.priority > 0 && @proxied.editable?
60 # For the following properties, use value from the @container if exists
61 # This applies to a ContainerRequest with container_uuid
64 t = get_combined(:started_at)
65 t = Time.parse(t) if (t.is_a? String)
70 t = get_combined(:modified_at)
71 t = Time.parse(t) if (t.is_a? String)
76 t = get_combined(:finished_at)
77 t = Time.parse(t) if (t.is_a? String)
83 return "Failed" if (ec && ec != 0)
84 state = get_combined(:state)
85 return "Ready" if ((priority == 0) and (["Queued", "Locked"].include?(state)))
90 get_combined(:exit_code)
94 get_combined(:container_image)
97 def runtime_constraints
98 get_combined(:runtime_constraints)
107 items << get_combined(:output) if get_combined(:output)
112 get_combined(:command)
120 env = get_combined(:environment)
121 env = nil if env.andand.empty?
126 mnt = get_combined(:mounts)
127 mnt = nil if mnt.andand.empty?
132 get_combined(:output_path)
136 [get(:uuid, @container), get(:uuid, @proxied)].compact
140 collection = Collection.find(log_collection) rescue nil
142 return {log: collection, partial: 'collections/show_files', locals: {object: collection, no_checkboxes: true}}
147 properties = get(:properties)
149 properties[:template_uuid]
153 # End combined properties
157 get(key, @container) || get(key, @proxied)