diff --git a/api/allocations.go b/api/allocations.go index 0159a9e12..6ef6286ad 100644 --- a/api/allocations.go +++ b/api/allocations.go @@ -326,6 +326,7 @@ func (a *Allocation) Stub() *AllocationListStub { TaskStates: a.TaskStates, DeploymentStatus: a.DeploymentStatus, FollowupEvalID: a.FollowupEvalID, + NextAllocation: a.JobID, RescheduleTracker: a.RescheduleTracker, PreemptedAllocations: a.PreemptedAllocations, PreemptedByAllocation: a.PreemptedByAllocation, @@ -379,6 +380,7 @@ type AllocationListStub struct { TaskStates map[string]*TaskState DeploymentStatus *AllocDeploymentStatus FollowupEvalID string + NextAllocation string RescheduleTracker *RescheduleTracker PreemptedAllocations []string PreemptedByAllocation string diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index b318e31dc..3d6668a20 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -10896,6 +10896,7 @@ func (a *Allocation) Stub(fields *AllocStubFields) *AllocListStub { TaskStates: a.TaskStates, DeploymentStatus: a.DeploymentStatus, FollowupEvalID: a.FollowupEvalID, + NextAllocation: a.NextAllocation, RescheduleTracker: a.RescheduleTracker, PreemptedAllocations: a.PreemptedAllocations, PreemptedByAllocation: a.PreemptedByAllocation, @@ -11058,6 +11059,7 @@ type AllocListStub struct { TaskStates map[string]*TaskState DeploymentStatus *AllocDeploymentStatus FollowupEvalID string + NextAllocation string RescheduleTracker *RescheduleTracker PreemptedAllocations []string PreemptedByAllocation string diff --git a/ui/app/components/job-status/failed-or-lost.hbs b/ui/app/components/job-status/failed-or-lost.hbs index 54210c5ec..422d67ac1 100644 --- a/ui/app/components/job-status/failed-or-lost.hbs +++ b/ui/app/components/job-status/failed-or-lost.hbs @@ -9,14 +9,28 @@ - - {{@allocs.length}} - + {{#if (eq @title "Rescheduled")}} + + {{@allocs.length}} + + {{/if}} + {{#if (eq @title "Restarted")}} + + {{@allocs.length}} + + {{/if}} \ No newline at end of file diff --git a/ui/app/components/job-status/failed-or-lost.js b/ui/app/components/job-status/failed-or-lost.js index 1de1b55b2..9e1f5ad8d 100644 --- a/ui/app/components/job-status/failed-or-lost.js +++ b/ui/app/components/job-status/failed-or-lost.js @@ -2,6 +2,6 @@ import Component from '@glimmer/component'; export default class JobStatusFailedOrLostComponent extends Component { get shouldLinkToAllocations() { - return this.args.title !== 'Restarted' && this.args.allocs.length; + return this.args.allocs.length; } } diff --git a/ui/app/components/job-status/panel/steady.hbs b/ui/app/components/job-status/panel/steady.hbs index 4dc6c5baf..67b3b9e39 100644 --- a/ui/app/components/job-status/panel/steady.hbs +++ b/ui/app/components/job-status/panel/steady.hbs @@ -48,7 +48,7 @@ @condition={{not (eq type.label "unplaced")}} @route="jobs.job.allocations" @model={{@job}} - @query={{hash status=(concat '["' type.label '"]') version=(concat '[' (keys this.versions) ']')}} + @query={{hash status=(concat '["' type.label '"]') version=(concat '[' (map-by "version" this.versions) ']')}} @class="legend-item {{if (eq (get (get (get (get this.allocBlocks type.label) 'healthy') 'nonCanary') "length") 0) "faded"}}" @label="View {{type.label}} allocations" > diff --git a/ui/app/controllers/jobs/job/allocations.js b/ui/app/controllers/jobs/job/allocations.js index f3abbacf9..26b1f9a4d 100644 --- a/ui/app/controllers/jobs/job/allocations.js +++ b/ui/app/controllers/jobs/job/allocations.js @@ -49,6 +49,9 @@ export default class AllocationsController extends Controller.extend( { qpVersion: 'version', }, + { + qpScheduling: 'scheduling', + }, 'activeTask', ]; @@ -56,6 +59,7 @@ export default class AllocationsController extends Controller.extend( qpClient = ''; qpTaskGroup = ''; qpVersion = ''; + qpScheduling = ''; currentPage = 1; pageSize = 25; activeTask = null; @@ -80,7 +84,8 @@ export default class AllocationsController extends Controller.extend( 'selectionStatus', 'selectionClient', 'selectionTaskGroup', - 'selectionVersion' + 'selectionVersion', + 'selectionScheduling' ) get filteredAllocations() { const { @@ -88,6 +93,7 @@ export default class AllocationsController extends Controller.extend( selectionClient, selectionTaskGroup, selectionVersion, + selectionScheduling, } = this; return this.allocations.filter((alloc) => { @@ -115,6 +121,35 @@ export default class AllocationsController extends Controller.extend( ) { return false; } + + if (selectionScheduling.length) { + if ( + selectionScheduling.includes('will-not-reschedule') && + !alloc.willNotReschedule + ) { + return false; + } + if ( + selectionScheduling.includes('will-not-restart') && + !alloc.willNotRestart + ) { + return false; + } + if ( + selectionScheduling.includes('has-been-rescheduled') && + !alloc.hasBeenRescheduled + ) { + return false; + } + if ( + selectionScheduling.includes('has-been-restarted') && + !alloc.hasBeenRestarted + ) { + return false; + } + return true; + } + return true; }); } @@ -127,6 +162,7 @@ export default class AllocationsController extends Controller.extend( @selection('qpClient') selectionClient; @selection('qpTaskGroup') selectionTaskGroup; @selection('qpVersion') selectionVersion; + @selection('qpScheduling') selectionScheduling; @action gotoAllocation(allocation) { @@ -198,6 +234,28 @@ export default class AllocationsController extends Controller.extend( return versions.sort((a, b) => a - b).map((v) => ({ key: v, label: v })); } + @computed('model.allocations.[]', 'selectionScheduling') + get optionsScheduling() { + return [ + { + key: 'has-been-rescheduled', + label: 'Failed & Has Been Rescheduled', + }, + { + key: 'will-not-reschedule', + label: "Failed & Won't Reschedule", + }, + { + key: 'has-been-restarted', + label: 'Has Been Restarted', + }, + { + key: 'will-not-restart', + label: "Won't Restart", + }, + ]; + } + setFacetQueryParam(queryParam, selection) { this.set(queryParam, serialize(selection)); } diff --git a/ui/app/templates/components/multi-select-dropdown.hbs b/ui/app/templates/components/multi-select-dropdown.hbs index b52f22f63..8b337ceae 100644 --- a/ui/app/templates/components/multi-select-dropdown.hbs +++ b/ui/app/templates/components/multi-select-dropdown.hbs @@ -4,7 +4,7 @@ ~}} +