Skip to content

Commit

Permalink
Fixes an issue where system jobs' status were set to Scaled Down when…
Browse files Browse the repository at this point in the history
… their allocs get garbage collected
  • Loading branch information
philrenaud committed Dec 6, 2024
1 parent d1cec42 commit c4914ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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

0 comments on commit c4914ef

Please sign in to comment.