t.add :state
t.add :use_existing
t.add :output_uuid
+ t.add :log_uuid
t.add :scheduling_parameters
end
# 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)
'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
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
+++ /dev/null
-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
--- /dev/null
+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
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)
);
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
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
"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