[ARVADOS] updated: d8c4d51e70a5141447f6259792ffd41bcd2c8209

git at public.curoverse.com git at public.curoverse.com
Thu Oct 23 11:12:16 EDT 2014


Summary of changes:
 apps/workbench/app/assets/javascripts/event_log.js | 14 +++--
 .../pipeline_instances/_show_components.html.erb   | 10 ----
 .../_show_components_running.html.erb              | 10 ++++
 apps/workbench/test/integration/websockets_test.rb | 68 ++++++++++++++++++++++
 services/api/test/fixtures/jobs.yml                | 25 ++++++++
 5 files changed, 111 insertions(+), 16 deletions(-)

       via  d8c4d51e70a5141447f6259792ffd41bcd2c8209 (commit)
      from  f4bc389289188870b866130402008a02e55e9a5d (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 d8c4d51e70a5141447f6259792ffd41bcd2c8209
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Oct 23 11:12:08 2014 -0400

    4084: Added tests for auto-refresh of pipeline instance, job, and dashboard pages.

diff --git a/apps/workbench/app/assets/javascripts/event_log.js b/apps/workbench/app/assets/javascripts/event_log.js
index a23c074..9e03dff 100644
--- a/apps/workbench/app/assets/javascripts/event_log.js
+++ b/apps/workbench/app/assets/javascripts/event_log.js
@@ -36,12 +36,14 @@ function onEventLogDispatcherOpen(event) {
 
 /* Trigger event for all applicable elements waiting for this event */
 function onEventLogDispatcherMessage(event) {
-  parsedData = JSON.parse(event.data);
-  object_uuid = parsedData.object_uuid;
-
-  // if there are any listeners for this object uuid or "all", trigger the event
-  matches = ".arv-log-event-listener[data-object-uuid=\"" + object_uuid + "\"],.arv-log-event-listener[data-object-uuids~=\"" + object_uuid + "\"],.arv-log-event-listener[data-object-uuid=\"all\"],.arv-log-event-listener[data-object-kind=\"" + parsedData.object_kind + "\"]";
-  $(matches).trigger('arv-log-event', parsedData);
+    parsedData = JSON.parse(event.data);
+    object_uuid = parsedData.object_uuid;
+
+    if (object_uuid) {
+        // if there are any listeners for this object uuid or "all", trigger the event
+        matches = ".arv-log-event-listener[data-object-uuid=\"" + object_uuid + "\"],.arv-log-event-listener[data-object-uuids~=\"" + object_uuid + "\"],.arv-log-event-listener[data-object-uuid=\"all\"],.arv-log-event-listener[data-object-kind=\"" + parsedData.object_kind + "\"]";
+        $(matches).trigger('arv-log-event', parsedData);
+    }
 }
 
 /* Automatically connect if there are any elements on the page that want to
diff --git a/apps/workbench/app/views/pipeline_instances/_show_components.html.erb b/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
index 94823a2..71cee77 100644
--- a/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
@@ -1,15 +1,5 @@
 <% if !@object.state.in? ['New', 'Ready'] %>
 
-  <div class="pull-right" style="padding-left: 1em">
-    Current state: <span class="badge badge-info" data-pipeline-state="<%= @object.state %>">
-      <% if @object.state == "RunningOnServer" %>
-        Active
-      <% else %>
-        <%= @object.state %>
-      <% end %>
-    </span> 
-  </div>
-
 <% job_uuids = @object.components.map { |k,j| j[:job].andand[:uuid] }.compact %>
 
 <div id="pipeline-instance-components"
diff --git a/apps/workbench/app/views/pipeline_instances/_show_components_running.html.erb b/apps/workbench/app/views/pipeline_instances/_show_components_running.html.erb
index 12eda27..d99ac23 100644
--- a/apps/workbench/app/views/pipeline_instances/_show_components_running.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_show_components_running.html.erb
@@ -1,5 +1,15 @@
 <%# Summary %>
 
+<div class="pull-right" style="padding-left: 1em">
+  Current state: <span class="badge badge-info" data-pipeline-state="<%= @object.state %>">
+    <% if @object.state == "RunningOnServer" %>
+      Active
+    <% else %>
+      <%= @object.state %>
+    <% end %>
+  </span> 
+</div>
+
 <% pipeline_jobs = render_pipeline_jobs %>
 <% job_uuids = pipeline_jobs.map { |j| j[:job].andand[:uuid] }.compact %>
 
diff --git a/apps/workbench/test/integration/websockets_test.rb b/apps/workbench/test/integration/websockets_test.rb
index 7d1a160..87dd835 100644
--- a/apps/workbench/test/integration/websockets_test.rb
+++ b/apps/workbench/test/integration/websockets_test.rb
@@ -81,4 +81,72 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     Thread.current[:arvados_api_token] = nil
   end
 
+  test "pipeline instance arv-refresh-on-log-event" do
+    Thread.current[:arvados_api_token] = @@API_AUTHS["active"]['api_token']
+    # Do something and check that the pane reloads.
+    p = PipelineInstance.create({state: "RunningOnServer",
+                                  components: {
+                                    c1: {
+                                      script: "test_hash.py",
+                                      script_version: "1de84a854e2b440dc53bf42f8548afa4c17da332"
+                                    }
+                                  }
+                                })
+
+    visit(page_with_token("active", "/pipeline_instances/#{p.uuid}"))
+
+    assert page.has_text? 'Active'
+    assert page.has_link? 'Pause'
+    assert page.has_no_text? 'Complete'
+    assert page.has_no_link? 'Re-run with latest'
+
+    p.state = "Complete"
+    p.save!
+
+    assert page.has_no_text? 'Active'
+    assert page.has_no_link? 'Pause'
+    assert page.has_text? 'Complete'
+    assert page.has_link? 'Re-run with latest'
+
+    Thread.current[:arvados_api_token] = nil
+  end
+
+  test "job arv-refresh-on-log-event" do
+    Thread.current[:arvados_api_token] = @@API_AUTHS["active"]['api_token']
+    # Do something and check that the pane reloads.
+    p = Job.where(uuid: api_fixture('jobs')['running_will_be_completed']['uuid']).results.first
+
+    visit(page_with_token("active", "/jobs/#{p.uuid}"))
+
+    assert page.has_no_text? 'complete'
+    assert page.has_no_text? 'Re-run same version'
+
+    p.state = "Complete"
+    p.save!
+
+    assert page.has_text? 'complete'
+    assert page.has_text? 'Re-run same version'
+
+    Thread.current[:arvados_api_token] = nil
+  end
+
+  test "dashboard arv-refresh-on-log-event" do
+    Thread.current[:arvados_api_token] = @@API_AUTHS["active"]['api_token']
+
+    visit(page_with_token("active", "/"))
+
+    assert page.has_no_text? 'test dashboard arv-refresh-on-log-event'
+
+    # Do something and check that the pane reloads.
+    p = PipelineInstance.create({state: "RunningOnServer",
+                                  name: "test dashboard arv-refresh-on-log-event",
+                                  components: {
+                                  }
+                                })
+
+    assert page.has_text? 'test dashboard arv-refresh-on-log-event'
+
+    Thread.current[:arvados_api_token] = nil
+  end
+
 end
diff --git a/services/api/test/fixtures/jobs.yml b/services/api/test/fixtures/jobs.yml
index 292c27e..b0b6749 100644
--- a/services/api/test/fixtures/jobs.yml
+++ b/services/api/test/fixtures/jobs.yml
@@ -295,6 +295,31 @@ job_in_subproject:
   script_version: 4fe459abe02d9b365932b8f5dc419439ab4e2577
   state: Complete
 
+running_will_be_completed:
+  uuid: zzzzz-8i9sb-pshmckwoma9plh8
+  owner_uuid: zzzzz-j7d0g-v955i6s2oi1cbso
+  cancelled_at: ~
+  cancelled_by_user_uuid: ~
+  cancelled_by_client_uuid: ~
+  created_at: <%= 3.minute.ago.to_s(:db) %>
+  started_at: <%= 3.minute.ago.to_s(:db) %>
+  finished_at: ~
+  script_version: 1de84a854e2b440dc53bf42f8548afa4c17da332
+  running: true
+  success: ~
+  output: ~
+  priority: 0
+  log: ~
+  is_locked_by_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  tasks_summary:
+    failed: 0
+    todo: 3
+    running: 1
+    done: 1
+  runtime_constraints: {}
+  state: Running
+
+
 # Test Helper trims the rest of the file
 
 # Do not add your fixtures below this line as the rest of this file will be trimmed by test_helper

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list