Compare commits

...
10 changed files with 153 additions and 121 deletions
+7 -2
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)
} }
+1
View File
@@ -30,6 +30,7 @@ var provingCmd = &cli.Command{
provingDeadlineInfoCmd, provingDeadlineInfoCmd,
provingFaultsCmd, provingFaultsCmd,
provingCheckProvableCmd, provingCheckProvableCmd,
workersCmd(false),
}, },
} }
+98 -89
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,107 +48,115 @@ func barString(total, y, g float64) string {
return barString return barString
} }
var sealingWorkersCmd = &cli.Command{ func workersCmd(sealing bool) *cli.Command {
Name: "workers", return &cli.Command{
Usage: "list workers", Name: "workers",
Flags: []cli.Flag{ Usage: "list workers",
&cli.BoolFlag{ Flags: []cli.Flag{
Name: "color", &cli.BoolFlag{
Usage: "use color in display output", Name: "color",
DefaultText: "depends on output being a TTY", Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
}, },
}, Action: func(cctx *cli.Context) error {
Action: func(cctx *cli.Context) error { if cctx.IsSet("color") {
if cctx.IsSet("color") { color.NoColor = !cctx.Bool("color")
color.NoColor = !cctx.Bool("color")
}
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
ctx := lcli.ReqContext(cctx)
stats, err := nodeApi.WorkerStats(ctx)
if err != nil {
return err
}
type sortableStat struct {
id uuid.UUID
storiface.WorkerStats
}
st := make([]sortableStat, 0, len(stats))
for id, stat := range stats {
st = append(st, sortableStat{id, stat})
}
sort.Slice(st, func(i, j int) bool {
return st[i].id.String() < st[j].id.String()
})
for _, stat := range st {
gpuUse := "not "
gpuCol := color.FgBlue
if stat.GpuUsed > 0 {
gpuCol = color.FgGreen
gpuUse = ""
} }
var disabled string nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if !stat.Enabled { if err != nil {
disabled = color.RedString(" (disabled)") return err
}
defer closer()
ctx := lcli.ReqContext(cctx)
stats, err := nodeApi.WorkerStats(ctx)
if err != nil {
return err
} }
fmt.Printf("Worker %s, host %s%s\n", stat.id, color.MagentaString(stat.Info.Hostname), disabled) type sortableStat struct {
id uuid.UUID
fmt.Printf("\tCPU: [%s] %d/%d core(s) in use\n", storiface.WorkerStats
barString(float64(stat.Info.Resources.CPUs), 0, float64(stat.CpuUse)), stat.CpuUse, stat.Info.Resources.CPUs)
ramTotal := stat.Info.Resources.MemPhysical
ramTasks := stat.MemUsedMin
ramUsed := stat.Info.Resources.MemUsed
var ramReserved uint64 = 0
if ramUsed > ramTasks {
ramReserved = ramUsed - ramTasks
} }
ramBar := barString(float64(ramTotal), float64(ramReserved), float64(ramTasks))
fmt.Printf("\tRAM: [%s] %d%% %s/%s\n", ramBar, st := make([]sortableStat, 0, len(stats))
(ramTasks+ramReserved)*100/stat.Info.Resources.MemPhysical, for id, stat := range stats {
types.SizeStr(types.NewInt(ramTasks+ramUsed)), if len(stat.Tasks) > 0 {
types.SizeStr(types.NewInt(stat.Info.Resources.MemPhysical))) if (stat.Tasks[0].WorkerType() != sealtasks.WorkerSealing) == sealing {
continue
}
}
vmemTotal := stat.Info.Resources.MemPhysical + stat.Info.Resources.MemSwap st = append(st, sortableStat{id, stat})
vmemTasks := stat.MemUsedMax
vmemUsed := stat.Info.Resources.MemUsed + stat.Info.Resources.MemSwapUsed
var vmemReserved uint64 = 0
if vmemUsed > vmemTasks {
vmemReserved = vmemUsed - vmemTasks
} }
vmemBar := barString(float64(vmemTotal), float64(vmemReserved), float64(vmemTasks))
fmt.Printf("\tVMEM: [%s] %d%% %s/%s\n", vmemBar, sort.Slice(st, func(i, j int) bool {
(vmemTasks+vmemReserved)*100/vmemTotal, return st[i].id.String() < st[j].id.String()
types.SizeStr(types.NewInt(vmemTasks+vmemReserved)), })
types.SizeStr(types.NewInt(vmemTotal)))
if len(stat.Info.Resources.GPUs) > 0 { for _, stat := range st {
gpuBar := barString(float64(len(stat.Info.Resources.GPUs)), 0, stat.GpuUsed) gpuUse := "not "
fmt.Printf("\tGPU: [%s] %.f%% %.2f/%d gpu(s) in use\n", color.GreenString(gpuBar), gpuCol := color.FgBlue
stat.GpuUsed*100/float64(len(stat.Info.Resources.GPUs)), if stat.GpuUsed > 0 {
stat.GpuUsed, len(stat.Info.Resources.GPUs)) gpuCol = color.FgGreen
gpuUse = ""
}
var disabled string
if !stat.Enabled {
disabled = color.RedString(" (disabled)")
}
fmt.Printf("Worker %s, host %s%s\n", stat.id, color.MagentaString(stat.Info.Hostname), disabled)
fmt.Printf("\tCPU: [%s] %d/%d core(s) in use\n",
barString(float64(stat.Info.Resources.CPUs), 0, float64(stat.CpuUse)), stat.CpuUse, stat.Info.Resources.CPUs)
ramTotal := stat.Info.Resources.MemPhysical
ramTasks := stat.MemUsedMin
ramUsed := stat.Info.Resources.MemUsed
var ramReserved uint64 = 0
if ramUsed > ramTasks {
ramReserved = ramUsed - ramTasks
}
ramBar := barString(float64(ramTotal), float64(ramReserved), float64(ramTasks))
fmt.Printf("\tRAM: [%s] %d%% %s/%s\n", ramBar,
(ramTasks+ramReserved)*100/stat.Info.Resources.MemPhysical,
types.SizeStr(types.NewInt(ramTasks+ramUsed)),
types.SizeStr(types.NewInt(stat.Info.Resources.MemPhysical)))
vmemTotal := stat.Info.Resources.MemPhysical + stat.Info.Resources.MemSwap
vmemTasks := stat.MemUsedMax
vmemUsed := stat.Info.Resources.MemUsed + stat.Info.Resources.MemSwapUsed
var vmemReserved uint64 = 0
if vmemUsed > vmemTasks {
vmemReserved = vmemUsed - vmemTasks
}
vmemBar := barString(float64(vmemTotal), float64(vmemReserved), float64(vmemTasks))
fmt.Printf("\tVMEM: [%s] %d%% %s/%s\n", vmemBar,
(vmemTasks+vmemReserved)*100/vmemTotal,
types.SizeStr(types.NewInt(vmemTasks+vmemReserved)),
types.SizeStr(types.NewInt(vmemTotal)))
if len(stat.Info.Resources.GPUs) > 0 {
gpuBar := barString(float64(len(stat.Info.Resources.GPUs)), 0, stat.GpuUsed)
fmt.Printf("\tGPU: [%s] %.f%% %.2f/%d gpu(s) in use\n", color.GreenString(gpuBar),
stat.GpuUsed*100/float64(len(stat.Info.Resources.GPUs)),
stat.GpuUsed, len(stat.Info.Resources.GPUs))
}
for _, gpu := range stat.Info.Resources.GPUs {
fmt.Printf("\tGPU: %s\n", color.New(gpuCol).Sprintf("%s, %sused", gpu, gpuUse))
}
} }
for _, gpu := range stat.Info.Resources.GPUs {
fmt.Printf("\tGPU: %s\n", color.New(gpuCol).Sprintf("%s, %sused", gpu, gpuUse))
}
}
return nil return nil
}, },
}
} }
var sealingJobsCmd = &cli.Command{ var sealingJobsCmd = &cli.Command{
+8 -8
View File
@@ -300,28 +300,28 @@ var runCmd = &cli.Command{
taskTypes = append(taskTypes, sealtasks.TTFetch, sealtasks.TTCommit1, sealtasks.TTProveReplicaUpdate1, sealtasks.TTFinalize, sealtasks.TTFinalizeReplicaUpdate) taskTypes = append(taskTypes, sealtasks.TTFetch, sealtasks.TTCommit1, sealtasks.TTProveReplicaUpdate1, sealtasks.TTFinalize, sealtasks.TTFinalizeReplicaUpdate)
} }
if (workerType != sealtasks.WorkerSealing || cctx.IsSet("addpiece")) && cctx.Bool("addpiece") { if (workerType == sealtasks.WorkerSealing || cctx.IsSet("addpiece")) && cctx.Bool("addpiece") {
taskTypes = append(taskTypes, sealtasks.TTAddPiece) taskTypes = append(taskTypes, sealtasks.TTAddPiece)
} }
if (workerType != sealtasks.WorkerSealing || cctx.IsSet("precommit1")) && cctx.Bool("precommit1") { if (workerType == sealtasks.WorkerSealing || cctx.IsSet("precommit1")) && cctx.Bool("precommit1") {
taskTypes = append(taskTypes, sealtasks.TTPreCommit1) taskTypes = append(taskTypes, sealtasks.TTPreCommit1)
} }
if (workerType != sealtasks.WorkerSealing || cctx.IsSet("unseal")) && cctx.Bool("unseal") { if (workerType == sealtasks.WorkerSealing || cctx.IsSet("unseal")) && cctx.Bool("unseal") {
taskTypes = append(taskTypes, sealtasks.TTUnseal) taskTypes = append(taskTypes, sealtasks.TTUnseal)
} }
if (workerType != sealtasks.WorkerSealing || cctx.IsSet("precommit2")) && cctx.Bool("precommit2") { if (workerType == sealtasks.WorkerSealing || cctx.IsSet("precommit2")) && cctx.Bool("precommit2") {
taskTypes = append(taskTypes, sealtasks.TTPreCommit2) taskTypes = append(taskTypes, sealtasks.TTPreCommit2)
} }
if (workerType != sealtasks.WorkerSealing || cctx.IsSet("commit")) && cctx.Bool("commit") { if (workerType == sealtasks.WorkerSealing || cctx.IsSet("commit")) && cctx.Bool("commit") {
taskTypes = append(taskTypes, sealtasks.TTCommit2) taskTypes = append(taskTypes, sealtasks.TTCommit2)
} }
if (workerType != sealtasks.WorkerSealing || cctx.IsSet("replica-update")) && cctx.Bool("replica-update") { if (workerType == sealtasks.WorkerSealing || cctx.IsSet("replica-update")) && cctx.Bool("replica-update") {
taskTypes = append(taskTypes, sealtasks.TTReplicaUpdate) taskTypes = append(taskTypes, sealtasks.TTReplicaUpdate)
} }
if (workerType != sealtasks.WorkerSealing || cctx.IsSet("prove-replica-update2")) && cctx.Bool("prove-replica-update2") { if (workerType == sealtasks.WorkerSealing || cctx.IsSet("prove-replica-update2")) && cctx.Bool("prove-replica-update2") {
taskTypes = append(taskTypes, sealtasks.TTProveReplicaUpdate2) taskTypes = append(taskTypes, sealtasks.TTProveReplicaUpdate2)
} }
if (workerType != sealtasks.WorkerSealing || cctx.IsSet("regen-sector-key")) && cctx.Bool("regen-sector-key") { if (workerType == sealtasks.WorkerSealing || cctx.IsSet("regen-sector-key")) && cctx.Bool("regen-sector-key") {
taskTypes = append(taskTypes, sealtasks.TTRegenSectorKey) taskTypes = append(taskTypes, sealtasks.TTRegenSectorKey)
} }
+15
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:
@@ -173,14 +173,6 @@
# env var: LOTUS_DEALMAKING_EXPECTEDSEALDURATION # env var: LOTUS_DEALMAKING_EXPECTEDSEALDURATION
#ExpectedSealDuration = "24h0m0s" #ExpectedSealDuration = "24h0m0s"
# Whether new sectors are created to pack incoming deals
# When this is set to false no new sectors will be created for sealing incoming deals
# This is useful for forcing all deals to be assigned as snap deals to sectors marked for upgrade
#
# type: bool
# env var: LOTUS_DEALMAKING_MAKENEWSECTORFORDEALS
#MakeNewSectorForDeals = true
# Maximum amount of time proposed deal StartEpoch can be in future # Maximum amount of time proposed deal StartEpoch can be in future
# #
# type: Duration # type: Duration
@@ -380,6 +372,14 @@
# env var: LOTUS_SEALING_FINALIZEEARLY # env var: LOTUS_SEALING_FINALIZEEARLY
#FinalizeEarly = false #FinalizeEarly = false
# Whether new sectors are created to pack incoming deals
# When this is set to false no new sectors will be created for sealing incoming deals
# This is useful for forcing all deals to be assigned as snap deals to sectors marked for upgrade
#
# type: bool
# env var: LOTUS_SEALING_MAKENEWSECTORFORDEALS
#MakeNewSectorForDeals = true
# After sealing CC sectors, make them available for upgrading with deals # After sealing CC sectors, make them available for upgrading with deals
# #
# type: bool # type: bool
+1 -1
View File
@@ -110,6 +110,7 @@ func DefaultStorageMiner() *StorageMiner {
WaitDealsDelay: Duration(time.Hour * 6), WaitDealsDelay: Duration(time.Hour * 6),
AlwaysKeepUnsealedCopy: true, AlwaysKeepUnsealedCopy: true,
FinalizeEarly: false, FinalizeEarly: false,
MakeNewSectorForDeals: true,
CollateralFromMinerBalance: false, CollateralFromMinerBalance: false,
AvailableBalanceBuffer: types.FIL(big.Zero()), AvailableBalanceBuffer: types.FIL(big.Zero()),
@@ -163,7 +164,6 @@ func DefaultStorageMiner() *StorageMiner {
ConsiderVerifiedStorageDeals: true, ConsiderVerifiedStorageDeals: true,
ConsiderUnverifiedStorageDeals: true, ConsiderUnverifiedStorageDeals: true,
PieceCidBlocklist: []cid.Cid{}, PieceCidBlocklist: []cid.Cid{},
MakeNewSectorForDeals: true,
// TODO: It'd be nice to set this based on sector size // TODO: It'd be nice to set this based on sector size
MaxDealStartDelay: Duration(time.Hour * 24 * 14), MaxDealStartDelay: Duration(time.Hour * 24 * 14),
ExpectedSealDuration: Duration(time.Hour * 24), ExpectedSealDuration: Duration(time.Hour * 24),
+8 -8
View File
@@ -253,14 +253,6 @@ Default value: 1 minute.`,
Comment: `Maximum expected amount of time getting the deal into a sealed sector will take Comment: `Maximum expected amount of time getting the deal into a sealed sector will take
This includes the time the deal will need to get transferred and published This includes the time the deal will need to get transferred and published
before being assigned to a sector`, before being assigned to a sector`,
},
{
Name: "MakeNewSectorForDeals",
Type: "bool",
Comment: `Whether new sectors are created to pack incoming deals
When this is set to false no new sectors will be created for sealing incoming deals
This is useful for forcing all deals to be assigned as snap deals to sectors marked for upgrade`,
}, },
{ {
Name: "MaxDealStartDelay", Name: "MaxDealStartDelay",
@@ -765,6 +757,14 @@ avoid the relatively high cost of unsealing the data later, at the cost of more
Comment: `Run sector finalization before submitting sector proof to the chain`, Comment: `Run sector finalization before submitting sector proof to the chain`,
}, },
{
Name: "MakeNewSectorForDeals",
Type: "bool",
Comment: `Whether new sectors are created to pack incoming deals
When this is set to false no new sectors will be created for sealing incoming deals
This is useful for forcing all deals to be assigned as snap deals to sectors marked for upgrade`,
},
{ {
Name: "MakeCCSectorsAvailable", Name: "MakeCCSectorsAvailable",
Type: "bool", Type: "bool",
+5 -4
View File
@@ -128,10 +128,6 @@ type DealmakingConfig struct {
// This includes the time the deal will need to get transferred and published // This includes the time the deal will need to get transferred and published
// before being assigned to a sector // before being assigned to a sector
ExpectedSealDuration Duration ExpectedSealDuration Duration
// Whether new sectors are created to pack incoming deals
// When this is set to false no new sectors will be created for sealing incoming deals
// This is useful for forcing all deals to be assigned as snap deals to sectors marked for upgrade
MakeNewSectorForDeals bool
// Maximum amount of time proposed deal StartEpoch can be in future // Maximum amount of time proposed deal StartEpoch can be in future
MaxDealStartDelay Duration MaxDealStartDelay Duration
// When a deal is ready to publish, the amount of time to wait for more // When a deal is ready to publish, the amount of time to wait for more
@@ -259,6 +255,11 @@ type SealingConfig struct {
// Run sector finalization before submitting sector proof to the chain // Run sector finalization before submitting sector proof to the chain
FinalizeEarly bool FinalizeEarly bool
// Whether new sectors are created to pack incoming deals
// When this is set to false no new sectors will be created for sealing incoming deals
// This is useful for forcing all deals to be assigned as snap deals to sectors marked for upgrade
MakeNewSectorForDeals bool
// After sealing CC sectors, make them available for upgrading with deals // After sealing CC sectors, make them available for upgrading with deals
MakeCCSectorsAvailable bool MakeCCSectorsAvailable bool
+2 -1
View File
@@ -920,6 +920,7 @@ func NewSetSealConfigFunc(r repo.LockedRepo) (dtypes.SetSealingConfigFunc, error
MaxUpgradingSectors: cfg.MaxUpgradingSectors, MaxUpgradingSectors: cfg.MaxUpgradingSectors,
CommittedCapacitySectorLifetime: config.Duration(cfg.CommittedCapacitySectorLifetime), CommittedCapacitySectorLifetime: config.Duration(cfg.CommittedCapacitySectorLifetime),
WaitDealsDelay: config.Duration(cfg.WaitDealsDelay), WaitDealsDelay: config.Duration(cfg.WaitDealsDelay),
MakeNewSectorForDeals: cfg.MakeNewSectorForDeals,
MakeCCSectorsAvailable: cfg.MakeCCSectorsAvailable, MakeCCSectorsAvailable: cfg.MakeCCSectorsAvailable,
AlwaysKeepUnsealedCopy: cfg.AlwaysKeepUnsealedCopy, AlwaysKeepUnsealedCopy: cfg.AlwaysKeepUnsealedCopy,
FinalizeEarly: cfg.FinalizeEarly, FinalizeEarly: cfg.FinalizeEarly,
@@ -959,7 +960,7 @@ func ToSealingConfig(dealmakingCfg config.DealmakingConfig, sealingCfg config.Se
PreferNewSectorsForDeals: sealingCfg.PreferNewSectorsForDeals, PreferNewSectorsForDeals: sealingCfg.PreferNewSectorsForDeals,
MaxUpgradingSectors: sealingCfg.MaxUpgradingSectors, MaxUpgradingSectors: sealingCfg.MaxUpgradingSectors,
StartEpochSealingBuffer: abi.ChainEpoch(dealmakingCfg.StartEpochSealingBuffer), StartEpochSealingBuffer: abi.ChainEpoch(dealmakingCfg.StartEpochSealingBuffer),
MakeNewSectorForDeals: dealmakingCfg.MakeNewSectorForDeals, MakeNewSectorForDeals: sealingCfg.MakeNewSectorForDeals,
CommittedCapacitySectorLifetime: time.Duration(sealingCfg.CommittedCapacitySectorLifetime), CommittedCapacitySectorLifetime: time.Duration(sealingCfg.CommittedCapacitySectorLifetime),
WaitDealsDelay: time.Duration(sealingCfg.WaitDealsDelay), WaitDealsDelay: time.Duration(sealingCfg.WaitDealsDelay),
MakeCCSectorsAvailable: sealingCfg.MakeCCSectorsAvailable, MakeCCSectorsAvailable: sealingCfg.MakeCCSectorsAvailable,