mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 09:25:46 +03:00
Models evaluation data
This commit is contained in:
27
ui/app/models/evaluation.js
Normal file
27
ui/app/models/evaluation.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import Ember from 'ember';
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import { belongsTo } from 'ember-data/relationships';
|
||||
import { fragmentArray } from 'ember-data-model-fragments/attributes';
|
||||
import shortUUIDProperty from '../utils/properties/short-uuid';
|
||||
|
||||
const { computed } = Ember;
|
||||
|
||||
export default Model.extend({
|
||||
shortId: shortUUIDProperty('id'),
|
||||
priority: attr('number'),
|
||||
type: attr('string'),
|
||||
triggeredBy: attr('string'),
|
||||
status: attr('string'),
|
||||
statusDescription: attr('string'),
|
||||
failedTGAllocs: fragmentArray('placement-failure', { defaultValue: () => [] }),
|
||||
|
||||
hasPlacementFailures: computed.bool('failedTGAllocs.length'),
|
||||
|
||||
// TEMPORARY: https://github.com/emberjs/data/issues/5209
|
||||
originalJobId: attr('string'),
|
||||
|
||||
job: belongsTo('job'),
|
||||
|
||||
modifyIndex: attr('number'),
|
||||
});
|
||||
20
ui/app/models/placement-failure.js
Normal file
20
ui/app/models/placement-failure.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import attr from 'ember-data/attr';
|
||||
import Fragment from 'ember-data-model-fragments/fragment';
|
||||
|
||||
export default Fragment.extend({
|
||||
name: attr('string'),
|
||||
|
||||
coalescedFailures: attr('number'),
|
||||
|
||||
nodesEvaluated: attr('number'),
|
||||
nodesExhausted: attr('number'),
|
||||
|
||||
// Maps keyed by relevant dimension (dc, class, constraint, etc) with count values
|
||||
nodesAvailable: attr(),
|
||||
classFiltered: attr(),
|
||||
constraintFiltered: attr(),
|
||||
classExhausted: attr(),
|
||||
dimensionExhausted: attr(),
|
||||
quotaExhausted: attr(),
|
||||
scores: attr(),
|
||||
});
|
||||
27
ui/app/serializers/evaluation.js
Normal file
27
ui/app/serializers/evaluation.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import Ember from 'ember';
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
const { inject, get, assign } = Ember;
|
||||
|
||||
export default ApplicationSerializer.extend({
|
||||
system: inject.service(),
|
||||
|
||||
normalize(typeHash, hash) {
|
||||
hash.FailedTGAllocs = Object.keys(hash.FailedTGAllocs || {}).map(key => {
|
||||
return assign({ Name: key }, get(hash, `FailedTGAllocs.${key}`) || {});
|
||||
});
|
||||
|
||||
hash.PlainJobId = hash.JobID;
|
||||
hash.Namespace =
|
||||
hash.Namespace ||
|
||||
get(hash, 'Job.Namespace') ||
|
||||
this.get('system.activeNamespace.id') ||
|
||||
'default';
|
||||
hash.JobID = JSON.stringify([hash.JobID, hash.Namespace]);
|
||||
|
||||
// TEMPORARY: https://github.com/emberjs/data/issues/5209
|
||||
hash.OriginalJobId = hash.JobID;
|
||||
|
||||
return this._super(typeHash, hash);
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user