Merge pull request #4662 from filecoin-project/feat/force-sched-cli

Debug flag to force running sealing scheduler
This commit is contained in:
Łukasz Magiera 2020-10-30 20:15:49 +01:00 committed by GitHub
commit fb492d9acb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 8 deletions

View File

@ -70,7 +70,7 @@ type StorageMiner interface {
storiface.WorkerReturn storiface.WorkerReturn
// SealingSchedDiag dumps internal sealing scheduler state // SealingSchedDiag dumps internal sealing scheduler state
SealingSchedDiag(context.Context) (interface{}, error) SealingSchedDiag(ctx context.Context, doSched bool) (interface{}, error)
stores.SectorIndex stores.SectorIndex

View File

@ -321,7 +321,7 @@ type StorageMinerStruct struct {
ReturnReadPiece func(ctx context.Context, callID storiface.CallID, ok bool, err string) error `perm:"admin" retry:"true"` ReturnReadPiece func(ctx context.Context, callID storiface.CallID, ok bool, err string) error `perm:"admin" retry:"true"`
ReturnFetch func(ctx context.Context, callID storiface.CallID, err string) error `perm:"admin" retry:"true"` ReturnFetch func(ctx context.Context, callID storiface.CallID, err string) error `perm:"admin" retry:"true"`
SealingSchedDiag func(context.Context) (interface{}, error) `perm:"admin"` SealingSchedDiag func(context.Context, bool) (interface{}, error) `perm:"admin"`
StorageList func(context.Context) (map[stores.ID][]stores.Decl, error) `perm:"admin"` StorageList func(context.Context) (map[stores.ID][]stores.Decl, error) `perm:"admin"`
StorageLocal func(context.Context) (map[stores.ID]string, error) `perm:"admin"` StorageLocal func(context.Context) (map[stores.ID]string, error) `perm:"admin"`
@ -1298,8 +1298,8 @@ func (c *StorageMinerStruct) ReturnFetch(ctx context.Context, callID storiface.C
return c.Internal.ReturnFetch(ctx, callID, err) return c.Internal.ReturnFetch(ctx, callID, err)
} }
func (c *StorageMinerStruct) SealingSchedDiag(ctx context.Context) (interface{}, error) { func (c *StorageMinerStruct) SealingSchedDiag(ctx context.Context, doSched bool) (interface{}, error) {
return c.Internal.SealingSchedDiag(ctx) return c.Internal.SealingSchedDiag(ctx, doSched)
} }
func (c *StorageMinerStruct) StorageAttach(ctx context.Context, si stores.StorageInfo, st fsutil.FsStat) error { func (c *StorageMinerStruct) StorageAttach(ctx context.Context, si stores.StorageInfo, st fsutil.FsStat) error {

View File

@ -215,6 +215,11 @@ var sealingJobsCmd = &cli.Command{
var sealingSchedDiagCmd = &cli.Command{ var sealingSchedDiagCmd = &cli.Command{
Name: "sched-diag", Name: "sched-diag",
Usage: "Dump internal scheduler state", Usage: "Dump internal scheduler state",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "force-sched",
},
},
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx) nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil { if err != nil {
@ -224,7 +229,7 @@ var sealingSchedDiagCmd = &cli.Command{
ctx := lcli.ReqContext(cctx) ctx := lcli.ReqContext(cctx)
st, err := nodeApi.SealingSchedDiag(ctx) st, err := nodeApi.SealingSchedDiag(ctx, cctx.Bool("force-sched"))
if err != nil { if err != nil {
return err return err
} }

View File

@ -679,7 +679,15 @@ func (m *Manager) FsStat(ctx context.Context, id stores.ID) (fsutil.FsStat, erro
return m.storage.FsStat(ctx, id) return m.storage.FsStat(ctx, id)
} }
func (m *Manager) SchedDiag(ctx context.Context) (interface{}, error) { func (m *Manager) SchedDiag(ctx context.Context, doSched bool) (interface{}, error) {
if doSched {
select {
case m.sched.workerChange <- struct{}{}:
case <-ctx.Done():
return nil, ctx.Err()
}
}
return m.sched.Info(ctx) return m.sched.Info(ctx)
} }

View File

@ -296,8 +296,8 @@ func (sm *StorageMinerAPI) WorkerConnect(ctx context.Context, url string) error
return sm.StorageMgr.AddWorker(ctx, w) return sm.StorageMgr.AddWorker(ctx, w)
} }
func (sm *StorageMinerAPI) SealingSchedDiag(ctx context.Context) (interface{}, error) { func (sm *StorageMinerAPI) SealingSchedDiag(ctx context.Context, doSched bool) (interface{}, error) {
return sm.StorageMgr.SchedDiag(ctx) return sm.StorageMgr.SchedDiag(ctx, doSched)
} }
func (sm *StorageMinerAPI) MarketImportDealData(ctx context.Context, propCid cid.Cid, path string) error { func (sm *StorageMinerAPI) MarketImportDealData(ctx context.Context, propCid cid.Cid, path string) error {