Skip to content

Commit

Permalink
Revert "dont hard code scheduler type name"
Browse files Browse the repository at this point in the history
This reverts commit fb0e0df.
  • Loading branch information
dadgar committed Oct 23, 2015
1 parent fb0e0df commit 4718a05
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion nomad/node_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func (n *Node) createNodeEvals(nodeID string, nodeIndex uint64) ([]string, uint6
return nil, 0, fmt.Errorf("failed to find allocs for '%s': %v", nodeID, err)
}

sysJobsIter, err := snap.JobsByScheduler(structs.JobTypeSystem)
sysJobsIter, err := snap.JobsByScheduler("system")
if err != nil {
return nil, 0, fmt.Errorf("failed to find system jobs for '%s': %v", nodeID, err)
}
Expand Down
6 changes: 3 additions & 3 deletions nomad/node_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ func TestClientEndpoint_UpdateStatus_GetEvals(t *testing.T) {
t.Fatalf("could not get eval %v", evalID)
}

if eval.Type != structs.JobTypeSystem {
t.Fatalf("unexpected eval type; got %v; want %q", eval.Type, structs.JobTypeSystem)
if eval.Type != "system" {
t.Fatalf("unexpected eval type; got %v; want %q", eval.Type, "system")
}

// Check for heartbeat interval
Expand Down Expand Up @@ -605,7 +605,7 @@ func TestClientEndpoint_CreateNodeEvals(t *testing.T) {
for schedType, eval := range evalByType {
expPriority := alloc.Job.Priority
expJobID := alloc.JobID
if schedType == structs.JobTypeSystem {
if schedType == "system" {
expPriority = job.Priority
expJobID = job.ID
}
Expand Down
2 changes: 1 addition & 1 deletion nomad/state/state_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func TestStateStore_JobsByScheduler(t *testing.T) {
outService = append(outService, raw.(*structs.Job))
}

iter, err = state.JobsByScheduler(structs.JobTypeSystem)
iter, err = state.JobsByScheduler("system")
if err != nil {
t.Fatalf("err: %v", err)
}
Expand Down
3 changes: 1 addition & 2 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/hashicorp/go-msgpack/codec"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/go-version"
"github.com/hashicorp/nomad/nomad/structs"
)

var (
Expand Down Expand Up @@ -831,7 +830,7 @@ func (j *Job) Validate() error {
taskGroups[tg.Name] = idx
}

if j.Type == structs.JobTypeSystem && tg.Count != 1 {
if j.Type == "system" && tg.Count != 1 {
mErr.Errors = append(mErr.Errors,
fmt.Errorf("Job task group %d has count %d. Only count of 1 is supported with system scheduler",
idx+1, tg.Count))
Expand Down
6 changes: 3 additions & 3 deletions scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
// BuiltinSchedulers contains the built in registered schedulers
// which are available
var BuiltinSchedulers = map[string]Factory{
structs.JobTypeService: NewServiceScheduler,
structs.JobTypeBatch: NewBatchScheduler,
structs.JobTypeSystem: NewSystemScheduler,
"service": NewServiceScheduler,
"batch": NewBatchScheduler,
"system": NewSystemScheduler,
}

// NewScheduler is used to instantiate and return a new scheduler
Expand Down

0 comments on commit 4718a05

Please sign in to comment.