[ARVADOS] created: 1.3.0-427-g18239026d

Git user git at public.curoverse.com
Fri Mar 1 16:39:31 EST 2019


        at  18239026d35e377e01ad852be8e67e5328f069e5 (commit)


commit 18239026d35e377e01ad852be8e67e5328f069e5
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Fri Mar 1 16:38:44 2019 -0500

    14870: Copy previous container logs to "container uuid" subdir
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index e1ae2b548..be4d3cc8e 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -150,7 +150,7 @@ class ContainerRequest < ArvadosModel
       manifest = Collection.where(portable_data_hash: pdh).first.manifest_text
 
       coll_uuid = self.send(out_type + '_uuid')
-      coll = coll_uuid.nil? ? nil : Collection.find_by_uuid(coll_uuid)
+      coll = coll_uuid.nil? ? nil : Collection.where(uuid: coll_uuid).first
       if !coll
         coll = Collection.new(
           owner_uuid: self.owner_uuid,
@@ -215,14 +215,29 @@ class ContainerRequest < ArvadosModel
       else
         self.container_count += 1
         if self.container_uuid_was
-          # old_container = Container.find_by_uuid()
-          # # copy logs from old container into CR's log collection
-          # #
-          #   src = Arv::Collection.new(manifest)
-          #   tgt = Arv::Collection.new(coll.manifest_text)
-          #   tgt.cp_r("./", "./", src)
-          #   tgt.cp_r("./", "container #{container.uuid}", src)
-          #   manifest = tgt.manifest_text
+          old_container = Container.find_by_uuid(self.container_uuid_was)
+          old_logs = Collection.where(portable_data_hash: old_container.log).first
+          if old_logs
+            log_coll = coll_uuid.nil? ? nil : Collection.where(uuid: coll_uuid).first
+            if self.log_uuid.nil?
+              log_coll = Collection.new(
+                owner_uuid: self.owner_uuid,
+                name: coll_name = "Container log for request #{uuid}",
+                manifest_text: "")
+            end
+
+            # copy logs from old container into CR's log collection
+            src = Arv::Collection.new(old_logs.manifest_text)
+            dst = Arv::Collection.new(log_coll.manifest_text)
+            dst.cp_r("./", "container #{container.uuid}", src)
+            manifest = dst.manifest_text
+
+            log_coll.assign_attributes(
+              portable_data_hash: Digest::MD5.hexdigest(manifest) + '+' + manifest.bytesize.to_s,
+              manifest_text: manifest)
+            log_coll.save_with_unique_name!
+            self.log_uuid = log_coll.uuid
+          end
         end
       end
     end

commit f71f22001ffc6e34879f8e8dfc3aa41405a4d45c
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Fri Mar 1 16:24:13 2019 -0500

    14870: Update Arvados Ruby SDK gem dependency for bugfix
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/services/api/Gemfile b/services/api/Gemfile
index 5cf854b52..25e441bfc 100644
--- a/services/api/Gemfile
+++ b/services/api/Gemfile
@@ -63,7 +63,7 @@ gem 'faye-websocket'
 
 gem 'themes_for_rails', git: 'https://github.com/curoverse/themes_for_rails'
 
-gem 'arvados', '>= 0.1.20150615153458'
+gem 'arvados', '>= 1.3.1.20190301212059'
 gem 'httpclient'
 
 gem 'sshkey'
diff --git a/services/api/Gemfile.lock b/services/api/Gemfile.lock
index aecf748d1..6e2fa2cd6 100644
--- a/services/api/Gemfile.lock
+++ b/services/api/Gemfile.lock
@@ -47,26 +47,26 @@ GEM
       activemodel (>= 3.0.0)
       activesupport (>= 3.0.0)
       rack (>= 1.1.0)
-    addressable (2.5.2)
+    addressable (2.6.0)
       public_suffix (>= 2.0.2, < 4.0)
     andand (1.3.3)
     arel (6.0.4)
-    arvados (0.1.20180302192246)
+    arvados (1.3.1.20190301212059)
       activesupport (>= 3)
       andand (~> 1.3, >= 1.3.3)
-      google-api-client (>= 0.7, < 0.8.9)
+      cure-google-api-client (>= 0.7, < 0.8.9)
       i18n (~> 0)
       json (>= 1.7.7, < 3)
       jwt (>= 0.1.5, < 2)
-    arvados-cli (1.1.4.20180723133344)
+    arvados-cli (1.3.1.20190211211047)
       activesupport (>= 3.2.13, < 5)
       andand (~> 1.3, >= 1.3.3)
-      arvados (~> 0.1, >= 0.1.20150128223554)
+      arvados (~> 1.3.0, >= 1.3.0)
       curb (~> 0.8)
-      google-api-client (~> 0.6, >= 0.6.3, < 0.8.9)
+      cure-google-api-client (~> 0.6, >= 0.6.3, < 0.8.9)
       json (>= 1.7.7, < 3)
       oj (~> 3.0)
-      trollop (~> 2.0)
+      optimist (~> 3.0)
     autoparse (0.3.3)
       addressable (>= 2.3.1)
       extlib (>= 0.9.15)
@@ -87,7 +87,18 @@ GEM
     coffee-script-source (1.12.2)
     concurrent-ruby (1.1.4)
     crass (1.0.4)
-    curb (0.9.6)
+    curb (0.9.8)
+    cure-google-api-client (0.8.7.1)
+      activesupport (>= 3.2, < 5.0)
+      addressable (~> 2.3)
+      autoparse (~> 0.3)
+      extlib (~> 0.9)
+      faraday (~> 0.9)
+      googleauth (~> 0.3)
+      launchy (~> 2.4)
+      multi_json (~> 1.10)
+      retriable (~> 1.4)
+      signet (~> 0.6)
     database_cleaner (1.7.0)
     erubis (2.7.0)
     eventmachine (1.2.6)
@@ -105,24 +116,12 @@ GEM
       websocket-driver (>= 0.5.1)
     globalid (0.4.1)
       activesupport (>= 4.2.0)
-    google-api-client (0.8.7)
-      activesupport (>= 3.2, < 5.0)
-      addressable (~> 2.3)
-      autoparse (~> 0.3)
-      extlib (~> 0.9)
-      faraday (~> 0.9)
-      googleauth (~> 0.3)
-      launchy (~> 2.4)
-      multi_json (~> 1.10)
-      retriable (~> 1.4)
-      signet (~> 0.6)
-    googleauth (0.6.2)
+    googleauth (0.8.0)
       faraday (~> 0.12)
       jwt (>= 1.4, < 3.0)
-      logging (~> 2.0)
-      memoist (~> 0.12)
+      memoist (~> 0.16)
       multi_json (~> 1.11)
-      os (~> 0.9)
+      os (>= 0.9, < 2.0)
       signet (~> 0.7)
     hashie (3.5.7)
     highline (1.7.10)
@@ -134,15 +133,11 @@ GEM
       rails-dom-testing (>= 1, < 3)
       railties (>= 4.2.0)
       thor (>= 0.14, < 2.0)
-    json (2.1.0)
+    json (2.2.0)
     jwt (1.5.6)
     launchy (2.4.3)
       addressable (~> 2.3)
     libv8 (3.16.14.19)
-    little-plugger (1.1.4)
-    logging (2.2.2)
-      little-plugger (~> 1.1)
-      multi_json (~> 1.10)
     lograge (0.10.0)
       actionpack (>= 4)
       activesupport (>= 4)
@@ -179,14 +174,15 @@ GEM
       multi_json (~> 1.3)
       multi_xml (~> 0.5)
       rack (>= 1.2, < 3)
-    oj (3.6.4)
+    oj (3.7.9)
     omniauth (1.4.3)
       hashie (>= 1.2, < 4)
       rack (>= 1.6.2, < 3)
     omniauth-oauth2 (1.5.0)
       oauth2 (~> 1.1)
       omniauth (~> 1.2)
-    os (0.9.6)
+    optimist (3.0.0)
+    os (1.0.0)
     passenger (5.3.0)
       rack
       rake (>= 0.8.1)
@@ -194,7 +190,7 @@ GEM
     power_assert (1.1.1)
     protected_attributes (1.1.4)
       activemodel (>= 4.0.1, < 5.0)
-    public_suffix (3.0.2)
+    public_suffix (3.0.3)
     rack (1.6.11)
     rack-test (0.6.3)
       rack (>= 1.0)
@@ -242,7 +238,7 @@ GEM
       sass (~> 3.2.2)
       sprockets (~> 2.8, < 3.0)
       sprockets-rails (~> 2.0)
-    signet (0.8.1)
+    signet (0.11.0)
       addressable (~> 2.3)
       faraday (~> 0.9)
       jwt (>= 1.5, < 3.0)
@@ -273,7 +269,7 @@ GEM
     thor (0.20.3)
     thread_safe (0.3.6)
     tilt (1.4.1)
-    trollop (2.1.2)
+    trollop (2.9.9)
     tzinfo (1.2.5)
       thread_safe (~> 0.1)
     uglifier (2.7.2)
@@ -290,7 +286,7 @@ DEPENDENCIES
   activerecord-deprecated_finders
   acts_as_api
   andand
-  arvados (>= 0.1.20150615153458)
+  arvados (>= 1.3.1.20190301212059)
   arvados-cli
   coffee-rails (~> 4.0)
   database_cleaner

commit e5f54c2bf76313730ddfe7cd59fc8764d0934517
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Fri Mar 1 15:48:56 2019 -0500

    14870: Saving previous retry logs into collection WIP
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index 0c2ad0965..e1ae2b548 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -3,6 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 require 'whitelist_update'
+require 'arvados/collection'
 
 class ContainerRequest < ArvadosModel
   include ArvadosModelUpdates
@@ -149,18 +150,28 @@ class ContainerRequest < ArvadosModel
       manifest = Collection.where(portable_data_hash: pdh).first.manifest_text
 
       coll_uuid = self.send(out_type + '_uuid')
-      coll = coll_uuid.nil? ? nil : Collection.where(uuid: coll_uuid).first
+      coll = coll_uuid.nil? ? nil : Collection.find_by_uuid(coll_uuid)
       if !coll
         coll = Collection.new(
           owner_uuid: self.owner_uuid,
           name: coll_name,
+          manifest_text: "",
           properties: {
             'type' => out_type,
             'container_request' => uuid,
           })
       end
+
+      if out_type == "log"
+        src = Arv::Collection.new(manifest)
+        dst = Arv::Collection.new(coll.manifest_text)
+        dst.cp_r("./", ".", src)
+        dst.cp_r("./", "container #{container.uuid}", src)
+        manifest = dst.manifest_text
+      end
+
       coll.assign_attributes(
-        portable_data_hash: pdh,
+        portable_data_hash: Digest::MD5.hexdigest(manifest) + '+' + manifest.bytesize.to_s,
         manifest_text: manifest,
         trash_at: trash_at,
         delete_at: trash_at)
@@ -203,6 +214,16 @@ class ContainerRequest < ArvadosModel
         return false
       else
         self.container_count += 1
+        if self.container_uuid_was
+          # old_container = Container.find_by_uuid()
+          # # copy logs from old container into CR's log collection
+          # #
+          #   src = Arv::Collection.new(manifest)
+          #   tgt = Arv::Collection.new(coll.manifest_text)
+          #   tgt.cp_r("./", "./", src)
+          #   tgt.cp_r("./", "container #{container.uuid}", src)
+          #   manifest = tgt.manifest_text
+        end
       end
     end
   end
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index a7700573d..86f05d301 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -245,6 +245,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
     cr.reload
     assert_equal "Final", cr.state
     assert_equal users(:active).uuid, cr.modified_by_user_uuid
+    puts "CR #{Collection.find_by_uuid(cr.log_uuid).manifest_text}"
     ['output', 'log'].each do |out_type|
       pdh = Container.find_by_uuid(cr.container_uuid).send(out_type)
       assert_equal(1, Collection.where(portable_data_hash: pdh,

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list