[ARVADOS] updated: e2a7fe50d3b6e98b7f549c78c4f91dbe4066ddbb

git at public.curoverse.com git at public.curoverse.com
Thu May 29 09:37:17 EDT 2014


Summary of changes:
 .../app/controllers/collections_controller.rb      | 38 ++++++++++++++
 .../app/views/collections/_sharing_button.html.erb | 17 ++++++
 .../app/views/collections/_show_files.html.erb     |  7 ++-
 .../app/views/collections/sharing_popup.js.erb     |  1 +
 apps/workbench/app/views/collections/show.html.erb |  8 ++-
 apps/workbench/config/routes.rb                    |  3 ++
 sdk/go/src/arvados.org/keepclient/support.go       |  7 +++
 .../v1/api_client_authorizations_controller.rb     |  2 +
 .../arvados/v1/pipeline_instances_controller.rb    |  1 +
 services/api/app/models/arvados_model.rb           |  4 +-
 services/api/app/models/pipeline_instance.rb       | 61 +---------------------
 .../app/views/pipeline_instances/index.html.erb    |  4 +-
 .../20140528143351_pipeline_instance_attributes.rb | 42 +++++++++++++++
 services/api/db/schema.rb                          |  8 ++-
 services/api/test/unit/pipeline_instance_test.rb   | 43 +--------------
 .../keep/src/arvados.org/keepproxy/keepproxy.go    |  1 +
 16 files changed, 136 insertions(+), 111 deletions(-)
 create mode 100644 apps/workbench/app/views/collections/_sharing_button.html.erb
 create mode 100644 apps/workbench/app/views/collections/sharing_popup.js.erb
 create mode 100644 services/api/db/migrate/20140528143351_pipeline_instance_attributes.rb

       via  e2a7fe50d3b6e98b7f549c78c4f91dbe4066ddbb (commit)
       via  82b46502f25b6992c93bfe7689acc095aa447e5b (commit)
       via  19f4e54627a88c115e299fa328acf22504d1ce66 (commit)
       via  c4175f65bdd100d38bd0e1d212f72c733299ed36 (commit)
       via  844b65fa97d14fddd7f7b702328a31476932fe10 (commit)
       via  ec07cd1ad893c15d94844b3cf2d8d95ae5cfd611 (commit)
       via  747aa7b4d080b4ea95bf7d6d8643c43e70966f33 (commit)
       via  651638a28db20a2016dff02e3baa106ab27ff945 (commit)
       via  1db007eb53d0401a7a0ba168add7c4a094790fa5 (commit)
       via  675794872a5d064cf0a8177d662555c04b0dae51 (commit)
       via  06a0c1d9f2e6cf1d5a9fd00b53071d857252f9fa (commit)
       via  8b030cb82d414bfa0559a205c150f4bfe792caba (commit)
       via  871a7250874ec52543bed51c8b6d14a3ab860eb8 (commit)
       via  c3fd48d0728c140fbe0ab038ad148cfae8104c97 (commit)
       via  35bc4e20adcc706ffdda3b1c9aeed1b34a20c51b (commit)
      from  40b6a69496aa50349d07daa6b28ae36bddd8a6a4 (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 e2a7fe50d3b6e98b7f549c78c4f91dbe4066ddbb
Merge: c4175f6 82b4650
Author: radhika <radhika at curoverse.com>
Date:   Thu May 29 09:37:02 2014 -0400

    Merge branch 'master' into 2903-remove-pi-active-and-success


commit c4175f65bdd100d38bd0e1d212f72c733299ed36
Author: radhika <radhika at curoverse.com>
Date:   Wed May 28 19:12:11 2014 -0400

    2903: active to state usage

diff --git a/services/api/app/views/pipeline_instances/index.html.erb b/services/api/app/views/pipeline_instances/index.html.erb
index ea6f639..cfadd26 100644
--- a/services/api/app/views/pipeline_instances/index.html.erb
+++ b/services/api/app/views/pipeline_instances/index.html.erb
@@ -25,7 +25,7 @@
     <td>
       <%= status %>
     </td><td>
-      <%= (o.state == 'RunningOnServer' || o.state == 'RunningOnClient') ? 'yes' : '-' %>
+      <%= (o.state == 'RunningOnServer') ? 'yes' : '-' %>
     </td><td>
       <%= (o.progress_ratio * 1000).floor / 10 %>
     </td><td>

commit 844b65fa97d14fddd7f7b702328a31476932fe10
Author: radhika <radhika at curoverse.com>
Date:   Wed May 28 17:30:21 2014 -0400

    2903: Remove active and success flags from pipeline_instance. Update all other files as necessary.

diff --git a/services/api/app/controllers/arvados/v1/pipeline_instances_controller.rb b/services/api/app/controllers/arvados/v1/pipeline_instances_controller.rb
index 8f0b93f..614af68 100644
--- a/services/api/app/controllers/arvados/v1/pipeline_instances_controller.rb
+++ b/services/api/app/controllers/arvados/v1/pipeline_instances_controller.rb
@@ -1,4 +1,5 @@
 class Arvados::V1::PipelineInstancesController < ApplicationController
   accept_attribute_as_json :components, Hash
   accept_attribute_as_json :properties, Hash
+  accept_attribute_as_json :components_summary, Hash
 end
diff --git a/services/api/app/models/pipeline_instance.rb b/services/api/app/models/pipeline_instance.rb
index 7bb814c..185bf02 100644
--- a/services/api/app/models/pipeline_instance.rb
+++ b/services/api/app/models/pipeline_instance.rb
@@ -18,8 +18,6 @@ class PipelineInstance < ArvadosModel
     t.add :pipeline_template, :if => :pipeline_template
     t.add :name
     t.add :components
-    t.add :success
-    t.add :active
     t.add :dependencies
     t.add :properties
     t.add :state
@@ -144,60 +142,9 @@ class PipelineInstance < ArvadosModel
   def verify_status
     changed_attributes = self.changed
 
-    if 'state'.in? changed_attributes
-      case self.state
-      when New, Ready, Paused
-        self.active = nil
-        self.success = nil
-      when RunningOnServer
-        self.active = true
-        self.success = nil
-      when RunningOnClient
-        self.active = nil
-        self.success = nil
-      when Failed
-        self.active = false
-        self.success = false
-        self.state = Failed   # before_validation will fail if false is returned in the previous line
-      when Complete
-        self.active = false
-        self.success = true
-      else
-        return false
-      end
-    elsif 'success'.in? changed_attributes
-      logger.info "pipeline_instance changed_attributes has success for #{self.uuid}"
-      if self.success
-        self.active = false
-        self.state = Complete
-      else
-        self.active = false
-        self.state = Failed
-      end
-    elsif 'active'.in? changed_attributes
-      logger.info "pipeline_instance changed_attributes has active for #{self.uuid}"
-      if self.active
-        if self.state.in? [New, Ready, Paused]
-          self.state = RunningOnServer
-        end
-      else
-        if self.state == RunningOnServer # state was RunningOnServer
-          self.active = nil
-          self.state = Paused
-        elsif self.components_look_ready?
-          self.state = Ready
-        else
-          self.state = New
-        end
-      end
-    elsif new_record? and self.state.nil?
-      # No state, active, or success given
-      self.state = New
-    end
-
     if new_record? or 'components'.in? changed_attributes
       self.state ||= New
-      if self.state == New and self.components_look_ready?
+      if (self.state == New) and self.components_look_ready?
         self.state = Ready
       end
     end
@@ -211,13 +158,9 @@ class PipelineInstance < ArvadosModel
   end
 
   def set_state_before_save
-    if !self.state || self.state == New || self.state == Ready || self.state == Paused
-      if self.active
-        self.state = RunningOnServer
-      elsif self.components_look_ready? && (!self.state || self.state == New)
+      if self.components_look_ready? && (!self.state || self.state == New)
         self.state = Ready
       end
-    end
   end
 
 end
diff --git a/services/api/app/views/pipeline_instances/index.html.erb b/services/api/app/views/pipeline_instances/index.html.erb
index e8cb553..ea6f639 100644
--- a/services/api/app/views/pipeline_instances/index.html.erb
+++ b/services/api/app/views/pipeline_instances/index.html.erb
@@ -19,13 +19,13 @@
 
   <% @objects.each do |o| %>
 
-  <% status = o.success ? 'success' : (o.success == false ? 'failure' : 'pending') %>
+  <% status = (o.state == 'Complete') ? 'success' : ((o.state == 'Failed') ? 'failure' : 'pending') %>
 
   <tr class="pipeline-instance-status pipeline-instance-status-<%= status %>" data-showhide-selector="tr#extra-info-<%= o.uuid %>" style="cursor:pointer">
     <td>
       <%= status %>
     </td><td>
-      <%= o.active ? 'yes' : '-' %>
+      <%= (o.state == 'RunningOnServer' || o.state == 'RunningOnClient') ? 'yes' : '-' %>
     </td><td>
       <%= (o.progress_ratio * 1000).floor / 10 %>
     </td><td>
diff --git a/services/api/db/migrate/20140528143351_pipeline_instance_attributes.rb b/services/api/db/migrate/20140528143351_pipeline_instance_attributes.rb
new file mode 100644
index 0000000..ed09fd4
--- /dev/null
+++ b/services/api/db/migrate/20140528143351_pipeline_instance_attributes.rb
@@ -0,0 +1,42 @@
+class PipelineInstanceAttributes < ActiveRecord::Migration
+  include CurrentApiClient
+
+  def up
+    if column_exists?(:pipeline_instances, :active)
+      remove_column :pipeline_instances, :active
+    end
+
+    if column_exists?(:pipeline_instances, :success)
+      remove_column :pipeline_instances, :success
+    end
+  end
+
+  def down
+    if !column_exists?(:pipeline_instances, :success)
+      add_column :pipeline_instances, :success, :boolean, :null => true
+    end
+    if !column_exists?(:pipeline_instances, :active)
+      add_column :pipeline_instances, :active, :boolean, :default => false
+    end
+
+    act_as_system_user do
+      PipelineInstance.all.each do |pi|
+        case pi.state
+        when PipelineInstance::New, PipelineInstance::Ready, PipelineInstance::Paused, PipelineInstance::RunningOnClient
+          pi.active = nil
+          pi.success = nil
+        when PipelineInstance::RunningOnServer
+          pi.active = true
+          pi.success = nil
+        when PipelineInstance::Failed
+          pi.active = false
+          pi.success = false
+        when PipelineInstance::Complete
+          pi.active = false
+          pi.success = true
+        end
+        pi.save!
+      end
+    end
+  end
+end
diff --git a/services/api/db/schema.rb b/services/api/db/schema.rb
index 26f1bdc..b987a4f 100644
--- a/services/api/db/schema.rb
+++ b/services/api/db/schema.rb
@@ -11,7 +11,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version => 20140527152921) do
+ActiveRecord::Schema.define(:version => 20140528143351) do
 
 
 
@@ -321,16 +321,14 @@ ActiveRecord::Schema.define(:version => 20140527152921) do
   create_table "pipeline_instances", :force => true do |t|
     t.string   "uuid"
     t.string   "owner_uuid"
-    t.datetime "created_at",                                 :null => false
+    t.datetime "created_at",              :null => false
     t.string   "modified_by_client_uuid"
     t.string   "modified_by_user_uuid"
     t.datetime "modified_at"
     t.string   "pipeline_template_uuid"
     t.string   "name"
     t.text     "components"
-    t.boolean  "success"
-    t.boolean  "active",                  :default => false
-    t.datetime "updated_at",                                 :null => false
+    t.datetime "updated_at",              :null => false
     t.text     "properties"
     t.string   "state"
     t.text     "components_summary"
diff --git a/services/api/test/unit/pipeline_instance_test.rb b/services/api/test/unit/pipeline_instance_test.rb
index 0f2c2ed..93354f8 100644
--- a/services/api/test/unit/pipeline_instance_test.rb
+++ b/services/api/test/unit/pipeline_instance_test.rb
@@ -5,8 +5,6 @@ class PipelineInstanceTest < ActiveSupport::TestCase
   test "check active and success for a pipeline in new state" do
     pi = pipeline_instances :new_pipeline
 
-    assert !pi.active, 'expected active to be false for :new_pipeline'
-    assert !pi.success, 'expected success to be false for :new_pipeline'
     assert_equal 'New', pi.state, 'expected state to be New for :new_pipeline'
 
     # save the pipeline and expect state to be New
@@ -15,8 +13,6 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     pi.save
     pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::New, pi.state, 'expected state to be New for new pipeline'
-    assert !pi.active, 'expected active to be false for a new pipeline'
-    assert !pi.success, 'expected success to be false for a new pipeline'
   end
 
   test "check active and success for a newly created pipeline" do
@@ -26,8 +22,6 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     pi.save
 
     assert pi.valid?, 'expected newly created empty pipeline to be valid ' + pi.errors.messages.to_s
-    assert !pi.active, 'expected active to be false for a new pipeline'
-    assert !pi.success, 'expected success to be false for a new pipeline'
     assert_equal 'Ready', pi.state, 'expected state to be Ready for a new empty pipeline'
   end
 
@@ -44,8 +38,6 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::New, pi.state, 'expected state to be New after adding component with input'
     assert_equal pi.components.size, 1, 'expected one component'
-    assert !pi.active, 'expected active to be false after update'
-    assert !pi.success, 'expected success to be false for a new pipeline'
 
     # add a component with no input not required
     component = {'script_parameters' => {"input_not_provided" => {"required" => false}}}
@@ -55,8 +47,6 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::Ready, pi.state, 'expected state to be Ready after adding component with input'
     assert_equal pi.components.size, 1, 'expected one component'
-    assert !pi.active, 'expected active to be false after update'
-    assert !pi.success, 'expected success to be false for a new pipeline'
 
     # add a component with input and expect state to become Ready
     component = {'script_parameters' => {"input" => "yyyad4b39ca5a924e481008009d94e32+210"}}
@@ -66,57 +56,31 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::Ready, pi.state, 'expected state to be Ready after adding component with input'
     assert_equal pi.components.size, 1, 'expected one component'
-    assert !pi.active, 'expected active to be false after update'
-    assert !pi.success, 'expected success to be false for a new pipeline'
-
-    pi.active = true
-    assert_equal true, pi.save, 'expected pipeline instance to save, but ' + pi.errors.messages.to_s
-    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
-    assert_equal PipelineInstance::RunningOnServer, pi.state, 'expected state to be RunningOnServer after updating active to true'
-    assert pi.active, 'expected active to be true after update'
-    assert !pi.success, 'expected success to be false for a new pipeline'
-
-    pi.success = false
-    pi.save
-    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
-    assert_equal PipelineInstance::Failed, pi.state, 'expected state to be Failed after updating success to false'
-    assert !pi.active, 'expected active to be false after update'
-    assert !pi.success, 'expected success to be false for a new pipeline'
 
     pi.state = PipelineInstance::RunningOnServer
     pi.save
     pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::RunningOnServer, pi.state, 'expected state to be RunningOnServer after updating state to RunningOnServer'
-    assert pi.active, 'expected active to be true after update'
-    assert !pi.success, 'expected success to be alse after update'
 
     pi.state = PipelineInstance::Paused
     pi.save
     pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::Paused, pi.state, 'expected state to be Paused after updating state to Paused'
-    assert !pi.active, 'expected active to be false after update'
-    assert !pi.success, 'expected success to be false after update'
 
     pi.state = PipelineInstance::Complete
     pi.save
     pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::Complete, pi.state, 'expected state to be Complete after updating state to Complete'
-    assert !pi.active, 'expected active to be false after update'
-    assert pi.success, 'expected success to be true after update'
 
     pi.state = 'bogus'
     pi.save
     pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::Complete, pi.state, 'expected state to be unchanged with set to a bogus value'
-    assert !pi.active, 'expected active to be false after update'
-    assert pi.success, 'expected success to be true after update'
 
     pi.state = PipelineInstance::Failed
     pi.save
     pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::Failed, pi.state, 'expected state to be Failed after updating state to Failed'
-    assert !pi.active, 'expected active to be false after update'
-    assert !pi.success, 'expected success to be false after update'
   end
 
   test "update attributes for pipeline with two components" do
@@ -135,8 +99,6 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::New, pi.state, 'expected state to be New after adding component with input'
     assert_equal pi.components.size, 2, 'expected two components'
-    assert !pi.active, 'expected active to be false after update'
-    assert !pi.success, 'expected success to be false for a new pipeline'
   end
 
   [:has_component_with_no_script_parameters,
@@ -145,10 +107,7 @@ class PipelineInstanceTest < ActiveSupport::TestCase
       pi = pipeline_instances pi_name
 
       Thread.current[:user] = users(:active)
-      # Make sure we go through the "active_changed? and active" code:
-      assert_equal true, pi.update_attributes(active: true), pi.errors.messages
-      assert_equal true, pi.update_attributes(active: false), pi.errors.messages
-      assert_equal PipelineInstance::Paused, pi.state
+      assert_equal PipelineInstance::Ready, pi.state
     end
   end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list