fix issues with import benchmark output

not all metadata was jsonified and it was timing itself
This commit is contained in:
jaffee 2017-01-03 17:00:42 -06:00
parent 9a24b9b0e9
commit b41fdae55f
2 changed files with 10 additions and 14 deletions

View file

@ -7,7 +7,6 @@ import (
"io"
"io/ioutil"
"math/rand"
"time"
"sort"
@ -135,9 +134,8 @@ func (b *Import) Init(hosts []string, agentNum int) error {
b.MinBitsPerMap, b.MaxBitsPerMap, b.Seed+int64(agentNum), b.RandomBitmapOrder)
b.numbits = num
// set b.Paths
f.Close()
b.Paths = []string{f.Name()}
return nil
return f.Close()
}
// Run runs the Import benchmark
@ -145,13 +143,11 @@ func (b *Import) Run(ctx context.Context, agentNum int) map[string]interface{} {
results := make(map[string]interface{})
results["numbits"] = b.numbits
results["db"] = b.Database
start := time.Now()
err := b.ImportCommand.Run(ctx)
if err != nil {
results["error"] = err.Error()
}
results["time"] = time.Now().Sub(start)
return results
}

View file

@ -19,25 +19,25 @@ import (
// ImportCommand represents a command for bulk importing data.
type ImportCommand struct {
// Destination host and port.
Host string
Host string `json:"host"`
// Name of the database & frame to import into.
Database string
Frame string
Database string `json:"db"`
Frame string `json:"frame"`
// Filenames to import from.
Paths []string
Paths []string `json:"paths"`
// Size of buffer used to chunk import.
BufferSize int
BufferSize int `json:"buffer-size"`
// Reusable client.
Client *pilosa.Client
Client *pilosa.Client `json:"-"`
// Standard input/output
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
Stdin io.Reader `json:"-"`
Stdout io.Writer `json:"-"`
Stderr io.Writer `json:"-"`
}
// NewImportCommand returns a new instance of ImportCommand.