diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index d94a51143..fcd487a0d 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -680,6 +680,9 @@ type Allocation struct { JobID string Job *Job + // TaskGroup is the name of the task group that should be run + TaskGroup string + // Resources is the set of resources allocated as part // of this allocation of the task group. Resources *Resources diff --git a/scheduler/generic_sched.go b/scheduler/generic_sched.go index 08049ad7d..2d40b3f51 100644 --- a/scheduler/generic_sched.go +++ b/scheduler/generic_sched.go @@ -254,6 +254,7 @@ func (s *GenericScheduler) computePlacements(job *structs.Job, place []allocTupl NodeID: nodeID, JobID: job.ID, Job: job, + TaskGroup: missing.TaskGroup.Name, Resources: size, Metrics: ctx.Metrics(), Status: status, diff --git a/scheduler/generic_sched_test.go b/scheduler/generic_sched_test.go index 30666cb3e..3a01fb849 100644 --- a/scheduler/generic_sched_test.go +++ b/scheduler/generic_sched_test.go @@ -184,8 +184,9 @@ func TestServiceSched_JobModify(t *testing.T) { noErr(t, err) // Ensure all allocations placed + out = structs.FilterTerminalAllocs(out) if len(out) != 10 { - t.Fatalf("bad: %#v", out) + t.Fatalf("bad: %d %#v", out) } h.AssertEvalStatus(t, structs.EvalStatusComplete) @@ -236,6 +237,7 @@ func TestServiceSched_JobDeregister(t *testing.T) { noErr(t, err) // Ensure no remaining allocations + out = structs.FilterTerminalAllocs(out) if len(out) != 0 { t.Fatalf("bad: %#v", out) } @@ -311,6 +313,7 @@ func TestServiceSched_NodeDrain(t *testing.T) { noErr(t, err) // Ensure all allocations placed + out = structs.FilterTerminalAllocs(out) if len(out) != 10 { t.Fatalf("bad: %#v", out) }