From 4d5fa15ea7b7325805f949ce12f873a3467eaa1f Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Thu, 20 Sep 2018 15:40:50 -0700 Subject: [PATCH] Remove no longer used allocation-stats class --- ui/app/models/allocation.js | 13 ---------- ui/app/utils/classes/allocation-stats.js | 33 ------------------------ 2 files changed, 46 deletions(-) delete mode 100644 ui/app/utils/classes/allocation-stats.js diff --git a/ui/app/models/allocation.js b/ui/app/models/allocation.js index f98e3fc22..1a7e030a5 100644 --- a/ui/app/models/allocation.js +++ b/ui/app/models/allocation.js @@ -6,7 +6,6 @@ import { belongsTo } from 'ember-data/relationships'; import { fragment, fragmentArray } from 'ember-data-model-fragments/attributes'; import intersection from 'lodash.intersection'; import shortUUIDProperty from '../utils/properties/short-uuid'; -import AllocationStats from '../utils/classes/allocation-stats'; const STATUS_ORDER = { pending: 1, @@ -74,18 +73,6 @@ export default Model.extend({ return []; }), - fetchStats() { - return this.get('token') - .authorizedRequest(`/v1/client/allocation/${this.get('id')}/stats`) - .then(res => res.json()) - .then(json => { - return new AllocationStats({ - stats: json, - allocation: this, - }); - }); - }, - states: fragmentArray('task-state'), rescheduleEvents: fragmentArray('reschedule-event'), diff --git a/ui/app/utils/classes/allocation-stats.js b/ui/app/utils/classes/allocation-stats.js deleted file mode 100644 index 463affbb4..000000000 --- a/ui/app/utils/classes/allocation-stats.js +++ /dev/null @@ -1,33 +0,0 @@ -import EmberObject, { computed } from '@ember/object'; -import { alias, readOnly } from '@ember/object/computed'; - -export default EmberObject.extend({ - allocation: null, - stats: null, - - reservedMemory: alias('allocation.taskGroup.reservedMemory'), - reservedCPU: alias('allocation.taskGroup.reservedCPU'), - - memoryUsed: readOnly('stats.ResourceUsage.MemoryStats.RSS'), - cpuUsed: computed('stats.ResourceUsage.CpuStats.TotalTicks', function() { - return Math.floor(this.get('stats.ResourceUsage.CpuStats.TotalTicks') || 0); - }), - - percentMemory: computed('reservedMemory', 'memoryUsed', function() { - const used = this.get('memoryUsed') / 1024 / 1024; - const total = this.get('reservedMemory'); - if (!total || !used) { - return 0; - } - return used / total; - }), - - percentCPU: computed('reservedCPU', 'cpuUsed', function() { - const used = this.get('cpuUsed'); - const total = this.get('reservedCPU'); - if (!total || !used) { - return 0; - } - return used / total; - }), -});