flat_map { |log| log.properties[:text].split("\n") rescue [] }
end
- def work_unit(label="")
+ def work_unit(label=nil)
JobWorkUnit.new(self, label)
end
end
class JobTask < ArvadosBase
- def work_unit(label="")
+ def work_unit(label=nil)
JobTaskWorkUnit.new(self, label)
end
end
class JobWorkUnit < ProxyWorkUnit
def children
- # Job tasks
uuid = get(:uuid)
- tasks = JobTask.filter([['job_uuid', '=', uuid]]).results
items = []
- tasks.each do |t|
- items << t.work_unit("task #{items.size}")
- end
- # Jobs submitted by this job -- TBD
+ # Job tasks - for now do not include job tasks
+ # tasks = JobTask.filter([['job_uuid', '=', uuid]]).results
+ # tasks.each do |t|
+ # items << t.work_unit("task #{items.size}")
+ # end
+
+ # Jobs components
+ components = get(:components)
+ uuids = components.andand.collect {|_, v| v}
+ return items if (!uuids or uuids.empty?)
+ rcs = {}
+ uuids.each do |u|
+ r = ArvadosBase::resource_class_for_uuid(u)
+ rcs[r] = [] unless rcs[r]
+ rcs[r] << u
+ end
+ rcs.each do |rc, ids|
+ rc.where(uuid: ids).each do |obj|
+ items << obj.work_unit(components.key(obj.uuid))
+ end
+ end
items
end
end
end
- def work_unit label
+ def work_unit(label=nil)
PipelineInstanceWorkUnit.new(self, label || self.name)
end
</div>
</div>
- <% unless current_obj.parameters.nil? %>
+ <% if current_obj.parameters and !current_obj.parameters.empty? %>
<div class="row">
<div class="col-md-6">
<p>script_parameters:</p>
</div>
<% end %>
- <% if current_obj.state_label.in? ["Queued", "Running"] and @object.work_unit(@object.name).can_cancel? and @object.editable? %>
+ <% if current_obj.state_label.in? ["Queued", "Running"] and @object.work_unit.can_cancel? and @object.editable? %>
<%# column offset 11 %>
<div class="col-md-1 pipeline-instance-spacing">
<%= form_tag "#{current_obj.uri}/cancel", remote: true, style: "display:inline; padding-left: 1em" do |f| %>
end
end
end
+
+ test 'view job with components' do
+ job = api_fixture('jobs')['running_job_with_components']
+ component1 = api_fixture('jobs')['completed_job_in_publicly_accessible_project']
+ component2 = api_fixture('pipeline_instances')['running_pipeline_with_complete_job']
+ component2_child1 = api_fixture('jobs')['previous_job_run']
+ component2_child2 = api_fixture('jobs')['running']
+
+ visit page_with_token("active", "/jobs/#{job['uuid']}")
+ assert page.has_text? job['script_version']
+ assert page.has_no_text? 'script_parameters'
+
+ click_link('component1')
+ within('#collapse1') do
+ assert(has_text? component1['uuid'])
+ assert(has_text? component1['script_version'])
+ assert(has_text? 'script_parameters')
+ end
+ click_link('component1')
+
+ click_link('component2')
+ within('#collapse2') do
+ assert(has_text? component2['uuid'])
+ assert(has_text? component2['script_version'])
+ assert(has_no_text? 'script_parameters')
+ assert(has_link? 'previous')
+ assert(has_link? 'running')
+
+ click_link('previous')
+ within('#collapse3') do
+ assert(has_text? component2_child1['uuid'])
+ assert(has_text? component2_child1['script_version'])
+ end
+ click_link('previous')
+
+ click_link('running')
+ within('#collapse4') do
+ assert(has_text? component2_child2['uuid'])
+ assert(has_text? component2_child2['script_version'])
+ end
+ end
+ end
end
runtime_constraints: {}
state: Running
components:
- component1: zzzzz-8i9sb-jobuuid00000001
- component2: zzzzz-d1hrv-pipelineuuid001
+ component1: zzzzz-8i9sb-jyq01m7in1jlofj
+ component2: zzzzz-d1hrv-partdonepipelin
# Test Helper trims the rest of the file