From b41fdae55f188ecb42d7500a0d1e52043344dd73 Mon Sep 17 00:00:00 2001 From: jaffee Date: Tue, 3 Jan 2017 17:00:42 -0600 Subject: [PATCH] fix issues with import benchmark output not all metadata was jsonified and it was timing itself --- bench/import.go | 6 +----- pilosactl/import.go | 18 +++++++++--------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/bench/import.go b/bench/import.go index be40bda20..2854ea458 100644 --- a/bench/import.go +++ b/bench/import.go @@ -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 } diff --git a/pilosactl/import.go b/pilosactl/import.go index 34d243f1e..ff157a931 100644 --- a/pilosactl/import.go +++ b/pilosactl/import.go @@ -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.