Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Add ability to introspect whats going on #27

Open
whyrusleeping opened this issue Aug 2, 2019 · 1 comment
Open

Add ability to introspect whats going on #27

whyrusleeping opened this issue Aug 2, 2019 · 1 comment

Comments

@whyrusleeping
Copy link
Member

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

@laser
Copy link
Contributor

laser commented Sep 13, 2019

@whyrusleeping

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants