have bagent add metadata to results

need this to differentiate multiple agents' output when it's all going to stdout.
This commit is contained in:
jaffee 2016-12-16 13:56:11 -06:00
parent d196c39bce
commit 293621516e
4 changed files with 24 additions and 22 deletions

View file

@ -13,10 +13,10 @@ import (
// DiagonalSetBits sets bits with increasing profile id and bitmap id.
type DiagonalSetBits struct {
HasClient
BaseBitmapID int
BaseProfileID int
Iterations int
DB string
BaseBitmapID int `json:"base-bitmap-id"`
BaseProfileID int `json:"base-profile-id"`
Iterations int `json:"iterations"`
DB string `json:"db"`
}
func (b *DiagonalSetBits) Usage() string {

View file

@ -12,9 +12,9 @@ import (
// MultiDBSetBits sets bits with increasing profile id and bitmap id.
type MultiDBSetBits struct {
HasClient
BaseBitmapID int
BaseProfileID int
Iterations int
BaseBitmapID int `json:"base-bitmap-id"`
BaseProfileID int `json:"base-profile-id"`
Iterations int `json:"iterations"`
}
func (b *MultiDBSetBits) Usage() string {

View file

@ -14,14 +14,13 @@ import (
// RandomSetBits sets bits randomly and deterministically based on a seed.
type RandomSetBits struct {
HasClient
BaseBitmapID int64
BaseProfileID int64
BitmapIDRange int64
ProfileIDRange int64
Iterations int // number of bits that will be set
Seed int64
DB string // DB to use in pilosa.
BaseBitmapID int64 `json:"base-bitmap-id"`
BaseProfileID int64 `json:"base-profile-id"`
BitmapIDRange int64 `json:"bitmap-id-range"`
ProfileIDRange int64 `json:"profile-id-range"`
Iterations int `json:"iterations"`
Seed int64 `json:"seed"`
DB string `json:"db"`
}
func (b *RandomSetBits) Usage() string {

View file

@ -1152,18 +1152,20 @@ func (cmd *CreateCommand) Run(ctx context.Context) error {
// on the command line.
type BagentCommand struct {
// Slice of Benchmarks which will be run serially.
Benchmarks []bench.Benchmark
Benchmarks []bench.Benchmark `json:"benchmarks"`
// AgentNum will be passed to each benchmark's Run method so that it can
// parameterize its behavior.
AgentNum int
// Slice of pilosa hosts to run the Benchmarks against.
Hosts []string
AgentNum int `json:"agent-num"`
// Enable pretty printing of results, for human consumption.
HumanReadable bool
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
// Slice of pilosa hosts to run the Benchmarks against.
Hosts []string `json:"hosts"`
Stdin io.Reader `json:"-"`
Stdout io.Writer `json:"-"`
Stderr io.Writer `json:"-"`
}
// NewBagentCommand returns a new instance of BagentCommand.
@ -1280,6 +1282,7 @@ func (cmd *BagentCommand) Run(ctx context.Context) error {
}
res := sbm.Run(ctx, cmd.AgentNum)
res["metadata"] = cmd
enc := json.NewEncoder(cmd.Stdout)
enc.SetIndent("", " ")
if cmd.HumanReadable {