Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
09b90e49
Commit
09b90e49
authored
7 years ago
by
Alex Dadgar
Browse files
Options
Download
Email Patches
Plain Diff
Actually disable the schedulers
parent
b6e0ceff
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
command/agent/agent.go
+2
-2
command/agent/agent.go
command/agent/alloc_endpoint_test.go
+2
-1
command/agent/alloc_endpoint_test.go
command/agent/config.go
+3
-3
command/agent/config.go
command/agent/config_parse_test.go
+1
-1
command/agent/config_parse_test.go
command/agent/config_test.go
+2
-2
command/agent/config_test.go
with
10 additions
and
9 deletions
+10
-9
command/agent/agent.go
+
2
-
2
View file @
09b90e49
...
@@ -144,8 +144,8 @@ func convertServerConfig(agentConfig *Config, logOutput io.Writer) (*nomad.Confi
...
@@ -144,8 +144,8 @@ func convertServerConfig(agentConfig *Config, logOutput io.Writer) (*nomad.Confi
if
agentConfig
.
Server
.
RaftProtocol
!=
0
{
if
agentConfig
.
Server
.
RaftProtocol
!=
0
{
conf
.
RaftConfig
.
ProtocolVersion
=
raft
.
ProtocolVersion
(
agentConfig
.
Server
.
RaftProtocol
)
conf
.
RaftConfig
.
ProtocolVersion
=
raft
.
ProtocolVersion
(
agentConfig
.
Server
.
RaftProtocol
)
}
}
if
agentConfig
.
Server
.
NumSchedulers
!=
0
{
if
agentConfig
.
Server
.
NumSchedulers
!=
nil
{
conf
.
NumSchedulers
=
agentConfig
.
Server
.
NumSchedulers
conf
.
NumSchedulers
=
*
agentConfig
.
Server
.
NumSchedulers
}
}
if
len
(
agentConfig
.
Server
.
EnabledSchedulers
)
!=
0
{
if
len
(
agentConfig
.
Server
.
EnabledSchedulers
)
!=
0
{
// Convert to a set and require the core scheduler
// Convert to a set and require the core scheduler
...
...
This diff is collapsed.
Click to expand it.
command/agent/alloc_endpoint_test.go
+
2
-
1
View file @
09b90e49
...
@@ -15,6 +15,7 @@ import (
...
@@ -15,6 +15,7 @@ import (
"github.com/golang/snappy"
"github.com/golang/snappy"
"github.com/hashicorp/nomad/acl"
"github.com/hashicorp/nomad/acl"
"github.com/hashicorp/nomad/client/allocdir"
"github.com/hashicorp/nomad/client/allocdir"
"github.com/hashicorp/nomad/helper"
"github.com/hashicorp/nomad/helper/uuid"
"github.com/hashicorp/nomad/helper/uuid"
"github.com/hashicorp/nomad/nomad/mock"
"github.com/hashicorp/nomad/nomad/mock"
"github.com/hashicorp/nomad/nomad/structs"
"github.com/hashicorp/nomad/nomad/structs"
...
@@ -437,7 +438,7 @@ func TestHTTP_AllocSnapshot_Atomic(t *testing.T) {
...
@@ -437,7 +438,7 @@ func TestHTTP_AllocSnapshot_Atomic(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
httpTest
(
t
,
func
(
c
*
Config
)
{
httpTest
(
t
,
func
(
c
*
Config
)
{
// Disable the schedulers
// Disable the schedulers
c
.
Server
.
NumSchedulers
=
0
c
.
Server
.
NumSchedulers
=
helper
.
IntToPtr
(
0
)
},
func
(
s
*
TestAgent
)
{
},
func
(
s
*
TestAgent
)
{
// Create an alloc
// Create an alloc
state
:=
s
.
server
.
State
()
state
:=
s
.
server
.
State
()
...
...
This diff is collapsed.
Click to expand it.
command/agent/config.go
+
3
-
3
View file @
09b90e49
...
@@ -268,7 +268,7 @@ type ServerConfig struct {
...
@@ -268,7 +268,7 @@ type ServerConfig struct {
// NumSchedulers is the number of scheduler thread that are run.
// NumSchedulers is the number of scheduler thread that are run.
// This can be as many as one per core, or zero to disable this server
// This can be as many as one per core, or zero to disable this server
// from doing any scheduling work.
// from doing any scheduling work.
NumSchedulers
int
`mapstructure:"num_schedulers"`
NumSchedulers
*
int
`mapstructure:"num_schedulers"`
// EnabledSchedulers controls the set of sub-schedulers that are
// EnabledSchedulers controls the set of sub-schedulers that are
// enabled for this server to handle. This will restrict the evaluations
// enabled for this server to handle. This will restrict the evaluations
...
@@ -1009,8 +1009,8 @@ func (a *ServerConfig) Merge(b *ServerConfig) *ServerConfig {
...
@@ -1009,8 +1009,8 @@ func (a *ServerConfig) Merge(b *ServerConfig) *ServerConfig {
if
b
.
RaftProtocol
!=
0
{
if
b
.
RaftProtocol
!=
0
{
result
.
RaftProtocol
=
b
.
RaftProtocol
result
.
RaftProtocol
=
b
.
RaftProtocol
}
}
if
b
.
NumSchedulers
!=
0
{
if
b
.
NumSchedulers
!=
nil
{
result
.
NumSchedulers
=
b
.
NumSchedulers
result
.
NumSchedulers
=
helper
.
IntToPtr
(
*
b
.
NumSchedulers
)
}
}
if
b
.
NodeGCThreshold
!=
""
{
if
b
.
NodeGCThreshold
!=
""
{
result
.
NodeGCThreshold
=
b
.
NodeGCThreshold
result
.
NodeGCThreshold
=
b
.
NodeGCThreshold
...
...
This diff is collapsed.
Click to expand it.
command/agent/config_parse_test.go
+
1
-
1
View file @
09b90e49
...
@@ -88,7 +88,7 @@ func TestConfig_Parse(t *testing.T) {
...
@@ -88,7 +88,7 @@ func TestConfig_Parse(t *testing.T) {
DataDir
:
"/tmp/data"
,
DataDir
:
"/tmp/data"
,
ProtocolVersion
:
3
,
ProtocolVersion
:
3
,
RaftProtocol
:
3
,
RaftProtocol
:
3
,
NumSchedulers
:
2
,
NumSchedulers
:
helper
.
IntToPtr
(
2
)
,
EnabledSchedulers
:
[]
string
{
"test"
},
EnabledSchedulers
:
[]
string
{
"test"
},
NodeGCThreshold
:
"12h"
,
NodeGCThreshold
:
"12h"
,
EvalGCThreshold
:
"12h"
,
EvalGCThreshold
:
"12h"
,
...
...
This diff is collapsed.
Click to expand it.
command/agent/config_test.go
+
2
-
2
View file @
09b90e49
...
@@ -105,7 +105,7 @@ func TestConfig_Merge(t *testing.T) {
...
@@ -105,7 +105,7 @@ func TestConfig_Merge(t *testing.T) {
DataDir
:
"/tmp/data1"
,
DataDir
:
"/tmp/data1"
,
ProtocolVersion
:
1
,
ProtocolVersion
:
1
,
RaftProtocol
:
1
,
RaftProtocol
:
1
,
NumSchedulers
:
1
,
NumSchedulers
:
helper
.
IntToPtr
(
1
)
,
NodeGCThreshold
:
"1h"
,
NodeGCThreshold
:
"1h"
,
HeartbeatGrace
:
30
*
time
.
Second
,
HeartbeatGrace
:
30
*
time
.
Second
,
MinHeartbeatTTL
:
30
*
time
.
Second
,
MinHeartbeatTTL
:
30
*
time
.
Second
,
...
@@ -255,7 +255,7 @@ func TestConfig_Merge(t *testing.T) {
...
@@ -255,7 +255,7 @@ func TestConfig_Merge(t *testing.T) {
DataDir
:
"/tmp/data2"
,
DataDir
:
"/tmp/data2"
,
ProtocolVersion
:
2
,
ProtocolVersion
:
2
,
RaftProtocol
:
2
,
RaftProtocol
:
2
,
NumSchedulers
:
2
,
NumSchedulers
:
helper
.
IntToPtr
(
2
)
,
EnabledSchedulers
:
[]
string
{
structs
.
JobTypeBatch
},
EnabledSchedulers
:
[]
string
{
structs
.
JobTypeBatch
},
NodeGCThreshold
:
"12h"
,
NodeGCThreshold
:
"12h"
,
HeartbeatGrace
:
2
*
time
.
Minute
,
HeartbeatGrace
:
2
*
time
.
Minute
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment