Commit 141ecd8d authored by Michael Lange's avatar Michael Lange
Browse files

Models evaluation data

parent e369a9a9
Showing with 74 additions and 0 deletions
+74 -0
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'),
});
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(),
});
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);
},
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment