1 class ProxyWorkUnit < WorkUnit
6 attr_accessor :my_children
7 attr_accessor :unreadable_children
9 def initialize proxied, label
11 self.proxied = proxied
22 def modified_by_user_uuid
23 get(:modified_by_user_uuid)
28 t = Time.parse(t) if (t.andand.class == String)
34 t = Time.parse(t) if (t.andand.class == String)
40 t = Time.parse(t) if (t.andand.class == String)
46 if ["Running", "RunningOnServer", "RunningOnClient"].include? state
53 def state_bootstrap_class
58 when 'Failed', 'Cancelled'
60 when 'Running', 'RunningOnServer', 'RunningOnClient'
69 if state == 'Complete'
71 elsif state == 'Failed'
87 when 'Failed', 'Cancelled'
98 summary[:failed] = failed
100 summary[:running] = running
104 def child_summary_str
105 summary = child_summary
108 if state_label == 'Running'
110 summary_txt += "#{summary[:done]} #{'child'.pluralize(summary[:done])} done,"
113 summary_txt += "#{summary[:failed]} failed,"
116 summary_txt += "#{summary[:running]} running,"
119 summary_txt += "#{summary[:todo]} pending"
127 if state == 'Complete'
129 elsif state == 'Failed' or state== 'Cancelled'
133 summary = child_summary
134 return 0.0 if summary.nil?
136 done = summary[:done] || 0
137 running = summary[:running] || 0
138 failed = summary[:failed] || 0
139 todo = summary[:todo] || 0
140 total = done + running + failed + todo
142 (done+failed).to_f / total
149 get(:script_parameters)
164 def supplied_script_version
165 get(:supplied_script_version)
168 def runtime_constraints
169 get(:runtime_constraints)
180 def has_unreadable_children
181 self.unreadable_children
185 resource_class = ArvadosBase::resource_class_for_uuid(uuid)
186 resource_class.where(uuid: [uuid]).first rescue nil
192 if self.proxied.respond_to? key
193 self.proxied.send(key)
194 elsif self.proxied.is_a?(Hash)