X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ebb166d65eb37f89edeccfc5be97014f3f2a73e2..04bce28b705a6ca33d2c9b19aa783f588a99c8e0:/apps/workbench/app/helpers/pipeline_instances_helper.rb?ds=sidebyside diff --git a/apps/workbench/app/helpers/pipeline_instances_helper.rb b/apps/workbench/app/helpers/pipeline_instances_helper.rb index 7b6fb72763..b6df82fa9f 100644 --- a/apps/workbench/app/helpers/pipeline_instances_helper.rb +++ b/apps/workbench/app/helpers/pipeline_instances_helper.rb @@ -22,37 +22,32 @@ module PipelineInstancesHelper pj end - def pipeline_log_history(job_uuids) - results = [] - - log_history = Log.where(event_type: 'stderr', - object_uuid: job_uuids).order('id DESC') - if !log_history.results.empty? - reversed_results = log_history.results.reverse - reversed_results.each do |entry| - if entry.andand.properties - properties = entry.properties - text = properties[:text] - if text - results = results.concat text.split("\n") - end - end - end - end - - return results - end - protected def pipeline_jobs_newschool object ret = [] i = -1 + jobuuids = object.components.values.map { |c| + c[:job][:uuid] if c.is_a?(Hash) and c[:job].is_a?(Hash) + }.compact + job = {} + Job.where(uuid: jobuuids).each do |j| + job[j[:uuid]] = j + end + object.components.each do |cname, c| i += 1 pj = {index: i, name: cname} - pj[:job] = c[:job].is_a?(Hash) ? c[:job] : {} + if not c.is_a?(Hash) + ret << pj + next + end + if c[:job] and c[:job][:uuid] and job[c[:job][:uuid]] + pj[:job] = job[c[:job][:uuid]] + else + pj[:job] = c[:job].is_a?(Hash) ? c[:job] : {} + end pj[:percent_done] = 0 pj[:percent_running] = 0 if pj[:job][:success] @@ -82,23 +77,29 @@ module PipelineInstancesHelper end if pj[:job][:success] pj[:result] = 'complete' + pj[:labeltype] = 'success' pj[:complete] = true pj[:progress] = 1.0 elsif pj[:job][:finished_at] pj[:result] = 'failed' + pj[:labeltype] = 'danger' pj[:failed] = true elsif pj[:job][:started_at] pj[:result] = 'running' + pj[:labeltype] = 'primary' elsif pj[:job][:uuid] pj[:result] = 'queued' + pj[:labeltype] = 'default' else pj[:result] = 'none' + pj[:labeltype] = 'default' end pj[:job_id] = pj[:job][:uuid] pj[:script] = pj[:job][:script] || c[:script] pj[:script_parameters] = pj[:job][:script_parameters] || c[:script_parameters] pj[:script_version] = pj[:job][:script_version] || c[:script_version] pj[:output] = pj[:job][:output] + pj[:output_uuid] = c[:output_uuid] pj[:finished_at] = (Time.parse(pj[:job][:finished_at]) rescue nil) ret << pj end