Add output destination flag

This commit is contained in:
Alan Bernstein 2017-01-11 09:18:28 -06:00
parent 38933e742b
commit bb1157394d

View file

@ -1171,6 +1171,9 @@ type BagentCommand struct {
// Enable pretty printing of results, for human consumption.
HumanReadable bool `json:"human-readable"`
// Result destination, ["stdout", "aws"]
Output string `json:"output"`
// Slice of pilosa hosts to run the Benchmarks against.
Hosts []string `json:"hosts"`
@ -1186,6 +1189,7 @@ func NewBagentCommand(stdin io.Reader, stdout, stderr io.Writer) *BagentCommand
Hosts: []string{},
AgentNum: 0,
HumanReadable: false,
Output: "aws",
Stdin: stdin,
Stdout: stdout,
@ -1207,6 +1211,7 @@ func (cmd *BagentCommand) ParseFlags(args []string) error {
fs.StringVar(&pilosaHosts, "hosts", "localhost:15000", "")
fs.IntVar(&cmd.AgentNum, "agent-num", 0, "")
fs.BoolVar(&cmd.HumanReadable, "human", false, "")
fs.StringVar(&cmd.Output, "output", "aws", "")
if err := fs.Parse(args); err != nil {
return err
@ -1273,6 +1278,9 @@ The following arguments are available:
-human
Boolean to enable human-readable format.
-output
String to select output destination, "stdout" or "aws"
subcommands:
diagonal-set-bits
random-set-bits
@ -1332,6 +1340,9 @@ type BspawnCommand struct {
// Makes output human readable
Human bool
// Result destination, ["stdout", "aws"]
Output string
// Benchmarks is a slice of Spawns which specifies all of the bagent
// commands to run. These will all be run in parallel, started on each
// of the agents in a round robin fashion.
@ -1371,6 +1382,7 @@ func (cmd *BspawnCommand) ParseFlags(args []string) error {
agentHosts := fs.String("agent-hosts", "", "")
sshUser := fs.String("ssh-user", "", "")
fs.BoolVar(&cmd.Human, "human", false, "")
fs.StringVar(&cmd.Output, "output", "aws", "")
fs.BoolVar(&cmd.CopyBinary, "copy-binary", false, "")
err := fs.Parse(args)
@ -1437,6 +1449,9 @@ The following flags are allowed and will override the values in the config file:
-human
toggle human readable output (indented json with formatted times)
-output
string to select output destination, "stdout" or "aws"
`)
}