From fa5beb7fe5e7d2b34b86dec616129cac94572e0a Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Tue, 15 Dec 2015 08:38:18 -0800 Subject: [PATCH] Populating service ids only if allocations can be placed for system jobs --- nomad/structs/structs.go | 2 +- scheduler/system_sched.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index b8f3ddaae..722319901 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -1508,7 +1508,7 @@ func (a *Allocation) PopulateServiceIDs() { for _, task := range tg.Tasks { for _, service := range task.Services { // We add a prefix to the Service ID so that we can know that this service - // is managed by Nomad Consul since Consul can also have service which are not + // is managed by Nomad since Consul can also have service which are not // managed by Nomad a.Services[service.Name] = fmt.Sprintf("%s-%s", NomadConsulPrefix, GenerateUUID()) } diff --git a/scheduler/system_sched.go b/scheduler/system_sched.go index 42370b8fd..80a87fe94 100644 --- a/scheduler/system_sched.go +++ b/scheduler/system_sched.go @@ -246,12 +246,12 @@ func (s *SystemScheduler) computePlacements(place []allocTuple) error { Metrics: s.ctx.Metrics(), } - // Generate the service ids for the tasks that this allocation is going - // to run - alloc.PopulateServiceIDs() - // Set fields based on if we found an allocation option if option != nil { + // Generate the service ids for the tasks that this allocation is going + // to run + alloc.PopulateServiceIDs() + alloc.NodeID = option.Node.ID alloc.TaskResources = option.TaskResources alloc.DesiredStatus = structs.AllocDesiredStatusRun