allow specification of repo directory in lotus-bench
This commit is contained in:
parent
86607452d7
commit
24756ac056
@ -56,6 +56,10 @@ var importBenchCmd = &cli.Command{
|
|||||||
Usage: "set the parallelism factor for batch seal verification",
|
Usage: "set the parallelism factor for batch seal verification",
|
||||||
Value: runtime.NumCPU(),
|
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 {
|
Action: func(cctx *cli.Context) error {
|
||||||
vm.BatchSealVerifyParallelism = cctx.Int("batch-seal-verify-threads")
|
vm.BatchSealVerifyParallelism = cctx.Int("batch-seal-verify-threads")
|
||||||
@ -70,9 +74,15 @@ var importBenchCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
defer cfi.Close() //nolint:errcheck // read only file
|
defer cfi.Close() //nolint:errcheck // read only file
|
||||||
|
|
||||||
tdir, err := ioutil.TempDir("", "lotus-import-bench")
|
var tdir string
|
||||||
if err != nil {
|
if rdir := cctx.String("repodir"); rdir != "" {
|
||||||
return err
|
tdir = rdir
|
||||||
|
} else {
|
||||||
|
tmp, err := ioutil.TempDir("", "lotus-import-bench")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
tdir = tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
bds, err := badger.NewDatastore(tdir, nil)
|
bds, err := badger.NewDatastore(tdir, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user