-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lotus-miner: expose Config in StorageMiner; add SealingPipelineState API endpoint #7513
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ import ( | |
"github.com/filecoin-project/lotus/chain/types" | ||
"github.com/filecoin-project/lotus/markets/storageadapter" | ||
"github.com/filecoin-project/lotus/miner" | ||
"github.com/filecoin-project/lotus/node/config" | ||
"github.com/filecoin-project/lotus/node/modules/dtypes" | ||
"github.com/filecoin-project/lotus/storage" | ||
"github.com/filecoin-project/lotus/storage/sectorblocks" | ||
|
@@ -60,6 +61,8 @@ type StorageMinerAPI struct { | |
|
||
EnabledSubsystems api.MinerSubsystems | ||
|
||
Config *config.StorageMiner | ||
|
||
Full api.FullNode | ||
LocalStore *stores.Local | ||
RemoteStore *stores.Remote | ||
|
@@ -123,6 +126,28 @@ func (sm *StorageMinerAPI) ServeRemote(perm bool) func(w http.ResponseWriter, r | |
} | ||
} | ||
|
||
func (sm *StorageMinerAPI) SealingPipelineState(ctx context.Context) (*api.SealingPipelineState, error) { | ||
jobs, err := sm.WorkerJobs(ctx) | ||
if err != nil { | ||
return nil, xerrors.Errorf("getting worker jobs: %w", err) | ||
} | ||
Comment on lines
+130
to
+133
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
jobsCount := make(map[string]int) | ||
|
||
for _, wj := range jobs { | ||
for _, j := range wj { | ||
jobsCount[j.Task.Short()] = jobsCount[j.Task.Short()] + 1 | ||
} | ||
} | ||
|
||
return &api.SealingPipelineState{ | ||
TaskJobsCount: jobsCount, | ||
MaxWaitDealsSectors: sm.Config.Sealing.MaxWaitDealsSectors, | ||
MaxSealingSectors: sm.Config.Sealing.MaxSealingSectors, | ||
MaxSealingSectorsForDeals: sm.Config.Sealing.MaxSealingSectorsForDeals, | ||
}, nil | ||
} | ||
|
||
func (sm *StorageMinerAPI) WorkerStats(context.Context) (map[uuid.UUID]storiface.WorkerStats, error) { | ||
return sm.StorageMgr.WorkerStats(), nil | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least the
Sealing
part of the config supports auto-reloading (this is why we have the getConfig function in the sealing package) - but just putting this config here like that won't get you updated values after changing the config on diskThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(side note: we really need to unify how we support dynamic config, and make that nicer / more fully supported)