From 24756ac0568e2d43682a12aa419a9bdeb1cac72e Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Tue, 15 Sep 2020 11:55:54 -0700 Subject: [PATCH] allow specification of repo directory in lotus-bench --- cmd/lotus-bench/import.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cmd/lotus-bench/import.go b/cmd/lotus-bench/import.go index 7fe63eae1..f2845ba20 100644 --- a/cmd/lotus-bench/import.go +++ b/cmd/lotus-bench/import.go @@ -56,6 +56,10 @@ var importBenchCmd = &cli.Command{ Usage: "set the parallelism factor for batch seal verification", Value: runtime.NumCPU(), }, + &cli.StringFlag{ + Name: "repodir", + Usage: "set the repo directory for the lotus bench run (defaults to /tmp)", + }, }, Action: func(cctx *cli.Context) error { vm.BatchSealVerifyParallelism = cctx.Int("batch-seal-verify-threads") @@ -70,9 +74,15 @@ var importBenchCmd = &cli.Command{ } defer cfi.Close() //nolint:errcheck // read only file - tdir, err := ioutil.TempDir("", "lotus-import-bench") - if err != nil { - return err + var tdir string + if rdir := cctx.String("repodir"); rdir != "" { + tdir = rdir + } else { + tmp, err := ioutil.TempDir("", "lotus-import-bench") + if err != nil { + return err + } + tdir = tmp } bds, err := badger.NewDatastore(tdir, nil)