creator can set GOMAXPROCS for remote pilosa nodes

This commit is contained in:
jaffee 2016-12-14 15:05:50 -06:00
parent 9d5acdeecd
commit 0c6e6e4f44
2 changed files with 16 additions and 1 deletions

View file

@ -985,6 +985,7 @@ type CreateCommand struct {
ReplicaN int
LogFilePrefix string
Hosts []string
GoMaxProcs int
SSHUser string
@ -1012,6 +1013,7 @@ func (cmd *CreateCommand) ParseFlags(args []string) error {
fs.IntVar(&cmd.ReplicaN, "replicaN", 1, "")
fs.StringVar(&cmd.LogFilePrefix, "log-file-prefix", "", "")
var hosts string
fs.IntVar(&cmd.GoMaxProcs, "gomaxprocs", 0, "")
fs.StringVar(&hosts, "hosts", "", "")
fs.StringVar(&cmd.SSHUser, "ssh-user", "", "")
@ -1052,6 +1054,11 @@ The following flags are allowed:
-ssh-user
username to use when contacting remote hosts
-gomaxprocs
when starting a cluster on remote hosts, this
will set the value of GOMAXPROCS.
`)
}
@ -1077,6 +1084,7 @@ func (cmd *CreateCommand) Run(ctx context.Context) error {
ReplicaN: cmd.ReplicaN,
SSHUser: cmd.SSHUser,
Stderr: cmd.Stderr,
GoMaxProcs: cmd.GoMaxProcs,
}
default:
return fmt.Errorf("Unknown cluster type %v", cmd.Type)

View file

@ -4,6 +4,7 @@ import (
"fmt"
"io"
"net"
"strconv"
"sync"
"time"
@ -20,6 +21,7 @@ type RemoteCluster struct {
SSHUser string
Keyfile string
Key []byte
GoMaxProcs int
Stderr io.Writer
wg *sync.WaitGroup
logs []io.Reader
@ -113,7 +115,12 @@ func (c *RemoteCluster) Start() error {
c.pipeWs = append(c.pipeWs, pipeW)
c.stdins = append(c.stdins, inpipe)
err = sess.Start("pilosa -config " + configname)
gomaxprocsString := ""
if c.GoMaxProcs != 0 {
gomaxprocsString = "GOMAXPROCS=" + strconv.Itoa(c.GoMaxProcs) + " "
}
err = sess.Start(gomaxprocsString + "pilosa -config " + configname)
if err != nil {
return err
}