commit
f07cd17590
|
@ -206,7 +206,7 @@ func formatJobDiff(job *api.JobDiff, verbose bool) string {
|
||||||
out := fmt.Sprintf("%s[bold]Job: %q\n", marker, job.ID)
|
out := fmt.Sprintf("%s[bold]Job: %q\n", marker, job.ID)
|
||||||
|
|
||||||
// Determine the longest markers and fields so that the output can be
|
// Determine the longest markers and fields so that the output can be
|
||||||
// properly alligned.
|
// properly aligned.
|
||||||
longestField, longestMarker := getLongestPrefixes(job.Fields, job.Objects)
|
longestField, longestMarker := getLongestPrefixes(job.Fields, job.Objects)
|
||||||
for _, tg := range job.TaskGroups {
|
for _, tg := range job.TaskGroups {
|
||||||
if _, l := getDiffString(tg.Type); l > longestMarker {
|
if _, l := getDiffString(tg.Type); l > longestMarker {
|
||||||
|
@ -275,7 +275,7 @@ func formatTaskGroupDiff(tg *api.TaskGroupDiff, tgPrefix int, verbose bool) stri
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the longest field and markers so the output is properly
|
// Determine the longest field and markers so the output is properly
|
||||||
// alligned
|
// aligned
|
||||||
longestField, longestMarker := getLongestPrefixes(tg.Fields, tg.Objects)
|
longestField, longestMarker := getLongestPrefixes(tg.Fields, tg.Objects)
|
||||||
for _, task := range tg.Tasks {
|
for _, task := range tg.Tasks {
|
||||||
if _, l := getDiffString(task.Type); l > longestMarker {
|
if _, l := getDiffString(task.Type); l > longestMarker {
|
||||||
|
@ -307,7 +307,7 @@ func formatTaskGroupDiff(tg *api.TaskGroupDiff, tgPrefix int, verbose bool) stri
|
||||||
// formatTaskDiff produces an annotated diff of a task. If the verbose field is
|
// formatTaskDiff produces an annotated diff of a task. If the verbose field is
|
||||||
// set, the tasks fields and objects are expanded even if the full object is an
|
// set, the tasks fields and objects are expanded even if the full object is an
|
||||||
// addition or removal. startPrefix is the number of spaces to prefix the output of
|
// addition or removal. startPrefix is the number of spaces to prefix the output of
|
||||||
// the task and taskPrefix is the number of spaces to put betwen the marker and
|
// the task and taskPrefix is the number of spaces to put between the marker and
|
||||||
// task name output.
|
// task name output.
|
||||||
func formatTaskDiff(task *api.TaskDiff, startPrefix, taskPrefix int, verbose bool) string {
|
func formatTaskDiff(task *api.TaskDiff, startPrefix, taskPrefix int, verbose bool) string {
|
||||||
marker, _ := getDiffString(task.Type)
|
marker, _ := getDiffString(task.Type)
|
||||||
|
@ -334,7 +334,7 @@ func formatTaskDiff(task *api.TaskDiff, startPrefix, taskPrefix int, verbose boo
|
||||||
|
|
||||||
// formatObjectDiff produces an annotated diff of an object. startPrefix is the
|
// formatObjectDiff produces an annotated diff of an object. startPrefix is the
|
||||||
// number of spaces to prefix the output of the object and keyPrefix is the number
|
// number of spaces to prefix the output of the object and keyPrefix is the number
|
||||||
// of spaces to put betwen the marker and object name output.
|
// of spaces to put between the marker and object name output.
|
||||||
func formatObjectDiff(diff *api.ObjectDiff, startPrefix, keyPrefix int) string {
|
func formatObjectDiff(diff *api.ObjectDiff, startPrefix, keyPrefix int) string {
|
||||||
start := strings.Repeat(" ", startPrefix)
|
start := strings.Repeat(" ", startPrefix)
|
||||||
marker, _ := getDiffString(diff.Type)
|
marker, _ := getDiffString(diff.Type)
|
||||||
|
@ -350,7 +350,7 @@ func formatObjectDiff(diff *api.ObjectDiff, startPrefix, keyPrefix int) string {
|
||||||
|
|
||||||
// formatFieldDiff produces an annotated diff of a field. startPrefix is the
|
// formatFieldDiff produces an annotated diff of a field. startPrefix is the
|
||||||
// number of spaces to prefix the output of the field, keyPrefix is the number
|
// number of spaces to prefix the output of the field, keyPrefix is the number
|
||||||
// of spaces to put betwen the marker and field name output and valuePrefix is
|
// of spaces to put between the marker and field name output and valuePrefix is
|
||||||
// the number of spaces to put infront of the value for aligning values.
|
// the number of spaces to put infront of the value for aligning values.
|
||||||
func formatFieldDiff(diff *api.FieldDiff, startPrefix, keyPrefix, valuePrefix int) string {
|
func formatFieldDiff(diff *api.FieldDiff, startPrefix, keyPrefix, valuePrefix int) string {
|
||||||
marker, _ := getDiffString(diff.Type)
|
marker, _ := getDiffString(diff.Type)
|
||||||
|
|
|
@ -128,7 +128,7 @@ func (b *BlockedEvals) Block(eval *structs.Evaluation) {
|
||||||
|
|
||||||
// Reblock tracks the passed evaluation and enqueues it into the eval broker when
|
// Reblock tracks the passed evaluation and enqueues it into the eval broker when
|
||||||
// a suitable node calls unblock. Reblock should be used over Block when the
|
// a suitable node calls unblock. Reblock should be used over Block when the
|
||||||
// blocking is occuring by an outstanding evaluation. The token is the
|
// blocking is occurring by an outstanding evaluation. The token is the
|
||||||
// evaluation's token.
|
// evaluation's token.
|
||||||
func (b *BlockedEvals) Reblock(eval *structs.Evaluation, token string) {
|
func (b *BlockedEvals) Reblock(eval *structs.Evaluation, token string) {
|
||||||
b.processBlock(eval, token)
|
b.processBlock(eval, token)
|
||||||
|
@ -245,7 +245,7 @@ func (b *BlockedEvals) Unblock(computedClass string, index uint64) {
|
||||||
|
|
||||||
// Store the index in which the unblock happened. We use this on subsequent
|
// Store the index in which the unblock happened. We use this on subsequent
|
||||||
// block calls in case the evaluation was in the scheduler when a trigger
|
// block calls in case the evaluation was in the scheduler when a trigger
|
||||||
// occured.
|
// occurred.
|
||||||
b.unblockIndexes[computedClass] = index
|
b.unblockIndexes[computedClass] = index
|
||||||
b.l.Unlock()
|
b.l.Unlock()
|
||||||
|
|
||||||
|
|
|
@ -291,7 +291,7 @@ func TestBlockedEvals_Block_ImmediateUnblock_Escaped(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the block case in which the eval should be immediately unblocked since
|
// Test the block case in which the eval should be immediately unblocked since
|
||||||
// there is an unblock on an unseen class that occured while it was in the
|
// there is an unblock on an unseen class that occurred while it was in the
|
||||||
// scheduler
|
// scheduler
|
||||||
func TestBlockedEvals_Block_ImmediateUnblock_UnseenClass_After(t *testing.T) {
|
func TestBlockedEvals_Block_ImmediateUnblock_UnseenClass_After(t *testing.T) {
|
||||||
blocked, broker := testBlockedEvals(t)
|
blocked, broker := testBlockedEvals(t)
|
||||||
|
@ -327,7 +327,7 @@ func TestBlockedEvals_Block_ImmediateUnblock_UnseenClass_After(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the block case in which the eval should not immediately unblock since
|
// Test the block case in which the eval should not immediately unblock since
|
||||||
// there is an unblock on an unseen class that occured before it was in the
|
// there is an unblock on an unseen class that occurred before it was in the
|
||||||
// scheduler
|
// scheduler
|
||||||
func TestBlockedEvals_Block_ImmediateUnblock_UnseenClass_Before(t *testing.T) {
|
func TestBlockedEvals_Block_ImmediateUnblock_UnseenClass_Before(t *testing.T) {
|
||||||
blocked, _ := testBlockedEvals(t)
|
blocked, _ := testBlockedEvals(t)
|
||||||
|
|
|
@ -373,7 +373,7 @@ OUTER:
|
||||||
|
|
||||||
// If there are any non-terminal allocations, skip the node. If the node
|
// If there are any non-terminal allocations, skip the node. If the node
|
||||||
// is terminal and the allocations are not, the scheduler may not have
|
// is terminal and the allocations are not, the scheduler may not have
|
||||||
// run yet to transistion the allocs on the node to terminal. We delay
|
// run yet to transition the allocs on the node to terminal. We delay
|
||||||
// GC'ing until this happens.
|
// GC'ing until this happens.
|
||||||
for _, alloc := range allocs {
|
for _, alloc := range allocs {
|
||||||
if !alloc.TerminalStatus() {
|
if !alloc.TerminalStatus() {
|
||||||
|
|
|
@ -84,9 +84,9 @@ func diffAllocs(job *structs.Job, taintedNodes map[string]bool,
|
||||||
// If we are on a tainted node, we must migrate if we are a service or
|
// If we are on a tainted node, we must migrate if we are a service or
|
||||||
// if the batch allocation did not finish
|
// if the batch allocation did not finish
|
||||||
if taintedNodes[exist.NodeID] {
|
if taintedNodes[exist.NodeID] {
|
||||||
// If the job is batch and finished succesfully, the fact that the
|
// If the job is batch and finished successfully, the fact that the
|
||||||
// node is tainted does not mean it should be migrated as the work
|
// node is tainted does not mean it should be migrated as the work
|
||||||
// was already succesfully finished. However for service/system
|
// was already successfully finished. However for service/system
|
||||||
// jobs, tasks should never complete. The check of batch type,
|
// jobs, tasks should never complete. The check of batch type,
|
||||||
// defends against client bugs.
|
// defends against client bugs.
|
||||||
if exist.Job.Type == structs.JobTypeBatch && exist.RanSuccessfully() {
|
if exist.Job.Type == structs.JobTypeBatch && exist.RanSuccessfully() {
|
||||||
|
|
Loading…
Reference in a new issue