[ARVADOS] updated: 9122f814b4c22828f64d82c48409dd4cc6cacc3f

Git user git at public.curoverse.com
Fri May 27 10:51:24 EDT 2016


Summary of changes:
 apps/workbench/app/models/job.rb                   |  2 +-
 apps/workbench/app/models/job_task.rb              |  2 +-
 apps/workbench/app/models/job_work_unit.rb         | 27 ++++++++++----
 apps/workbench/app/models/pipeline_instance.rb     |  2 +-
 .../app/views/work_unit/_component_detail.html.erb |  2 +-
 .../app/views/work_unit/_show_child.html.erb       |  2 +-
 apps/workbench/test/integration/jobs_test.rb       | 42 ++++++++++++++++++++++
 services/api/test/fixtures/jobs.yml                |  4 +--
 8 files changed, 70 insertions(+), 13 deletions(-)

       via  9122f814b4c22828f64d82c48409dd4cc6cacc3f (commit)
      from  17e79aa5b26b8c0b3228247451172999ad81baff (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 9122f814b4c22828f64d82c48409dd4cc6cacc3f
Author: radhika <radhika at curoverse.com>
Date:   Fri May 27 10:50:55 2016 -0400

    8876: add an integration with job with components.

diff --git a/apps/workbench/app/models/job.rb b/apps/workbench/app/models/job.rb
index b91c6bc..73f1f63 100644
--- a/apps/workbench/app/models/job.rb
+++ b/apps/workbench/app/models/job.rb
@@ -54,7 +54,7 @@ class Job < ArvadosBase
       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
diff --git a/apps/workbench/app/models/job_task.rb b/apps/workbench/app/models/job_task.rb
index 44d4d45..9fb0473 100644
--- a/apps/workbench/app/models/job_task.rb
+++ b/apps/workbench/app/models/job_task.rb
@@ -1,5 +1,5 @@
 class JobTask < ArvadosBase
-  def work_unit(label="")
+  def work_unit(label=nil)
     JobTaskWorkUnit.new(self, label)
   end
 end
diff --git a/apps/workbench/app/models/job_work_unit.rb b/apps/workbench/app/models/job_work_unit.rb
index 9b06048..7f1c73f 100644
--- a/apps/workbench/app/models/job_work_unit.rb
+++ b/apps/workbench/app/models/job_work_unit.rb
@@ -1,15 +1,30 @@
 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
 
diff --git a/apps/workbench/app/models/pipeline_instance.rb b/apps/workbench/app/models/pipeline_instance.rb
index f54b9f0..b51f07c 100644
--- a/apps/workbench/app/models/pipeline_instance.rb
+++ b/apps/workbench/app/models/pipeline_instance.rb
@@ -132,7 +132,7 @@ class PipelineInstance < ArvadosBase
     end
   end
 
-  def work_unit label
+  def work_unit(label=nil)
     PipelineInstanceWorkUnit.new(self, label || self.name)
   end
 
diff --git a/apps/workbench/app/views/work_unit/_component_detail.html.erb b/apps/workbench/app/views/work_unit/_component_detail.html.erb
index 0d2f800..eeb78f9 100644
--- a/apps/workbench/app/views/work_unit/_component_detail.html.erb
+++ b/apps/workbench/app/views/work_unit/_component_detail.html.erb
@@ -82,7 +82,7 @@
           </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>
diff --git a/apps/workbench/app/views/work_unit/_show_child.html.erb b/apps/workbench/app/views/work_unit/_show_child.html.erb
index a38d900..a93895b 100644
--- a/apps/workbench/app/views/work_unit/_show_child.html.erb
+++ b/apps/workbench/app/views/work_unit/_show_child.html.erb
@@ -84,7 +84,7 @@
             </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| %>
diff --git a/apps/workbench/test/integration/jobs_test.rb b/apps/workbench/test/integration/jobs_test.rb
index 350e732..de04aa8 100644
--- a/apps/workbench/test/integration/jobs_test.rb
+++ b/apps/workbench/test/integration/jobs_test.rb
@@ -126,4 +126,46 @@ class JobsTest < ActionDispatch::IntegrationTest
       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
diff --git a/services/api/test/fixtures/jobs.yml b/services/api/test/fixtures/jobs.yml
index 13fe1ab..d0c22d3 100644
--- a/services/api/test/fixtures/jobs.yml
+++ b/services/api/test/fixtures/jobs.yml
@@ -525,8 +525,8 @@ running_job_with_components:
   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
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list