diff --git a/cmd/lotus-seal-worker/main.go b/cmd/lotus-seal-worker/main.go index a0fd0abc2..efa4aa015 100644 --- a/cmd/lotus-seal-worker/main.go +++ b/cmd/lotus-seal-worker/main.go @@ -75,91 +75,91 @@ var runCmd = &cli.Command{ Name: "run", Usage: "Start lotus worker", Action: func(cctx *cli.Context) error { - /* if !cctx.Bool("enable-gpu-proving") { - os.Setenv("BELLMAN_NO_GPU", "true") - } + /* if !cctx.Bool("enable-gpu-proving") { + os.Setenv("BELLMAN_NO_GPU", "true") + } - nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx) - if err != nil { - return xerrors.Errorf("getting miner api: %w", err) - } - defer closer() - ctx := lcli.ReqContext(cctx) + nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx) + if err != nil { + return xerrors.Errorf("getting miner api: %w", err) + } + defer closer() + ctx := lcli.ReqContext(cctx) - ainfo, err := lcli.GetAPIInfo(cctx, repo.StorageMiner) - if err != nil { - return xerrors.Errorf("could not get api info: %w", err) - } - _, storageAddr, err := manet.DialArgs(ainfo.Addr) + ainfo, err := lcli.GetAPIInfo(cctx, repo.StorageMiner) + if err != nil { + return xerrors.Errorf("could not get api info: %w", err) + } + _, storageAddr, err := manet.DialArgs(ainfo.Addr) - r, err := homedir.Expand(cctx.String("repo")) - if err != nil { - return err - } + r, err := homedir.Expand(cctx.String("repo")) + if err != nil { + return err + } - v, err := nodeApi.Version(ctx) - if err != nil { - return err - } - if v.APIVersion != build.APIVersion { - return xerrors.Errorf("lotus-storage-miner API version doesn't match: local: ", api.Version{APIVersion: build.APIVersion}) - } + v, err := nodeApi.Version(ctx) + if err != nil { + return err + } + if v.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() { - 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 - } + <-ctx.Done() + log.Warn("Shutting down..") }() - } - 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 }, } diff --git a/cmd/lotus-seal-worker/sub.go b/cmd/lotus-seal-worker/sub.go index 31f28786b..d11df2acc 100644 --- a/cmd/lotus-seal-worker/sub.go +++ b/cmd/lotus-seal-worker/sub.go @@ -1,4 +1,5 @@ package main + /* import ( "context" @@ -128,4 +129,4 @@ func (w *worker) processTask(ctx context.Context, task sectorbuilder.WorkerTask) func errRes(err error) sectorbuilder.SealRes { return sectorbuilder.SealRes{Err: err.Error(), GoErr: err} } -*/ \ No newline at end of file +*/ diff --git a/cmd/lotus-seal-worker/transfer.go b/cmd/lotus-seal-worker/transfer.go index 12505ae44..fe4a07dba 100644 --- a/cmd/lotus-seal-worker/transfer.go +++ b/cmd/lotus-seal-worker/transfer.go @@ -1,4 +1,5 @@ package main + /* import ( "fmt" @@ -174,4 +175,4 @@ func (w *worker) fetchSector(sectorID abi.SectorNumber, typ sectorbuilder.Worker } return nil } -*/ \ No newline at end of file +*/ diff --git a/go.mod b/go.mod index 7e3a60ac1..482296b7b 100644 --- a/go.mod +++ b/go.mod @@ -105,7 +105,6 @@ require ( golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 golang.org/x/tools v0.0.0-20200108195415-316d2f248479 // indirect 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 gotest.tools v2.2.0+incompatible launchpad.net/gocheck v0.0.0-20140225173054-000000000087 // indirect