-
Notifications
You must be signed in to change notification settings - Fork 2k
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
UI: Server-side reschedule tracking #4254
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d50de22
New icon for showing history/paper trail
DingoEatingFuzz 0344715
Modeling alloc reschedule events
DingoEatingFuzz edb4e82
New is-faded modifier for icons
DingoEatingFuzz 5394ecf
New is-hollow modifer for boxed-sections
DingoEatingFuzz 9402108
New is-narrow modifier for slim table cells
DingoEatingFuzz 901ba35
Add shortId properties to reschedule events model
DingoEatingFuzz 8d18997
Add follow up eval relationship to allocation
DingoEatingFuzz 5db8e6d
Refactor allocation-row
DingoEatingFuzz 47a81e2
Add rescheduled icon to allocation row
DingoEatingFuzz 86b725c
New reschedule-event-row component
DingoEatingFuzz 52c5806
Add WaitUntil and followUpEvaluation
DingoEatingFuzz 5952caf
Reschedule events timeline for the alloc detail page
DingoEatingFuzz 05d095f
Mirage modeling for rescheduling
DingoEatingFuzz 80c5c16
Acceptance tests for allocation rescheduling
DingoEatingFuzz 658c842
Turn reschedule events timeline into a component for isolated testing
DingoEatingFuzz 94df7bc
Integration tests for the various reschedule events timeline permutat…
DingoEatingFuzz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,20 @@ | ||
import Component from '@ember/component'; | ||
import { computed } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default Component.extend({ | ||
store: service(), | ||
tagName: '', | ||
|
||
// When given a string, the component will fetch the allocation | ||
allocationId: null, | ||
|
||
// An allocation can also be provided directly | ||
allocation: computed('allocationId', function() { | ||
return this.get('store').findRecord('allocation', this.get('allocationId')); | ||
}), | ||
|
||
time: null, | ||
linkToAllocation: true, | ||
label: '', | ||
}); |
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 |
---|---|---|
|
@@ -23,4 +23,6 @@ export default Model.extend({ | |
job: belongsTo('job'), | ||
|
||
modifyIndex: attr('number'), | ||
|
||
waitUntil: attr('date'), | ||
}); |
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 @@ | ||
import Fragment from 'ember-data-model-fragments/fragment'; | ||
import attr from 'ember-data/attr'; | ||
import { fragmentOwner } from 'ember-data-model-fragments/attributes'; | ||
import shortUUIDProperty from '../utils/properties/short-uuid'; | ||
|
||
export default Fragment.extend({ | ||
allocation: fragmentOwner(), | ||
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. huh TIL about |
||
|
||
previousAllocationId: attr('string'), | ||
previousNodeId: attr('string'), | ||
time: attr('date'), | ||
delay: attr('string'), | ||
|
||
previousAllocationShortId: shortUUIDProperty('previousAllocationId'), | ||
previousNodeShortId: shortUUIDProperty('previousNodeShortId'), | ||
}); |
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,17 @@ | ||
import ApplicationSerializer from './application'; | ||
|
||
export default ApplicationSerializer.extend({ | ||
normalize(typeHash, hash) { | ||
// Time is in the form of nanoseconds since epoch, but JS dates | ||
// only understand time to the millisecond precision. So store | ||
// the time (precise to ms) as a date, and store the remaining ns | ||
// as a number to deal with when it comes up. | ||
hash.TimeNanos = hash.RescheduleTime % 1000000; | ||
hash.Time = Math.floor(hash.RescheduleTime / 1000000); | ||
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. 👌 nice solution |
||
|
||
hash.PreviousAllocationId = hash.PrevAllocID ? hash.PrevAllocID : null; | ||
hash.PreviousNodeId = hash.PrevNodeID ? hash.PrevNodeID : null; | ||
|
||
return this._super(typeHash, hash); | ||
}, | ||
}); |
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
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,46 @@ | ||
<li class="timeline-note"> | ||
{{#if label}} | ||
<strong data-test-reschedule-label>{{label}}</strong> | ||
{{/if}} | ||
{{moment-format time "MMMM D, YYYY HH:mm:ss"}} | ||
</li> | ||
<li class="timeline-object" data-test-allocation={{allocation.id}}> | ||
<div class="boxed-section"> | ||
{{#unless linkToAllocation}} | ||
<div class="boxed-section-head" data-test-row-heading> | ||
This Allocation | ||
</div> | ||
{{/unless}} | ||
<div class="boxed-section-body inline-definitions"> | ||
<div class="columns"> | ||
<div class="column is-centered is-minimum"> | ||
<span data-test-allocation-status class="tag {{allocation.statusClass}}"> | ||
{{allocation.clientStatus}} | ||
</span> | ||
</div> | ||
<div class="column"> | ||
<div class="boxed-section-row"> | ||
<span class="pair"> | ||
<span class="term">Allocation</span> | ||
{{#if linkToAllocation}} | ||
{{#link-to "allocations.allocation" allocation.id}} | ||
<code data-test-allocation-link>{{allocation.shortId}}</code> | ||
{{/link-to}} | ||
{{else}} | ||
<code data-test-allocation-link>{{allocation.shortId}}</code> | ||
{{/if}} | ||
</span> | ||
<span class="pair"> | ||
<span class="term">Client</span> | ||
<span> | ||
{{#link-to "clients.client" data-test-node-link allocation.node.id}} | ||
<code>{{allocation.node.id}}</code> | ||
{{/link-to}} | ||
</span> | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</li> |
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,29 @@ | ||
<ol class="timeline"> | ||
{{#if allocation.nextAllocation}} | ||
{{reschedule-event-row | ||
label="Next Allocation" | ||
allocation=allocation.nextAllocation | ||
time=allocation.nextAllocation.modifyTime}} | ||
{{/if}} | ||
{{#if allocation.hasStoppedRescheduling}} | ||
<li class="timeline-note" data-test-stop-warning> | ||
{{x-icon "warning" class="is-warning is-text"}} Nomad has stopped attempting to reschedule this allocation. | ||
</li> | ||
{{/if}} | ||
{{#if (and allocation.followUpEvaluation.waitUntil (not allocation.nextAllocation))}} | ||
<li class="timeline-note" data-test-attempt-notice> | ||
{{x-icon "clock" class="is-info is-text"}} Nomad will attempt to reschedule | ||
{{moment-from-now allocation.followUpEvaluation.waitUntil interval=1000}} | ||
</li> | ||
{{/if}} | ||
{{reschedule-event-row | ||
allocation=allocation | ||
linkToAllocation=false | ||
time=allocation.modifyTime}} | ||
|
||
{{#each (reverse allocation.rescheduleEvents) as |event|}} | ||
{{reschedule-event-row | ||
allocationId=event.previousAllocationId | ||
time=event.time}} | ||
{{/each}} | ||
</ol> |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do you want this as a string and then parse it out when you need to use it? Fine if the answer is "no", just wanted to call out that date parsing on models is (unless they changed that recently) eager (which could be totally fine here).
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.
I've been trying to do the things the expected way until it becomes a problem. Since evaluations don't get loaded by the thousands, I think this is okay here.