feat: miner cli: Separate proving workers command

This commit is contained in:
Łukasz Magiera 2022-03-26 16:16:12 -04:00
parent c50b63c5f6
commit ad684ed0ea
4 changed files with 121 additions and 91 deletions

View File

@ -50,8 +50,13 @@ var infoAllCmd = &cli.Command{
fmt.Println("ERROR: ", err) fmt.Println("ERROR: ", err)
} }
fmt.Println("\n#: Worker List") fmt.Println("\n#: Sealing Worker List")
if err := sealingWorkersCmd.Action(cctx); err != nil { if err := workersCmd(true).Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Proving Worker List")
if err := workersCmd(false).Action(cctx); err != nil {
fmt.Println("ERROR: ", err) fmt.Println("ERROR: ", err)
} }

View File

@ -30,6 +30,7 @@ var provingCmd = &cli.Command{
provingDeadlineInfoCmd, provingDeadlineInfoCmd,
provingFaultsCmd, provingFaultsCmd,
provingCheckProvableCmd, provingCheckProvableCmd,
workersCmd(false),
}, },
} }

View File

@ -16,6 +16,7 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface" "github.com/filecoin-project/lotus/extern/sector-storage/storiface"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
@ -27,7 +28,7 @@ var sealingCmd = &cli.Command{
Usage: "interact with sealing pipeline", Usage: "interact with sealing pipeline",
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
sealingJobsCmd, sealingJobsCmd,
sealingWorkersCmd, workersCmd(true),
sealingSchedDiagCmd, sealingSchedDiagCmd,
sealingAbortCmd, sealingAbortCmd,
}, },
@ -47,7 +48,8 @@ func barString(total, y, g float64) string {
return barString return barString
} }
var sealingWorkersCmd = &cli.Command{ func workersCmd(sealing bool) *cli.Command {
return &cli.Command{
Name: "workers", Name: "workers",
Usage: "list workers", Usage: "list workers",
Flags: []cli.Flag{ Flags: []cli.Flag{
@ -82,6 +84,12 @@ var sealingWorkersCmd = &cli.Command{
st := make([]sortableStat, 0, len(stats)) st := make([]sortableStat, 0, len(stats))
for id, stat := range stats { for id, stat := range stats {
if len(stat.Tasks) > 0 {
if (stat.Tasks[0].WorkerType() != sealtasks.WorkerSealing) == sealing {
continue
}
}
st = append(st, sortableStat{id, stat}) st = append(st, sortableStat{id, stat})
} }
@ -149,6 +157,7 @@ var sealingWorkersCmd = &cli.Command{
return nil return nil
}, },
} }
}
var sealingJobsCmd = &cli.Command{ var sealingJobsCmd = &cli.Command{
Name: "jobs", Name: "jobs",

View File

@ -2040,6 +2040,7 @@ COMMANDS:
deadline View the current proving period deadline information by its index deadline View the current proving period deadline information by its index
faults View the currently known proving faulty sectors information faults View the currently known proving faulty sectors information
check Check sectors provable check Check sectors provable
workers list workers
help, h Shows a list of commands or help for one command help, h Shows a list of commands or help for one command
OPTIONS: OPTIONS:
@ -2116,6 +2117,20 @@ OPTIONS:
``` ```
### lotus-miner proving workers
```
NAME:
lotus-miner proving workers - list workers
USAGE:
lotus-miner proving workers [command options] [arguments...]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--help, -h show help (default: false)
```
## lotus-miner storage ## lotus-miner storage
``` ```
NAME: NAME: