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

[ui] Remove simulacral allocation stat in favor of live-updating one #23306

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/23306.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: unbind job detail running allocations count from job-summary endpoint
```
4 changes: 2 additions & 2 deletions ui/app/components/job-status/panel/steady.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
All allocations have completed successfully
{{else}}
<strong>
{{@job.runningAllocs ~}}
{{this.runningAllocs.length ~}}
{{#unless this.atMostOneAllocPerNode ~}}
{{#if (eq @job.type "batch") ~}}
/{{this.totalNonCompletedAllocs}}
Expand All @@ -42,7 +42,7 @@
{{/unless}}
</strong>
{{#if (eq @job.type "batch") ~}}Remaining{{/if}}
{{pluralize "Allocation" @job.runningAllocs}} Running
{{pluralize "Allocation" this.runningAllocs.length}} Running
{{/if}}
</h3>
<JobStatus::AllocationStatusRow @allocBlocks={{this.allocBlocks}} @steady={{true}} />
Expand Down
4 changes: 4 additions & 0 deletions ui/app/components/job-status/panel/steady.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ export default class JobStatusPanelSteadyComponent extends Component {
return this.job.allocations.filter((a) => !a.isOld && a.hasBeenRestarted);
}

get runningAllocs() {
return this.job.allocations.filter((a) => a.clientStatus === 'running');
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@job.runningAllocs comes from the job's summary as defined here in case you were curious


get completedAllocs() {
return this.job.allocations.filter(
(a) => !a.isOld && a.clientStatus === 'complete'
Expand Down
26 changes: 2 additions & 24 deletions ui/tests/acceptance/job-status-panel-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -979,19 +979,6 @@ module('Acceptance | job status panel', function (hooks) {
'job',
JSON.stringify([job.id, 'default'])
);
// Weird Mirage thing: job summary factory is disconnected from its job and therefore allocations.
// So we manually create the number here.
let summary = await storedJob.get('summary');
summary
.get('taskGroupSummaries')
.objectAt(0)
.set(
'runningAllocs',
server.schema.allocations.where({
jobId: job.id,
clientStatus: 'running',
}).length
);

await settled();

Expand Down Expand Up @@ -1020,17 +1007,8 @@ module('Acceptance | job status panel', function (hooks) {
nodeId: newNode.id,
});

summary
.get('taskGroupSummaries')
.objectAt(0)
.set(
'runningAllocs',
server.schema.allocations.where({
jobId: job.id,
clientStatus: 'running',
}).length
);

// simulate a blocking query update from /allocations
storedJob.allocations.reload();
await settled();

assert.dom('.running-allocs-title').hasText('4 Allocations Running');
Expand Down
Loading