Add job version to allocation tables

This commit is contained in:
Michael Lange 2017-10-18 12:29:33 -07:00
parent 721905b628
commit 8c6c54ff07
7 changed files with 36 additions and 15 deletions

View file

@ -26,6 +26,7 @@ export default Model.extend({
taskGroupName: attr('string'), taskGroupName: attr('string'),
resources: fragment('resources'), resources: fragment('resources'),
modifyIndex: attr('number'), modifyIndex: attr('number'),
jobVersion: attr('number'),
// TEMPORARY: https://github.com/emberjs/data/issues/5209 // TEMPORARY: https://github.com/emberjs/data/issues/5209
originalJobId: attr('string'), originalJobId: attr('string'),

View file

@ -9,6 +9,7 @@
<span class="color-swatch {{allocation.clientStatus}}" /> {{allocation.clientStatus}} <span class="color-swatch {{allocation.clientStatus}}" /> {{allocation.clientStatus}}
</td> </td>
{{#if (eq context "job")}} {{#if (eq context "job")}}
<td>{{allocation.jobVersion}}</td>
<td><a href="{{href-to "nodes.node" allocation.node}}">{{allocation.node.shortId}}</a></td> <td><a href="{{href-to "nodes.node" allocation.node}}">{{allocation.node.shortId}}</a></td>
{{else if (eq context "node")}} {{else if (eq context "node")}}
<td> <td>
@ -19,6 +20,7 @@
<span class="is-faded">/ {{allocation.taskGroup.name}}</span> <span class="is-faded">/ {{allocation.taskGroup.name}}</span>
{{/if}} {{/if}}
</td> </td>
<td>{{allocation.jobVersion}}</td>
{{/if}} {{/if}}
<td class="has-text-centered"> <td class="has-text-centered">
{{#if allocation.stats.isPending}} {{#if allocation.stats.isPending}}

View file

@ -71,6 +71,7 @@
{{#t.sort-by prop="modifyIndex" title="Modify Index"}}Modified{{/t.sort-by}} {{#t.sort-by prop="modifyIndex" title="Modify Index"}}Modified{{/t.sort-by}}
{{#t.sort-by prop="name"}}Name{{/t.sort-by}} {{#t.sort-by prop="name"}}Name{{/t.sort-by}}
{{#t.sort-by prop="statusIndex"}}Status{{/t.sort-by}} {{#t.sort-by prop="statusIndex"}}Status{{/t.sort-by}}
{{#t.sort-by prop="jobVersion"}}Version{{/t.sort-by}}
{{#t.sort-by prop="node.shortId"}}Node{{/t.sort-by}} {{#t.sort-by prop="node.shortId"}}Node{{/t.sort-by}}
<th>CPU</th> <th>CPU</th>
<th>Memory</th> <th>Memory</th>

View file

@ -44,6 +44,7 @@
{{#t.sort-by prop="name"}}Name{{/t.sort-by}} {{#t.sort-by prop="name"}}Name{{/t.sort-by}}
{{#t.sort-by prop="statusIndex"}}Status{{/t.sort-by}} {{#t.sort-by prop="statusIndex"}}Status{{/t.sort-by}}
{{#t.sort-by prop="job.name"}}Job{{/t.sort-by}} {{#t.sort-by prop="job.name"}}Job{{/t.sort-by}}
{{#t.sort-by prop="jobVersion"}}Version{{/t.sort-by}}
<th>CPU</th> <th>CPU</th>
<th>Memory</th> <th>Memory</th>
{{/t.head}} {{/t.head}}

View file

@ -10,6 +10,7 @@ export default Factory.extend({
id: i => (i >= 100 ? `${UUIDS[i % 100]}-${i}` : UUIDS[i]), id: i => (i >= 100 ? `${UUIDS[i % 100]}-${i}` : UUIDS[i]),
modifyIndex: () => faker.random.number({ min: 10, max: 2000 }), modifyIndex: () => faker.random.number({ min: 10, max: 2000 }),
jobVersion: () => faker.random.number(10),
clientStatus: faker.list.random(...CLIENT_STATUSES), clientStatus: faker.list.random(...CLIENT_STATUSES),
desiredStatus: faker.list.random(...DESIRED_STATUSES), desiredStatus: faker.list.random(...DESIRED_STATUSES),

View file

@ -160,29 +160,36 @@ test('each allocation should have high-level details for the allocation', functi
.includes(allocation.taskGroup), .includes(allocation.taskGroup),
'Task group name' 'Task group name'
); );
assert.equal( assert.ok(
allocationRow allocationRow
.find('td:eq(5)') .find('td:eq(5)')
.text() .text()
.trim(), .includes(allocation.jobVersion),
allocStats.resourceUsage.CpuStats.Percent, 'Job Version'
'CPU %'
);
assert.equal(
allocationRow.find('td:eq(5) .tooltip').attr('aria-label'),
`${Math.floor(allocStats.resourceUsage.CpuStats.TotalTicks)} / ${cpuUsed} MHz`,
'Detailed CPU information is in a tooltip'
); );
assert.equal( assert.equal(
allocationRow allocationRow
.find('td:eq(6)') .find('td:eq(6)')
.text() .text()
.trim(), .trim(),
allocStats.resourceUsage.CpuStats.Percent,
'CPU %'
);
assert.equal(
allocationRow.find('td:eq(6) .tooltip').attr('aria-label'),
`${Math.floor(allocStats.resourceUsage.CpuStats.TotalTicks)} / ${cpuUsed} MHz`,
'Detailed CPU information is in a tooltip'
);
assert.equal(
allocationRow
.find('td:eq(7)')
.text()
.trim(),
allocStats.resourceUsage.MemoryStats.RSS / 1024 / 1024 / memoryUsed, allocStats.resourceUsage.MemoryStats.RSS / 1024 / 1024 / memoryUsed,
'Memory used' 'Memory used'
); );
assert.equal( assert.equal(
allocationRow.find('td:eq(6) .tooltip').attr('aria-label'), allocationRow.find('td:eq(7) .tooltip').attr('aria-label'),
`${formatBytes([allocStats.resourceUsage.MemoryStats.RSS])} / ${memoryUsed} MiB`, `${formatBytes([allocStats.resourceUsage.MemoryStats.RSS])} / ${memoryUsed} MiB`,
'Detailed memory information is in a tooltip' 'Detailed memory information is in a tooltip'
); );

View file

@ -181,12 +181,20 @@ test('each allocation should show basic information about the allocation', funct
.find('td:eq(4)') .find('td:eq(4)')
.text() .text()
.trim(), .trim(),
allocation.jobVersion,
'Job Version'
);
assert.equal(
allocationRow
.find('td:eq(5)')
.text()
.trim(),
server.db.nodes.find(allocation.nodeId).id.split('-')[0], server.db.nodes.find(allocation.nodeId).id.split('-')[0],
'Node ID' 'Node ID'
); );
}); });
click(allocationRow.find('td:eq(4) a').get(0)); click(allocationRow.find('td:eq(5) a').get(0));
andThen(() => { andThen(() => {
assert.equal(currentURL(), `/nodes/${allocation.nodeId}`, 'Node links to node page'); assert.equal(currentURL(), `/nodes/${allocation.nodeId}`, 'Node links to node page');
@ -206,7 +214,7 @@ test('each allocation should show stats about the allocation, retrieved directly
assert.equal( assert.equal(
allocationRow allocationRow
.find('td:eq(5)') .find('td:eq(6)')
.text() .text()
.trim(), .trim(),
allocStats.resourceUsage.CpuStats.Percent, allocStats.resourceUsage.CpuStats.Percent,
@ -214,14 +222,14 @@ test('each allocation should show stats about the allocation, retrieved directly
); );
assert.equal( assert.equal(
allocationRow.find('td:eq(5) .tooltip').attr('aria-label'), allocationRow.find('td:eq(6) .tooltip').attr('aria-label'),
`${Math.floor(allocStats.resourceUsage.CpuStats.TotalTicks)} / ${cpuUsed} MHz`, `${Math.floor(allocStats.resourceUsage.CpuStats.TotalTicks)} / ${cpuUsed} MHz`,
'Detailed CPU information is in a tooltip' 'Detailed CPU information is in a tooltip'
); );
assert.equal( assert.equal(
allocationRow allocationRow
.find('td:eq(6)') .find('td:eq(7)')
.text() .text()
.trim(), .trim(),
allocStats.resourceUsage.MemoryStats.RSS / 1024 / 1024 / memoryUsed, allocStats.resourceUsage.MemoryStats.RSS / 1024 / 1024 / memoryUsed,
@ -229,7 +237,7 @@ test('each allocation should show stats about the allocation, retrieved directly
); );
assert.equal( assert.equal(
allocationRow.find('td:eq(6) .tooltip').attr('aria-label'), allocationRow.find('td:eq(7) .tooltip').attr('aria-label'),
`${formatBytes([allocStats.resourceUsage.MemoryStats.RSS])} / ${memoryUsed} MiB`, `${formatBytes([allocStats.resourceUsage.MemoryStats.RSS])} / ${memoryUsed} MiB`,
'Detailed memory information is in a tooltip' 'Detailed memory information is in a tooltip'
); );