[ARVADOS] created: 1.3.0-1591-gdbe464e8c
Git user
git at public.curoverse.com
Tue Sep 10 14:13:44 UTC 2019
at dbe464e8ccee9c7d0048bc59a871627591e2b141 (commit)
commit dbe464e8ccee9c7d0048bc59a871627591e2b141
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date: Tue Sep 10 10:04:06 2019 -0400
15499: Alternate fix, get rid of merged collection
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 7aa82335f..fff958fc4 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -155,23 +155,6 @@ class ContainerRequest < ArvadosModel
def finalize!
container = Container.find_by_uuid(container_uuid)
update_collections(container: container)
-
- 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
-
update_attributes!(state: Final)
end
@@ -204,15 +187,6 @@ 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)
- dst.cp_r("./", "log for container #{container.uuid}", src)
- manifest = dst.manifest_text
- end
-
coll.assign_attributes(
portable_data_hash: Digest::MD5.hexdigest(manifest) + '+' + manifest.bytesize.to_s,
manifest_text: manifest,
@@ -273,25 +247,18 @@ class ContainerRequest < ArvadosModel
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 = self.log_uuid.nil? ? nil : Collection.where(uuid: self.log_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("./", "log for container #{old_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)
+ # Need to save collection
+ log_coll = Collection.new(
+ owner_uuid: self.owner_uuid,
+ name: "Container log for container #{old_container.uuid}",
+ properties: {
+ 'type' => 'log',
+ 'container_request' => self.uuid,
+ 'container_uuid' => old_container.uuid,
+ },
+ portable_data_hash: old_logs.portable_data_hash,
+ manifest_text: old_logs.manifest_text)
log_coll.save_with_unique_name!
- self.log_uuid = log_coll.uuid
end
end
end
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index b04bae864..ee771e3fa 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -255,8 +255,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
assert_not_nil output.modified_at
log = Collection.find_by_uuid cr.log_uuid
- assert_equal log.manifest_text, ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar
-./log\\040for\\040container\\040#{cr.container_uuid} 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+ assert_equal log.manifest_text, ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
assert_equal log.owner_uuid, project.uuid, "Container log should be copied to #{project.uuid}"
end
@@ -782,11 +781,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
cr.reload
assert_equal "Final", cr.state
assert_equal 3, cr.container_count
- assert_equal ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar
-./log\\040for\\040container\\040#{container_uuids[0]} 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar
-./log\\040for\\040container\\040#{container_uuids[1]} 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar
-./log\\040for\\040container\\040#{container_uuids[2]} 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar
-" , Collection.find_by_uuid(cr.log_uuid).manifest_text
+ assert_equal ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n" , Collection.find_by_uuid(cr.log_uuid).manifest_text
end
diff --git a/services/api/test/unit/container_test.rb b/services/api/test/unit/container_test.rb
index 88fd5feb6..f53ca73d5 100644
--- a/services/api/test/unit/container_test.rb
+++ b/services/api/test/unit/container_test.rb
@@ -879,8 +879,8 @@ class ContainerTest < ActiveSupport::TestCase
assert_equal cr1log_uuid, cr1.log_uuid
assert_equal cr2log_uuid, cr2.log_uuid
assert_equal 1, Collection.where(uuid: [cr1log_uuid, cr2log_uuid]).to_a.collect(&:portable_data_hash).uniq.length
- assert_equal ". acbd18db4cc2f85cedef654fccc4a4d8+3 cdd549ae79fe6640fa3d5c6261d8303c+195 0:3:foo.txt 3:195:zzzzz-8i9sb-0vsrcqi7whchuil.log.txt
-./log\\040for\\040container\\040#{cr1.container_uuid} acbd18db4cc2f85cedef654fccc4a4d8+3 cdd549ae79fe6640fa3d5c6261d8303c+195 0:3:foo.txt 3:195:zzzzz-8i9sb-0vsrcqi7whchuil.log.txt
+ assert_equal ". cdd549ae79fe6640fa3d5c6261d8303c+195 0:195:zzzzz-8i9sb-0vsrcqi7whchuil.log.txt
+. acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:foo.txt
", Collection.find_by_uuid(cr1log_uuid).manifest_text
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list