+ # Add our cumulative cost to the subrequests_cost of the
+ # requesting container, if any.
+ if self.requesting_container_uuid
+ Container.where(
+ uuid: self.requesting_container_uuid,
+ state: Container::Running,
+ ).each do |c|
+ c.subrequests_cost += self.cumulative_cost
+ c.save!
+ end
+ end
+
+ update_collections(container: container)
+ # update_collections makes a log collection that includes all of the logs
+ # for all of the containers associated with this request. For requests
+ # that are retried, this is the primary way users can get logs for
+ # failed containers.
+ # The code below makes a log collection that is a verbatim copy of the
+ # container's logs. This is required for container reuse: a container
+ # will not be reused if the owner cannot read a collection with its logs.
+ # See the "readable log" section of Container.find_reusable().