From 9e500013034d9eb588bf60408a1a170997e11caa Mon Sep 17 00:00:00 2001 From: Calvin Pomerantz Date: Fri, 19 Feb 2016 14:58:14 -0500 Subject: [PATCH 1/4] Healthcheck notification won't display if task state is TASK_FAILED --- .../app/views/taskHealthcheckNotificationSubview.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee b/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee index e6eafc4e7a..00aa744bfe 100644 --- a/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee +++ b/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee @@ -14,6 +14,7 @@ class taskHealthcheckNotificationSubview extends View render: => return if not @model.synced + return if _.last(@model.attributes.taskUpdates).taskState is "TASK_FAILED" # This is unfortunately the only place last state is stored. @$el.html @template @renderData() renderData: => From ad36b5a060ade2a43a50fcbc2b9449c47b60b12b Mon Sep 17 00:00:00 2001 From: Calvin Pomerantz Date: Fri, 19 Feb 2016 15:28:02 -0500 Subject: [PATCH 2/4] Put the lastKnownState attribute into the parse method --- SingularityUI/app/models/TaskHistory.coffee | 3 ++- .../app/views/taskHealthcheckNotificationSubview.coffee | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/SingularityUI/app/models/TaskHistory.coffee b/SingularityUI/app/models/TaskHistory.coffee index eeeb899293..2fc56026f9 100644 --- a/SingularityUI/app/models/TaskHistory.coffee +++ b/SingularityUI/app/models/TaskHistory.coffee @@ -12,6 +12,7 @@ class TaskHistory extends Model parse: (taskHistory) -> taskHistory.taskUpdates = _.sortBy taskHistory.taskUpdates, (t) -> t.timestamp + taskHistory.lastKnownState = _.last(taskHistory.taskUpdates).taskState taskHistory.healthcheckResults = (_.sortBy taskHistory.healthcheckResults, (t) -> t.timestamp).reverse() taskHistory.task?.mesosTask?.executor?.command?.environment?.variables = _.sortBy taskHistory.task.mesosTask.executor.command.environment.variables, "name" @@ -52,7 +53,7 @@ class TaskHistory extends Model taskHistory.slaveMissing = true - taskHistory.isCleaning = _.last( taskHistory.taskUpdates ).taskState is 'TASK_CLEANING' + taskHistory.isCleaning = taskHistory.lastKnownState is 'TASK_CLEANING' taskHistory.requestId = taskHistory.task.taskId.requestId diff --git a/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee b/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee index 00aa744bfe..f2c165f3d1 100644 --- a/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee +++ b/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee @@ -14,7 +14,7 @@ class taskHealthcheckNotificationSubview extends View render: => return if not @model.synced - return if _.last(@model.attributes.taskUpdates).taskState is "TASK_FAILED" # This is unfortunately the only place last state is stored. + return if @model.attributes.lastKnownState is "TASK_FAILED" @$el.html @template @renderData() renderData: => From 85b3a4b439e939367b7f2ad563cc6e4237a05edc Mon Sep 17 00:00:00 2001 From: Calvin Pomerantz Date: Fri, 19 Feb 2016 15:49:01 -0500 Subject: [PATCH 3/4] Change double quotes to single quotes --- .../app/views/taskHealthcheckNotificationSubview.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee b/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee index f2c165f3d1..1d12edc531 100644 --- a/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee +++ b/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee @@ -14,7 +14,7 @@ class taskHealthcheckNotificationSubview extends View render: => return if not @model.synced - return if @model.attributes.lastKnownState is "TASK_FAILED" + return if @model.attributes.lastKnownState is 'TASK_FAILED' @$el.html @template @renderData() renderData: => From 7ffb9a163eb5aa57454e4caf0572fb925bb90cf5 Mon Sep 17 00:00:00 2001 From: Calvin Pomerantz Date: Fri, 4 Mar 2016 10:59:32 -0500 Subject: [PATCH 4/4] Tasks in state TASK_LOST or TASK_FINISHED will also not display a healthcheck message --- .../app/views/taskHealthcheckNotificationSubview.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee b/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee index 1d12edc531..c73d17d375 100644 --- a/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee +++ b/SingularityUI/app/views/taskHealthcheckNotificationSubview.coffee @@ -3,6 +3,12 @@ Task = require '../models/Task' class taskHealthcheckNotificationSubview extends View + noHealthcheckMessageStates: [ + 'TASK_FAILED', + 'TASK_FINISHED', + 'TASK_LOST' + ] + events: -> _.extend super, 'click [data-action="viewHealthchecks"]': 'triggerToggleHealthchecks' @@ -14,7 +20,7 @@ class taskHealthcheckNotificationSubview extends View render: => return if not @model.synced - return if @model.attributes.lastKnownState is 'TASK_FAILED' + return if @model.attributes.lastKnownState in @noHealthcheckMessageStates @$el.html @template @renderData() renderData: =>