Populating service ids only if allocations can be placed for system jobs

This commit is contained in:
Diptanu Choudhury
2015-12-15 08:38:18 -08:00
parent 962bdf744d
commit fa5beb7fe5
2 changed files with 5 additions and 5 deletions

View File

@@ -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())
}

View File

@@ -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