Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions ui/app/components/job-status/panel/steady.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-unsafe-optional-chaining */
/**
* Copyright IBM Corp. 2015, 2025
* SPDX-License-Identifier: BUSL-1.1
Expand Down Expand Up @@ -270,15 +269,18 @@ export default class JobStatusPanelSteadyComponent extends Component {

// If any allocations are failed, lost, or unplaced in a steady state, the job is "Degraded"
const failedOrLostAllocs = [
...this.allocBlocks.failed?.healthy?.nonCanary,
...this.allocBlocks.lost?.healthy?.nonCanary,
...this.allocBlocks.unplaced?.healthy?.nonCanary,
...(this.allocBlocks.failed?.healthy?.nonCanary || []),
...(this.allocBlocks.lost?.healthy?.nonCanary || []),
...(this.allocBlocks.unplaced?.healthy?.nonCanary || []),
];

if (failedOrLostAllocs.length === totalAllocs) {
if (totalAllocs > 0 && failedOrLostAllocs.length >= totalAllocs) {
return { label: 'Failed', state: 'critical' };
} else {
} else if (failedOrLostAllocs.length > 0) {
return { label: 'Degraded', state: 'warning' };
}

// If no allocations and no failures, show as scaled down
return { label: 'Scaled Down', state: 'neutral' };
}
}
28 changes: 21 additions & 7 deletions ui/app/models/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,22 @@ export default class Job extends Model {
// If the job is scaled down to 0 desired allocations, we shouldn't call it "failed";
// we should indicate that it is deliberately set to not have any running parts.
// System/Sysbatch jobs (hasClientStatus) get their totalAllocs from expectedRunningAllocCount,
// which is a best-guess-based-on-whats-running number. This means that if there are no current allocs,
// because they've been GC'd, we don't know if they were deliberately scaled down or failed.
// Safer in this case to show as failed rather than imply a deliberate scale-down.
if (totalAllocs === 0 && !this.hasClientStatus) {
return { label: 'Scaled Down', state: 'neutral' };
// which is a best-guess-based-on-whats-running number. For these jobs, if there are no
// current allocs AND no failed/lost/unplaced allocs to inspect, we treat the job as
// "Scaled Down" rather than "Failed" — the most common cause is that all eligible nodes
// (e.g. a node pool) have been intentionally scaled to zero. See GH-26155.
if (totalAllocs === 0) {
if (!this.hasClientStatus) {
return { label: 'Scaled Down', state: 'neutral' };
}
const hasFailureSignal =
(this.allocBlocks.failed?.healthy?.nonCanary?.length || 0) +
(this.allocBlocks.lost?.healthy?.nonCanary?.length || 0) +
(this.allocBlocks.unplaced?.healthy?.nonCanary?.length || 0) >
0;
if (!hasFailureSignal) {
return { label: 'Scaled Down', state: 'neutral' };
}
}

// If the job was requested initially, but a subsequent request for it was
Expand Down Expand Up @@ -304,11 +315,14 @@ export default class Job extends Model {
...this.allocBlocks.unplaced?.healthy?.nonCanary,
];

if (failedOrLostAllocs.length >= totalAllocs) {
if (totalAllocs > 0 && failedOrLostAllocs.length >= totalAllocs) {
return { label: 'Failed', state: 'critical' };
} else {
} else if (failedOrLostAllocs.length > 0) {
return { label: 'Degraded', state: 'warning' };
}

// If no allocations and no failures, show as scaled down
return { label: 'Scaled Down', state: 'neutral' };
}
@fragment('structured-attributes') meta;

Expand Down
2 changes: 1 addition & 1 deletion ui/tests/acceptance/jobs-list-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ module('Acceptance | jobs list', function (hooks) {
.hasText('Scaled Down', 'Scaled down job is scaled down');
assert
.dom('[data-test-job-row="ancient-system-job"] [data-test-job-status]')
.hasText('Failed', 'System job with no allocs is failed');
.hasText('Scaled Down', 'System job with no allocs is scaled down');

await percySnapshot(assert);
});
Expand Down
Loading