-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added task links to various alloc tables #14592
Changes from all commits
93db90f
a7ef447
879bdb9
4d9c28a
313952c
92b52e9
6d56860
409b6e9
cf425e8
b1eac60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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. | ||
``` |
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" /> --}} | ||
Comment on lines
+12
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, commented here: #14592 (review) |
||
</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}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import Ember from 'ember'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of this is largely ported from |
||
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(); | ||
} | ||
} | ||
Comment on lines
+15
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep; inherited from our other stats fetchers, like task-row. On unmount, or even on hide, this will stop its stats polling. |
||
|
||
@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; | ||
} |
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; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,10 @@ | |
} | ||
} | ||
|
||
&.with-collapsed-borders { | ||
border-collapse: collapse; | ||
} | ||
Comment on lines
+44
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
&.is-darkened { | ||
tbody tr:not(.is-selected) { | ||
background-color: $white-bis; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(very temporary) placeholder: covered in #14579