Remove no longer used allocation-stats class

This commit is contained in:
Michael Lange
2018-09-20 15:40:50 -07:00
parent 65336ccd96
commit 4d5fa15ea7
2 changed files with 0 additions and 46 deletions

View File

@@ -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'),

View File

@@ -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;
}),
});