gofmt; mod tidy
This commit is contained in:
parent
d10b84d8cd
commit
a5c6d83cd9
@ -75,91 +75,91 @@ var runCmd = &cli.Command{
|
|||||||
Name: "run",
|
Name: "run",
|
||||||
Usage: "Start lotus worker",
|
Usage: "Start lotus worker",
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
/* if !cctx.Bool("enable-gpu-proving") {
|
/* if !cctx.Bool("enable-gpu-proving") {
|
||||||
os.Setenv("BELLMAN_NO_GPU", "true")
|
os.Setenv("BELLMAN_NO_GPU", "true")
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
|
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("getting miner api: %w", err)
|
return xerrors.Errorf("getting miner api: %w", err)
|
||||||
}
|
}
|
||||||
defer closer()
|
defer closer()
|
||||||
ctx := lcli.ReqContext(cctx)
|
ctx := lcli.ReqContext(cctx)
|
||||||
|
|
||||||
ainfo, err := lcli.GetAPIInfo(cctx, repo.StorageMiner)
|
ainfo, err := lcli.GetAPIInfo(cctx, repo.StorageMiner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("could not get api info: %w", err)
|
return xerrors.Errorf("could not get api info: %w", err)
|
||||||
}
|
}
|
||||||
_, storageAddr, err := manet.DialArgs(ainfo.Addr)
|
_, storageAddr, err := manet.DialArgs(ainfo.Addr)
|
||||||
|
|
||||||
r, err := homedir.Expand(cctx.String("repo"))
|
r, err := homedir.Expand(cctx.String("repo"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
v, err := nodeApi.Version(ctx)
|
v, err := nodeApi.Version(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if v.APIVersion != build.APIVersion {
|
if v.APIVersion != build.APIVersion {
|
||||||
return xerrors.Errorf("lotus-storage-miner API version doesn't match: local: ", api.Version{APIVersion: build.APIVersion})
|
return xerrors.Errorf("lotus-storage-miner API version doesn't match: local: ", api.Version{APIVersion: build.APIVersion})
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
|
||||||
<-ctx.Done()
|
|
||||||
log.Warn("Shutting down..")
|
|
||||||
}()
|
|
||||||
|
|
||||||
limiter := &limits{
|
|
||||||
workLimit: make(chan struct{}, workers),
|
|
||||||
transferLimit: make(chan struct{}, transfers),
|
|
||||||
}
|
|
||||||
|
|
||||||
act, err := nodeApi.ActorAddress(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
ssize, err := nodeApi.ActorSectorSize(ctx, act)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := paramfetch.GetParams(build.ParametersJson(), uint64(ssize)); err != nil {
|
|
||||||
return xerrors.Errorf("get params: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*ppt, spt, err := api.ProofTypeFromSectorSize(ssize)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
/*sb, err := sectorbuilder.NewStandalone(§orbuilder.Config{
|
|
||||||
SealProofType: spt,
|
|
||||||
PoStProofType: ppt,
|
|
||||||
Miner: act,
|
|
||||||
WorkerThreads: workers,
|
|
||||||
Paths: sectorbuilder.SimplePath(r),
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
nQueues := workers + transfers
|
|
||||||
var wg sync.WaitGroup
|
|
||||||
wg.Add(nQueues)
|
|
||||||
|
|
||||||
for i := 0; i < nQueues; i++ {
|
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
<-ctx.Done()
|
||||||
|
log.Warn("Shutting down..")
|
||||||
/* if err := acceptJobs(ctx, nodeApi, sb, limiter, "http://"+storageAddr, ainfo.AuthHeader(), r, cctx.Bool("no-precommit"), cctx.Bool("no-commit")); err != nil {
|
|
||||||
log.Warnf("%+v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
}
|
|
||||||
|
|
||||||
wg.Wait()*/
|
limiter := &limits{
|
||||||
|
workLimit: make(chan struct{}, workers),
|
||||||
|
transferLimit: make(chan struct{}, transfers),
|
||||||
|
}
|
||||||
|
|
||||||
|
act, err := nodeApi.ActorAddress(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ssize, err := nodeApi.ActorSectorSize(ctx, act)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := paramfetch.GetParams(build.ParametersJson(), uint64(ssize)); err != nil {
|
||||||
|
return xerrors.Errorf("get params: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*ppt, spt, err := api.ProofTypeFromSectorSize(ssize)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
/*sb, err := sectorbuilder.NewStandalone(§orbuilder.Config{
|
||||||
|
SealProofType: spt,
|
||||||
|
PoStProofType: ppt,
|
||||||
|
Miner: act,
|
||||||
|
WorkerThreads: workers,
|
||||||
|
Paths: sectorbuilder.SimplePath(r),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
nQueues := workers + transfers
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
wg.Add(nQueues)
|
||||||
|
|
||||||
|
for i := 0; i < nQueues; i++ {
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
/* if err := acceptJobs(ctx, nodeApi, sb, limiter, "http://"+storageAddr, ainfo.AuthHeader(), r, cctx.Bool("no-precommit"), cctx.Bool("no-commit")); err != nil {
|
||||||
|
log.Warnf("%+v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()*/
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
/*
|
/*
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@ -128,4 +129,4 @@ func (w *worker) processTask(ctx context.Context, task sectorbuilder.WorkerTask)
|
|||||||
func errRes(err error) sectorbuilder.SealRes {
|
func errRes(err error) sectorbuilder.SealRes {
|
||||||
return sectorbuilder.SealRes{Err: err.Error(), GoErr: err}
|
return sectorbuilder.SealRes{Err: err.Error(), GoErr: err}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
/*
|
/*
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -174,4 +175,4 @@ func (w *worker) fetchSector(sectorID abi.SectorNumber, typ sectorbuilder.Worker
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
1
go.mod
1
go.mod
@ -105,7 +105,6 @@ require (
|
|||||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
|
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
|
||||||
golang.org/x/tools v0.0.0-20200108195415-316d2f248479 // indirect
|
golang.org/x/tools v0.0.0-20200108195415-316d2f248479 // indirect
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
|
||||||
gopkg.in/cheggaaa/pb.v1 v1.0.28
|
|
||||||
gopkg.in/urfave/cli.v2 v2.0.0-20180128182452-d3ae77c26ac8
|
gopkg.in/urfave/cli.v2 v2.0.0-20180128182452-d3ae77c26ac8
|
||||||
gotest.tools v2.2.0+incompatible
|
gotest.tools v2.2.0+incompatible
|
||||||
launchpad.net/gocheck v0.0.0-20140225173054-000000000087 // indirect
|
launchpad.net/gocheck v0.0.0-20140225173054-000000000087 // indirect
|
||||||
|
Loading…
Reference in New Issue
Block a user