Merge branch '15554-crunchstat-summary-live-log-no-sdk'
authorTom Morris <tfmorris@veritasgenetics.com>
Wed, 11 Sep 2019 14:32:11 +0000 (10:32 -0400)
committerTom Morris <tfmorris@veritasgenetics.com>
Wed, 11 Sep 2019 14:32:47 +0000 (10:32 -0400)
Fixes #15554

Arvados-DCO-1.1-Signed-off-by: Tom Morris <tfmorris@veritasgenetics.com>

build/package-build-dockerfiles/centos7/Dockerfile
build/package-test-dockerfiles/centos7/Dockerfile
services/api/app/models/container_request.rb
services/api/app/models/user.rb
services/api/test/unit/container_request_test.rb
services/login-sync/Gemfile.lock

index 3d3ea6f0f82798953c2d3eac7a646fa1240735a9..7219edb37eb09a3bd89d41968a4f2f3516a5e51a 100644 (file)
@@ -18,6 +18,17 @@ RUN gpg --import --no-tty /tmp/mpapis.asc && \
     /usr/local/rvm/bin/rvm alias create default ruby-2.5 && \
     /usr/local/rvm/bin/rvm-exec default gem install fpm --version 1.10.2
 
+# Install Bash 4.4.12 // see https://dev.arvados.org/issues/15612
+RUN cd /usr/local/src \
+&& wget http://ftp.gnu.org/gnu/bash/bash-4.4.12.tar.gz \
+&& wget http://ftp.gnu.org/gnu/bash/bash-4.4.12.tar.gz.sig \
+&& tar xzf bash-4.4.12.tar.gz \
+&& cd bash-4.4.12 \
+&& ./configure --prefix=/usr/local/$( basename $( pwd ) ) \
+&& make \
+&& make install \
+&& ln -sf /usr/local/src/bash-4.4.12/bash /bin/bash
+
 # Install golang binary
 ADD generated/go1.12.7.linux-amd64.tar.gz /usr/local/
 RUN ln -s /usr/local/go/bin/go /usr/local/bin/
index 0bfe80b70d87178619d0e9a8049cfa23f61a0acd..49d04aa7444a89f03cea6e838d2703eba5319ad3 100644 (file)
@@ -18,6 +18,17 @@ RUN touch /var/lib/rpm/* && \
     /usr/local/rvm/bin/rvm install 2.3 && \
     /usr/local/rvm/bin/rvm alias create default ruby-2.3
 
+# Install Bash 4.4.12  // see https://dev.arvados.org/issues/15612
+RUN cd /usr/local/src \
+&& wget http://ftp.gnu.org/gnu/bash/bash-4.4.12.tar.gz \
+&& wget http://ftp.gnu.org/gnu/bash/bash-4.4.12.tar.gz.sig \
+&& tar xzf bash-4.4.12.tar.gz \
+&& cd bash-4.4.12 \
+&& ./configure --prefix=/usr/local/$( basename $( pwd ) ) \
+&& make \
+&& make install \
+&& ln -sf /usr/local/src/bash-4.4.12/bash /bin/bash
+
 # Add epel, we need it for the python-pam dependency
 RUN wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 RUN rpm -ivh epel-release-latest-7.noarch.rpm
index c412e4b8500c141617b18de64007078f7b715c4d..5a7818147308a6f3fa41966430ffce837ab2cee7 100644 (file)
@@ -153,7 +153,27 @@ class ContainerRequest < ArvadosModel
   # Finalize the container request after the container has
   # finished/cancelled.
   def finalize!
-    update_collections(container: Container.find_by_uuid(container_uuid))
+    container = Container.find_by_uuid(container_uuid)
+    update_collections(container: container)
+
+    if container.state == Container::Complete
+      log_col = Collection.where(portable_data_hash: container.log).first
+      if log_col
+        # Need to save collection
+        completed_coll = Collection.new(
+          owner_uuid: self.owner_uuid,
+          name: "Container log for container #{container_uuid}",
+          properties: {
+            'type' => 'log',
+            'container_request' => self.uuid,
+            'container_uuid' => container_uuid,
+          },
+          portable_data_hash: log_col.portable_data_hash,
+          manifest_text: log_col.manifest_text)
+        completed_coll.save_with_unique_name!
+      end
+    end
+
     update_attributes!(state: Final)
   end
 
@@ -187,6 +207,7 @@ class ContainerRequest < ArvadosModel
       end
 
       if out_type == "log"
+        # Copy the log into a merged collection
         src = Arv::Collection.new(manifest)
         dst = Arv::Collection.new(coll.manifest_text)
         dst.cp_r("./", ".", src)
index 8ab8ea1d85b0146f692993a8cd1fb6199addc8fc..4493f038cd1c03e5e265d973ed774e7223eb43e4 100644 (file)
@@ -10,6 +10,7 @@ class User < ArvadosModel
   include KindAndEtag
   include CommonApiTemplate
   include CanBeAnOwner
+  extend CurrentApiClient
 
   serialize :prefs, Hash
   has_many :api_client_authorizations
index 2637e77937b1cb8b5954abed52d66c382fe4f24a..b04bae8647a2417d227e84a793043d1207f875cc 100644 (file)
@@ -630,6 +630,8 @@ class ContainerRequestTest < ActiveSupport::TestCase
       set_user_from_auth :active
       cr1 = create_minimal_req!(common_attrs.merge({state: ContainerRequest::Committed,
                                                     environment: env1}))
+      run_container(cr1)
+      cr1.reload
       if use_existing.nil?
         # Testing with use_existing default value
         cr2 = create_minimal_req!(common_attrs.merge({state: ContainerRequest::Uncommitted,
@@ -850,13 +852,18 @@ class ContainerRequestTest < ActiveSupport::TestCase
 
   def run_container(cr)
     act_as_system_user do
+      logc = Collection.new(owner_uuid: system_user_uuid,
+                            manifest_text: ". ef772b2f28e2c8ca84de45466ed19ee9+7815 0:0:arv-mount.txt\n")
+      logc.save!
+
       c = Container.find_by_uuid(cr.container_uuid)
       c.update_attributes!(state: Container::Locked)
       c.update_attributes!(state: Container::Running)
       c.update_attributes!(state: Container::Complete,
                            exit_code: 0,
                            output: '1f4b0bc7583c2a7f9102c395f4ffc5e3+45',
-                           log: 'fa7aeb5140e2848d39b416daeef4ffc5+45')
+                           log: logc.portable_data_hash)
+      logc.destroy
       c
     end
   end
index f0283b6114a05fcf7c29eb72b2307671fc0b499c..70b666af8460a6ca7731d590cf6e8bf77a4af31a 100644 (file)
@@ -1,7 +1,7 @@
 PATH
   remote: .
   specs:
-    arvados-login-sync (1.4.0.20190709140013)
+    arvados-login-sync (1.4.0.20190729193732)
       arvados (~> 1.3.0, >= 1.3.0)
 
 GEM
@@ -60,9 +60,9 @@ GEM
     mocha (1.8.0)
       metaclass (~> 0.0.1)
     multi_json (1.13.1)
-    multipart-post (2.0.0)
-    os (1.0.0)
-    public_suffix (3.0.3)
+    multipart-post (2.1.1)
+    os (1.0.1)
+    public_suffix (3.1.1)
     rake (12.3.2)
     retriable (1.4.1)
     signet (0.11.0)