X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/93086f7d095a33de76d7ad6353bbf3333178cf36..1d922bf219f74efcd5fda01ed127f7ccae0790c4:/services/api/app/models/container_request.rb diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb index 7aa82335f7..5a78181473 100644 --- a/services/api/app/models/container_request.rb +++ b/services/api/app/models/container_request.rb @@ -156,20 +156,22 @@ class ContainerRequest < ArvadosModel 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! + 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)