-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added task links to various alloc tables (#14592)
* Added task links to various alloc tables * Lintfix * Border collapse and added to task group page * Logs icon temporarily removed and localStorage added * Mock task added to test * Delog * Two asserts in new test * Remove commented-out code * Changelog * Removing args.allocation deps
- Loading branch information
1 parent
1a4e3a7
commit 0358bd0
Showing
16 changed files
with
329 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
ui: allow deep-dive clicks to tasks from client, job, and task group routes. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<tr class="task-sub-row" | ||
{{keyboard-shortcut | ||
enumerated=true | ||
action=(action "gotoTask" this.task.allocation this.task) | ||
}} | ||
> | ||
<td colspan={{@namespan}}> | ||
/ | ||
<LinkTo @route="allocations.allocation.task" @models={{array this.task.allocation this.task}}> | ||
{{this.task.name}} | ||
</LinkTo> | ||
{{!-- TODO: in-page logs --}} | ||
{{!-- <FlightIcon @name="logs" /> --}} | ||
</td> | ||
<td data-test-cpu class="is-1 has-text-centered"> | ||
{{#if this.task.isRunning}} | ||
{{#if (and (not this.cpu) this.fetchStats.isRunning)}} | ||
... | ||
{{else if this.statsError}} | ||
<span | ||
class="tooltip text-center" | ||
role="tooltip" | ||
aria-label="Couldn't collect stats" | ||
> | ||
{{x-icon "alert-triangle" class="is-warning"}} | ||
</span> | ||
{{else}} | ||
<div | ||
class="inline-chart is-small tooltip" | ||
role="tooltip" | ||
aria-label="{{format-hertz this.cpu.used}} | ||
/ | ||
{{format-hertz this.taskStats.reservedCPU}}" | ||
> | ||
<progress | ||
class="progress is-info is-small" | ||
value="{{this.cpu.percent}}" | ||
max="1" | ||
> | ||
{{this.cpu.percent}} | ||
</progress> | ||
</div> | ||
{{/if}} | ||
{{/if}} | ||
</td> | ||
<td data-test-mem class="is-1 has-text-centered"> | ||
{{#if this.task.isRunning}} | ||
{{#if (and (not this.memory) this.fetchStats.isRunning)}} | ||
... | ||
{{else if this.statsError}} | ||
<span | ||
class="tooltip is-small text-center" | ||
role="tooltip" | ||
aria-label="Couldn't collect stats" | ||
> | ||
{{x-icon "alert-triangle" class="is-warning"}} | ||
</span> | ||
{{else}} | ||
<div | ||
class="inline-chart tooltip" | ||
role="tooltip" | ||
aria-label="{{format-bytes this.memory.used}} | ||
/ | ||
{{format-bytes this.taskStats.reservedMemory start="MiB"}}" | ||
> | ||
<progress | ||
class="progress is-danger is-small" | ||
value="{{this.memory.percent}}" | ||
max="1" | ||
> | ||
{{this.memory.percent}} | ||
</progress> | ||
</div> | ||
{{/if}} | ||
{{/if}} | ||
</td> | ||
</tr> | ||
|
||
{{yield}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import Ember from 'ember'; | ||
import Component from '@glimmer/component'; | ||
import { inject as service } from '@ember/service'; | ||
import { action } from '@ember/object'; | ||
import { computed } from '@ember/object'; | ||
import { alias } from '@ember/object/computed'; | ||
import { task, timeout } from 'ember-concurrency'; | ||
import { tracked } from '@glimmer/tracking'; | ||
|
||
export default class TaskSubRowComponent extends Component { | ||
@service store; | ||
@service router; | ||
@service('stats-trackers-registry') statsTrackersRegistry; | ||
|
||
constructor() { | ||
super(...arguments); | ||
// Kick off stats polling | ||
const allocation = this.task.allocation; | ||
if (allocation) { | ||
this.fetchStats.perform(); | ||
} else { | ||
this.fetchStats.cancelAll(); | ||
} | ||
} | ||
|
||
@alias('args.taskState') task; | ||
|
||
@action | ||
gotoTask(allocation, task) { | ||
this.router.transitionTo('allocations.allocation.task', allocation, task); | ||
} | ||
|
||
// Since all tasks for an allocation share the same tracker, use the registry | ||
@computed('task.{allocation,isRunning}') | ||
get stats() { | ||
if (!this.task.isRunning) return undefined; | ||
|
||
return this.statsTrackersRegistry.getTracker(this.task.allocation); | ||
} | ||
|
||
// Internal state | ||
@tracked statsError = false; | ||
|
||
@computed | ||
get enablePolling() { | ||
return !Ember.testing; | ||
} | ||
|
||
@computed('task.name', 'stats.tasks.[]') | ||
get taskStats() { | ||
if (!this.stats) return undefined; | ||
|
||
return this.stats.tasks.findBy('task', this.task.name); | ||
} | ||
|
||
@alias('taskStats.cpu.lastObject') cpu; | ||
@alias('taskStats.memory.lastObject') memory; | ||
|
||
@(task(function* () { | ||
do { | ||
if (this.stats) { | ||
try { | ||
yield this.stats.poll.linked().perform(); | ||
this.statsError = false; | ||
} catch (error) { | ||
this.statsError = true; | ||
} | ||
} | ||
|
||
yield timeout(500); | ||
} while (this.enablePolling); | ||
}).drop()) | ||
fetchStats; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
table tbody .task-sub-row { | ||
td { | ||
border-top: 2px solid white; | ||
} | ||
td:nth-child(1) { | ||
padding-left: 4rem; | ||
a { | ||
margin-right: 1rem; | ||
} | ||
|
||
svg.flight-icon { | ||
position: relative; | ||
top: 3px; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.