From ea7b8b1a1139fb08b60cb49479c9f7c0521bc19b Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Tue, 12 May 2020 21:28:40 -0700 Subject: [PATCH] Don't double load freshly loaded allocations --- ui/app/components/allocation-row.js | 4 +++- ui/app/models/allocation.js | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ui/app/components/allocation-row.js b/ui/app/components/allocation-row.js index de07e0b0a..c2e0d46a5 100644 --- a/ui/app/components/allocation-row.js +++ b/ui/app/components/allocation-row.js @@ -80,7 +80,9 @@ async function qualifyAllocation() { // Make sure the allocation is a complete record and not a partial so we // can show information such as preemptions and rescheduled allocation. - await allocation.reload(); + if (allocation.isPartial) { + await allocation.reload(); + } if (allocation.get('job.isPending')) { // Make sure the job is loaded before starting the stats tracker diff --git a/ui/app/models/allocation.js b/ui/app/models/allocation.js index 3d6b95562..28db0e2cf 100644 --- a/ui/app/models/allocation.js +++ b/ui/app/models/allocation.js @@ -1,6 +1,6 @@ import { inject as service } from '@ember/service'; import { computed } from '@ember/object'; -import { equal } from '@ember/object/computed'; +import { equal, none } from '@ember/object/computed'; import Model from 'ember-data/model'; import attr from 'ember-data/attr'; import { belongsTo, hasMany } from 'ember-data/relationships'; @@ -43,6 +43,11 @@ export default Model.extend({ isRunning: equal('clientStatus', 'running'), isMigrating: attr('boolean'), + // An allocation model created from any allocation list response will be lacking + // many properties (some of which can always be null). This is an indicator that + // the allocation needs to be reloaded to get the complete allocation state. + isPartial: none('allocationTaskGroup'), + // When allocations are server-side rescheduled, a paper trail // is left linking all reschedule attempts. previousAllocation: belongsTo('allocation', { inverse: 'nextAllocation' }),