[ARVADOS] updated: 5a553b7b1fc75a84f8784eeb812361616911accd

Git user git at public.curoverse.com
Tue Nov 15 13:16:10 EST 2016


Summary of changes:
 services/api/app/models/container_request.rb       | 16 +++++++++++-----
 ...0171221_add_output_uuid_to_container_request.rb | 18 ------------------
 ...add_output_and_log_uuid_to_container_request.rb | 22 ++++++++++++++++++++++
 services/api/db/structure.sql                      |  7 ++++---
 services/api/test/unit/container_request_test.rb   |  6 +++++-
 5 files changed, 42 insertions(+), 27 deletions(-)
 delete mode 100644 services/api/db/migrate/20161110171221_add_output_uuid_to_container_request.rb
 create mode 100644 services/api/db/migrate/20161115171221_add_output_and_log_uuid_to_container_request.rb

       via  5a553b7b1fc75a84f8784eeb812361616911accd (commit)
      from  15488bac7de5fa73c2695589c6436a6848615e84 (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 5a553b7b1fc75a84f8784eeb812361616911accd
Author: radhika <radhika at curoverse.com>
Date:   Tue Nov 15 12:57:04 2016 -0500

    10293: added log_uuid to container_requests

diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index 38c4dc1..f44fa82 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -45,6 +45,7 @@ class ContainerRequest < ArvadosModel
     t.add :state
     t.add :use_existing
     t.add :output_uuid
+    t.add :log_uuid
     t.add :scheduling_parameters
   end
 
@@ -83,7 +84,8 @@ class ContainerRequest < ArvadosModel
   # Finalize the container request after the container has
   # finished/cancelled.
   def finalize!
-    out_uuid = nil
+    out_coll = nil
+    log_coll = nil
     c = Container.find_by_uuid(container_uuid)
     ['output', 'log'].each do |out_type|
       pdh = c.send(out_type)
@@ -97,9 +99,13 @@ class ContainerRequest < ArvadosModel
                            'type' => out_type,
                            'container_request' => uuid,
                          })
-      out_uuid = coll.uuid if out_type == 'output'
+      if out_type == 'output'
+        out_coll = coll.uuid
+      else
+        log_coll = coll.uuid
+      end
     end
-    update_attributes!(state: Final, output_uuid: out_uuid)
+    update_attributes!(state: Final, output_uuid: out_coll, log_uuid: log_coll)
   end
 
   protected
@@ -290,8 +296,8 @@ class ContainerRequest < ArvadosModel
         errors.add :state, "of container request can only be set to Final by system."
       end
 
-      if self.state_changed? || self.name_changed? || self.description_changed? || self.output_uuid_changed?
-          permitted.push :state, :name, :description, :output_uuid
+      if self.state_changed? || self.name_changed? || self.description_changed? || self.output_uuid_changed? || self.log_uuid_changed?
+          permitted.push :state, :name, :description, :output_uuid, :log_uuid
       else
         errors.add :state, "does not allow updates"
       end
diff --git a/services/api/db/migrate/20161110171221_add_output_uuid_to_container_request.rb b/services/api/db/migrate/20161110171221_add_output_uuid_to_container_request.rb
deleted file mode 100644
index 3c590b1..0000000
--- a/services/api/db/migrate/20161110171221_add_output_uuid_to_container_request.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require 'has_uuid'
-
-class AddOutputUuidToContainerRequest < ActiveRecord::Migration
-  extend HasUuid::ClassMethods
-
-  def up
-    add_column :container_requests, :output_uuid, :string
-
-    no_such_coll = Server::Application.config.uuid_prefix + '-' + '4zz18' + '-xxxxxxxxxxxxxxx'
-    update_sql <<-EOS
-update container_requests set output_uuid = ('#{no_such_coll}');
-EOS
-  end
-
-  def down
-    remove_column :container_requests, :output_uuid
-  end
-end
diff --git a/services/api/db/migrate/20161115171221_add_output_and_log_uuid_to_container_request.rb b/services/api/db/migrate/20161115171221_add_output_and_log_uuid_to_container_request.rb
new file mode 100644
index 0000000..e38bf7c
--- /dev/null
+++ b/services/api/db/migrate/20161115171221_add_output_and_log_uuid_to_container_request.rb
@@ -0,0 +1,22 @@
+require 'has_uuid'
+
+class AddOutputAndLogUuidToContainerRequest < ActiveRecord::Migration
+  extend HasUuid::ClassMethods
+
+  def up
+    add_column :container_requests, :output_uuid, :string
+    add_column :container_requests, :log_uuid, :string
+
+    no_such_out_coll = Server::Application.config.uuid_prefix + '-' + '4zz18' + '-xxxxxxxxxxxxxxx'
+    no_such_log_coll = Server::Application.config.uuid_prefix + '-' + '4zz18' + '-yyyyyyyyyyyyyyy'
+
+    update_sql <<-EOS
+update container_requests set output_uuid = ('#{no_such_out_coll}'), log_uuid = ('#{no_such_log_coll}');
+EOS
+  end
+
+  def down
+    remove_column :container_requests, :log_uuid
+    remove_column :container_requests, :output_uuid
+  end
+end
diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql
index dd99610..2170f5e 100644
--- a/services/api/db/structure.sql
+++ b/services/api/db/structure.sql
@@ -293,7 +293,8 @@ CREATE TABLE container_requests (
     container_count integer DEFAULT 0,
     use_existing boolean DEFAULT true,
     scheduling_parameters text,
-    output_uuid character varying(255)
+    output_uuid character varying(255),
+    log_uuid character varying(255)
 );
 
 
@@ -2699,6 +2700,6 @@ INSERT INTO schema_migrations (version) VALUES ('20160926194129');
 
 INSERT INTO schema_migrations (version) VALUES ('20161019171346');
 
-INSERT INTO schema_migrations (version) VALUES ('20161110171221');
+INSERT INTO schema_migrations (version) VALUES ('20161111143147');
 
-INSERT INTO schema_migrations (version) VALUES ('20161111143147');
\ No newline at end of file
+INSERT INTO schema_migrations (version) VALUES ('20161115171221');
\ No newline at end of file
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index c288eef..c4d1efe 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -231,10 +231,11 @@ class ContainerRequestTest < ActiveSupport::TestCase
     assert_equal "Committed", cr.state
 
     output_pdh = '1f4b0bc7583c2a7f9102c395f4ffc5e3+45'
+    log_pdh = 'fa7aeb5140e2848d39b416daeef4ffc5+45'
     act_as_system_user do
       c.update_attributes!(state: Container::Complete,
                            output: output_pdh,
-                           log: 'fa7aeb5140e2848d39b416daeef4ffc5+45')
+                           log: log_pdh)
     end
 
     cr.reload
@@ -246,8 +247,11 @@ class ContainerRequestTest < ActiveSupport::TestCase
                    "Container #{out_type} should be copied to #{project.uuid}")
     end
     assert_not_nil cr.output_uuid
+    assert_not_nil cr.log_uuid
     output = Collection.find_by_uuid cr.output_uuid
     assert_equal output_pdh, output.portable_data_hash
+    log = Collection.find_by_uuid cr.log_uuid
+    assert_equal log_pdh, log.portable_data_hash
   end
 
   test "Container makes container request, then is cancelled" do

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list