Add ability to introspect whats going on
Opened this issue · 1 comments
Reposting this issue here: filecoin-project/go-sectorbuilder#3
It would be nice to have some exposed apis that allow the user to query what the sectorbuilder is currently doing, like sealing N sectors in parallel, 65% complete, etc. Some sort of thing we could use to inspect why my cpu is melting.
I'm not exactly sure what i want from these apis, but i know we need something
It would be nice to have some exposed apis that allow the user to query what the sectorbuilder is currently doing, like sealing N sectors in parallel
Some version of what you ask for is possible with the existing API. Example: The following goroutine prints the sealing state for all staged sectors. If your sector builder is sealing 2 sectors in parallel, this will tell you as much:
go func() {
for {
allStagedSectors, err := sb.GetAllStagedSectors(ptr)
if err != nil {
panic(err)
}
for _, stagedSector := range allStagedSectors {
status, err := sb.GetSectorSealingStatusByID(ptr, stagedSector.SectorID)
if err != nil {
panic(err)
}
fmt.Printf("sector id: %d, state: %s\n", stagedSector.SectorID, status.State)
}
time.Sleep(1 * time.Second)
}
}()
This will tell you why your CPU is melting.
What other things would you like the sector builder to be able to tell you?