From 8dd7e323798d36e3182c12868c6f1f3dd0eabf96 Mon Sep 17 00:00:00 2001 From: radhika Date: Wed, 3 May 2017 16:20:08 -0400 Subject: [PATCH] 11250: when a container's priority is zero and in Queued state, show the state as "Cancelled" --- apps/workbench/app/models/container_work_unit.rb | 5 ++++- apps/workbench/test/unit/work_unit_test.rb | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb index ed82f18036..16462f77d8 100644 --- a/apps/workbench/app/models/container_work_unit.rb +++ b/apps/workbench/app/models/container_work_unit.rb @@ -81,8 +81,11 @@ class ContainerWorkUnit < ProxyWorkUnit def state_label ec = exit_code return "Failed" if (ec && ec != 0) + state = get_combined(:state) - return "Ready" if ((priority == 0) and (["Queued", "Locked"].include?(state))) + + return "Queued" if state == "Locked" + return "Cancelled" if ((priority == 0) and (state == "Queued")) state end diff --git a/apps/workbench/test/unit/work_unit_test.rb b/apps/workbench/test/unit/work_unit_test.rb index 8bbbb5cf26..1932b75454 100644 --- a/apps/workbench/test/unit/work_unit_test.rb +++ b/apps/workbench/test/unit/work_unit_test.rb @@ -16,8 +16,8 @@ class WorkUnitTest < ActiveSupport::TestCase [Container, 'requester', 'cwu', 1, "Complete", true, 1.0], [ContainerRequest, 'cr_for_requester', 'cwu', 1, "Complete", true, 1.0], [ContainerRequest, 'queued', 'cwu', 0, "Queued", nil, 0.0], # priority 1 - [ContainerRequest, 'canceled_with_queued_container', 'cwu', 0, "Ready", nil, 0.0], - [ContainerRequest, 'canceled_with_locked_container', 'cwu', 0, "Ready", nil, 0.0], + [ContainerRequest, 'canceled_with_queued_container', 'cwu', 0, "Cancelled", false, 0.0], + [ContainerRequest, 'canceled_with_locked_container', 'cwu', 0, "Queued", nil, 0.0], [ContainerRequest, 'canceled_with_running_container', 'cwu', 1, "Running", nil, 0.0], ].each do |type, fixture, label, num_children, state, success, progress| test "children of #{fixture}" do -- 2.39.5