X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/22e066d43cb09beb21c4cd5b12a787b81a00f97e..ac36412ff05d99c6bd6cdc236d5cb8b538cfe0ed:/apps/workbench/app/models/container_work_unit.rb diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb index 037a6e53ee..e56c065523 100644 --- a/apps/workbench/app/models/container_work_unit.rb +++ b/apps/workbench/app/models/container_work_unit.rb @@ -124,6 +124,31 @@ class ContainerWorkUnit < ProxyWorkUnit get_combined(:output_path) end + def log_object_uuids + [get_combined(:uuid), get(:uuid)].uniq + end + + def live_log_lines(limit=2000) + event_types = ["stdout", "stderr", "arv-mount", "crunch-run"] + log_lines = Log.where(event_type: event_types, object_uuid: log_object_uuids).order("id DESC").limit(limit) + log_lines.results.reverse. + flat_map { |log| log.properties[:text].split("\n") rescue [] } + end + + def render_log + collection = Collection.find(log_collection) rescue nil + if collection + return {log: collection, partial: 'collections/show_files', locals: {object: collection, no_checkboxes: true}} + end + end + + def template_uuid + properties = get(:properties) + if properties + properties[:template_uuid] + end + end + # End combined propeties protected