Skip to content

Commit

Permalink
Add the maximal number of hosts as option
Browse files Browse the repository at this point in the history
  • Loading branch information
Acanthostega committed Oct 11, 2013
1 parent ff3d8d7 commit fb50766
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func Waiter(host *formatter.Host) {
func Disconnection(
hosts []*formatter.Host,
disconnected <-chan *formatter.Host,
HostsMax int,
) {

for {
Expand Down Expand Up @@ -179,6 +180,7 @@ func Disconnection(
formatter.Dispatcher(
host.Commands[host.CommandNumber-1:],
hosts,
HostsMax,
false,
)

Expand Down Expand Up @@ -327,6 +329,7 @@ func RunCommands(
go Disconnection(
hosts,
disconnected,
config.HostsMax,
)

// if we use the timer, run the go routine
Expand Down
11 changes: 7 additions & 4 deletions exec/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ var (

// A list of host
hostnames = []string{
"arbois",
"verdejo",
"courbu",
"aspiran",
"tressalier",
"picardan",
"roussanne",
"doucillon",
"verdejo",
"molette",
"mauzac",
"mancin",
"vaccarese",
"carmenere",
"tressalier",
"null",
"tockay",
"bidule",
"toké",
"poulsard",
"arbois",
"machin",
"ugni",
"picardan",
}
)

Expand Down Expand Up @@ -61,6 +61,8 @@ func TestRunCommands(t *testing.T) {
conf.MemoryMax = 30.0
conf.ExcludeLoaded = true
conf.WorkTimer = true
conf.WorkTime = 120
conf.HostsMax = 5

// Create a command which will be duplicated
command := &formatter.Command{
Expand Down Expand Up @@ -97,6 +99,7 @@ func TestRunCommands(t *testing.T) {
formatter.Dispatcher(
commands,
hosts,
conf.HostsMax,
true,
)

Expand Down
1 change: 1 addition & 0 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func Run() {
formatter.Dispatcher(
commands,
hosts,
data_config.HostsMax,
true,
)

Expand Down

0 comments on commit fb50766

Please sign in to comment.