From 86b540ca13773633b08b33b6d15adec0f4f12edb Mon Sep 17 00:00:00 2001 From: jaffee Date: Thu, 19 Jan 2017 10:38:25 -0600 Subject: [PATCH 1/4] readme and error checking --- README.md | 20 +++++++++++--------- ssh/ssh.go | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 9fd0d4e60..d7d10ed93 100644 --- a/README.md +++ b/README.md @@ -235,24 +235,24 @@ Examples: Create a 5 node cluster locally (using 5 different ports), with a replication factor of 2. ``` -pilosactl create - -serverN 5 +pilosactl create \ + -serverN 5 \ -replicaN 2 ``` Create a cluster on 3 remote hosts - all logs will come to local stderr, pilosa binary must be available on remote hosts. The ssh user on the remote hosts needs to be the same as your local user. Otherwise use the `ssh-user` option. ``` -pilosactl create +pilosactl create \ -hosts="node1.example.com:15000,node2.example.com:15000,node3.example.com:15000" ``` Create a cluster on 3 remote hosts running OSX, but build the binary locally and copy it up. Stream the stderr of each node to a separate local log file. ``` -pilosactl create - -hosts="mac1.example.com:15000,mac2.example.com:15000,mac3.example.com:15000" - -copy-binary - -goos=darwin - -goarch=amd64 +pilosactl create \ + -hosts="mac1.example.com:15000,mac2.example.com:15000,mac3.example.com:15000" \ + -copy-binary \ + -goos=darwin \ + -goarch=amd64 \ -log-file-prefix=clusterlogs ``` @@ -270,7 +270,9 @@ Multiple subcommands and their arguments may be concatenated at the command line This will generate and import a bunch of data, and then execute random queries against it. ``` -pilosactl bagent import -max-bits-per-map=10000 random-query -iterations 100 +pilosactl bagent import \ + -max-bits-per-map=10000 \ + random-query -iterations 100 ``` ### Bspawn diff --git a/ssh/ssh.go b/ssh/ssh.go index 20a1bea41..f6121fec9 100644 --- a/ssh/ssh.go +++ b/ssh/ssh.go @@ -203,12 +203,12 @@ func (sf Fleet) OpenFile(name, perm string) (io.WriteCloser, error) { func (sf Fleet) WriteFile(name, perm string, data io.Reader) error { wc, err := sf.OpenFile(name, perm) if err != nil { - return err + return fmt.Errorf("opening: %v", err) } _, err = io.Copy(wc, data) if err != nil { - return err + return fmt.Errorf("copying: %v", err) } return wc.Close() } From b75c605985c3014bcbe8cc8c5c188a52634a0810 Mon Sep 17 00:00:00 2001 From: jaffee Date: Thu, 19 Jan 2017 10:44:02 -0600 Subject: [PATCH 2/4] more error context --- creator/remote.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/creator/remote.go b/creator/remote.go index b3fa56eba..cd637720e 100644 --- a/creator/remote.go +++ b/creator/remote.go @@ -96,7 +96,7 @@ func (c *RemoteCluster) Start() error { } err = w.Close() if err != nil { - return err + return fmt.Errorf("closing config writer: %v", err) } // Start pilosa on remote host From 583c16e8e790674500cae60b7d23a18e2d15f26c Mon Sep 17 00:00:00 2001 From: jaffee Date: Thu, 19 Jan 2017 11:31:49 -0600 Subject: [PATCH 3/4] add -hosts to bagent command in README --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d7d10ed93..eb88c67eb 100644 --- a/README.md +++ b/README.md @@ -262,7 +262,9 @@ pilosactl create \ E.G. ``` -pilosactl bagent import -h +pilosactl bagent \ + -hosts="localhost:15000,localhost:15001" \ + import -h ``` Multiple subcommands and their arguments may be concatenated at the command line and they will be run serially. This is useful (i.e.) for importing a bunch of data, and then executing queries against it. @@ -270,8 +272,9 @@ Multiple subcommands and their arguments may be concatenated at the command line This will generate and import a bunch of data, and then execute random queries against it. ``` -pilosactl bagent import \ - -max-bits-per-map=10000 \ +pilosactl bagent \ + -hosts="localhost:15000,localhost:15001" \ + import -max-bits-per-map=10000 \ random-query -iterations 100 ``` From 145e75d8add736af21d310d8120750f9d834a746 Mon Sep 17 00:00:00 2001 From: jaffee Date: Thu, 19 Jan 2017 16:54:36 -0600 Subject: [PATCH 4/4] add docs about Benchmark Name field --- bench/bench.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bench/bench.go b/bench/bench.go index 73cc625a8..000909bde 100644 --- a/bench/bench.go +++ b/bench/bench.go @@ -13,7 +13,9 @@ type Benchmark interface { // it is being run simultaneously on multiple "agents". E.G. the agentNum // might be used to make a random seed different for each agent, or have // each agent set a different set of bits. Init's doc string should document - // how the agentNum affects it. + // how the agentNum affects it. Every benchmark should have a 'Name' field + // set by init, which appears when the benchmark is marshalled to json as + // "name". Init(hosts []string, agentNum int) error // Run runs the benchmark. The return value of Run is kept generic so that