Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of [ui] Fixes an issue where system jobs' status were set to Scaled Down when their allocs get garbage collected into release/1.9.x #24687

Merged
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
3 changes: 3 additions & 0 deletions .changelog/24620.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Fix an issue where system jobs with garbage-collected allocations were showing as Scaled Down
```
4 changes: 2 additions & 2 deletions ui/app/components/job-status/panel/steady.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export default class JobStatusPanelSteadyComponent extends Component {
};
}

if (this.totalAllocs === 0) {
if (this.totalAllocs === 0 && !this.job.hasClientStatus) {
return {
label: 'Scaled Down',
state: 'neutral',
Expand All @@ -246,7 +246,7 @@ export default class JobStatusPanelSteadyComponent extends Component {
}

const healthyAllocs = this.allocBlocks.running?.healthy?.nonCanary;
if (healthyAllocs?.length === totalAllocs) {
if (healthyAllocs?.length && healthyAllocs?.length === totalAllocs) {
return { label: 'Healthy', state: 'success' };
}

Expand Down
6 changes: 5 additions & 1 deletion ui/app/models/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,11 @@ 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.
if (totalAllocs === 0) {
// 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' };
}

Expand Down
11 changes: 11 additions & 0 deletions ui/tests/acceptance/jobs-list-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,14 @@ module('Acceptance | jobs list', function (hooks) {
status: 'dead',
});

server.create('job', {
...defaultJobParams,
id: 'ancient-system-job',
status: 'dead',
type: 'system',
groupAllocCount: 0,
});

await JobsList.visit();

assert
Expand Down Expand Up @@ -742,6 +750,9 @@ module('Acceptance | jobs list', function (hooks) {
assert
.dom('[data-test-job-row="scaled-down-job"] [data-test-job-status]')
.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');

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