mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
Remove no longer used allocation-stats class
This commit is contained in:
@@ -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'),
|
||||
|
||||
|
||||
@@ -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;
|
||||
}),
|
||||
});
|
||||
Reference in New Issue
Block a user