mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
Merge pull request #279 from jaffee/264-mktemp
use temp location for pilosactl and pilosa binaries
This commit is contained in:
commit
c2253a36ea
2 changed files with 11 additions and 10 deletions
|
|
@ -14,7 +14,6 @@ import (
|
|||
"math/rand"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
|
@ -1542,15 +1541,16 @@ func (cmd *BspawnCommand) spawnRemote(ctx context.Context) (map[string]interface
|
|||
return nil, err
|
||||
}
|
||||
|
||||
cmdName := "pilosactl"
|
||||
if cmd.CopyBinary {
|
||||
fmt.Fprintf(cmd.Stderr, "bspawn: building pilosactl binary with GOOS=%v and GOARCH=%v to copy to agent hosts\n", cmd.GOOS, cmd.GOARCH)
|
||||
cmdName = "/tmp/pilosactl" + strconv.Itoa(rand.Int())
|
||||
fmt.Fprintf(cmd.Stderr, "bspawn: building pilosactl binary with GOOS=%v and GOARCH=%v to copy to agents at %v\n", cmd.GOOS, cmd.GOARCH, cmdName)
|
||||
pkg := "github.com/pilosa/pilosa/cmd/pilosactl"
|
||||
bin, err := build.Binary(pkg, cmd.GOOS, cmd.GOARCH)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = agentFleet.WriteFile(path.Base(pkg), "+x", bin)
|
||||
err = agentFleet.WriteFile(cmdName, "+x", bin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -1589,7 +1589,7 @@ func (cmd *BspawnCommand) spawnRemote(ctx context.Context) (map[string]interface
|
|||
resLock.Unlock()
|
||||
}(stdout, sp.Name, i)
|
||||
sess.Stderr = cmd.Stderr
|
||||
err = sess.Start("PATH=.:$PATH pilosactl bagent -agent-num=" + strconv.Itoa(i) + " -hosts=" + strings.Join(cmd.PilosaHosts, ",") + " " + strings.Join(sp.Args, " "))
|
||||
err = sess.Start(cmdName + " bagent -agent-num=" + strconv.Itoa(i) + " -hosts=" + strings.Join(cmd.PilosaHosts, ",") + " " + strings.Join(sp.Args, " "))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,10 @@ package creator
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"net"
|
||||
"path"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
"time"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
|
|
@ -48,8 +47,10 @@ func (c *RemoteCluster) Start() error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("connecting to cluster hosts: %v", err)
|
||||
}
|
||||
cmdName := "pilosa"
|
||||
if c.CopyBinary {
|
||||
fmt.Fprintf(c.Stderr, "create: building pilosa binary with GOOS=%v and GOARCH=%v to copy to hosts", c.GOOS, c.GOARCH)
|
||||
cmdName = "/tmp/pilosa" + strconv.Itoa(rand.Int())
|
||||
fmt.Fprintf(c.Stderr, "create: building pilosa binary with GOOS=%v and GOARCH=%v to copy to hosts at %v", c.GOOS, c.GOARCH, cmdName)
|
||||
|
||||
pkg := "github.com/pilosa/pilosa/cmd/pilosa"
|
||||
bin, err := build.Binary(pkg, c.GOOS, c.GOARCH)
|
||||
|
|
@ -57,7 +58,7 @@ func (c *RemoteCluster) Start() error {
|
|||
return fmt.Errorf("building binary: %v", err)
|
||||
}
|
||||
|
||||
err = fleet.WriteFile(path.Base(pkg), "+x", bin)
|
||||
err = fleet.WriteFile(cmdName, "+x", bin)
|
||||
if err != nil {
|
||||
return fmt.Errorf("writing binary to fleet: %v", err)
|
||||
}
|
||||
|
|
@ -133,7 +134,7 @@ func (c *RemoteCluster) Start() error {
|
|||
gomaxprocsString = "GOMAXPROCS=" + strconv.Itoa(c.GoMaxProcs) + " "
|
||||
}
|
||||
|
||||
err = sess.Start("PATH=.:$PATH " + gomaxprocsString + "pilosa -config " + configname)
|
||||
err = sess.Start(gomaxprocsString + cmdName + " -config " + configname)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue