Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>
pipelines.results.each { |pi| procs[pi] = pi.created_at }
end
pipelines.results.each { |pi| procs[pi] = pi.created_at }
end
- crs = ContainerRequest.limit(lim).with_count("none").order(["created_at desc"]).filter([["requesting_container_uuid", "=", nil]])
+ crs = ContainerRequest.limit(lim).with_count("none").order(["created_at desc"]).filter([["requesting_container_uuid", "=", nil]]).select(
+ ["uuid", "name", "container_uuid", "output_uuid", "state", "created_at", "modified_at"])
crs.results.each { |c| procs[c] = c.created_at }
Hash[procs.sort_by {|key, value| value}].keys.reverse.first(lim)
crs.results.each { |c| procs[c] = c.created_at }
Hash[procs.sort_by {|key, value| value}].keys.reverse.first(lim)
# helper method to preload objects for given dataclass and uuids
helper_method :preload_objects_for_dataclass
# helper method to preload objects for given dataclass and uuids
helper_method :preload_objects_for_dataclass
- def preload_objects_for_dataclass dataclass, uuids, by_attr=nil
+ def preload_objects_for_dataclass dataclass, uuids, by_attr=nil, select_fields=nil
@objects_for ||= {}
raise ArgumentError, 'Argument is not a data class' unless dataclass.is_a? Class
@objects_for ||= {}
raise ArgumentError, 'Argument is not a data class' unless dataclass.is_a? Class
end
else
key_prefix = "request_#{Thread.current.object_id}_#{dataclass.to_s}_"
end
else
key_prefix = "request_#{Thread.current.object_id}_#{dataclass.to_s}_"
- dataclass.where(uuid: uuids).each do |obj|
+ dataclass.where(uuid: uuids).select(select_fields).each do |obj|
@objects_for[obj.uuid] = obj
if dataclass == Collection
# The collecions#index defaults to "all attributes except manifest_text"
@objects_for[obj.uuid] = obj
if dataclass == Collection
# The collecions#index defaults to "all attributes except manifest_text"
# preload container_uuids of any container requests
recent_crs = recent_procs.map {|p| p if p.is_a?(ContainerRequest)}.compact.uniq
recent_cr_containers = recent_crs.map {|cr| cr.container_uuid}.compact.uniq
# preload container_uuids of any container requests
recent_crs = recent_procs.map {|p| p if p.is_a?(ContainerRequest)}.compact.uniq
recent_cr_containers = recent_crs.map {|cr| cr.container_uuid}.compact.uniq
- preload_objects_for_dataclass(Container, recent_cr_containers) if recent_cr_containers.andand.any?
+ if recent_cr_containers.andand.any?
+ preload_objects_for_dataclass(Container, recent_cr_containers, nil,
+ ["uuid", "started_at", "finished_at", "state", "runtime_status", "created_at", "modified_at"])
+ end