From ca53bf90979898f2790c47eb6eb9fb7e002117f1 Mon Sep 17 00:00:00 2001 From: Travis Person <165274+travisperson@users.noreply.github.com> Date: Wed, 5 Aug 2020 17:54:00 -0700 Subject: [PATCH] lotus-worker: change address flag to listen (#2848) * lotus-worker: change address flag to listen Clarify the flag on the worker process to be the local address and port the worker will listen on, and not the address of the miner. * fixup! lotus-worker: change address flag to listen Co-authored-by: Travis Person --- cmd/lotus-seal-worker/main.go | 24 +++++++++++++++++++----- documentation/en/mining-lotus-worker.md | 12 ++++++------ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/cmd/lotus-seal-worker/main.go b/cmd/lotus-seal-worker/main.go index 615c0351f..c0c71d389 100644 --- a/cmd/lotus-seal-worker/main.go +++ b/cmd/lotus-seal-worker/main.go @@ -93,10 +93,14 @@ var runCmd = &cli.Command{ Usage: "Start lotus worker", Flags: []cli.Flag{ &cli.StringFlag{ - Name: "address", - Usage: "locally reachable address", + Name: "listen", + Usage: "host address and port the worker api will listen on", Value: "0.0.0.0:3456", }, + &cli.StringFlag{ + Name: "address", + Hidden: true, + }, &cli.BoolFlag{ Name: "no-local-storage", Usage: "don't use storageminer repo for sector storage", @@ -123,10 +127,20 @@ var runCmd = &cli.Command{ }, &cli.StringFlag{ Name: "timeout", - Usage: "used when address is unspecified. must be a valid duration recognized by golang's time.ParseDuration function", + Usage: "used when 'listen' is unspecified. must be a valid duration recognized by golang's time.ParseDuration function", Value: "30m", }, }, + Before: func(cctx *cli.Context) error { + if cctx.IsSet("address") { + log.Warnf("The '--address' flag is deprecated, it has been replaced by '--listen'") + if err := cctx.Set("listen", cctx.String("address")); err != nil { + return err + } + } + + return nil + }, Action: func(cctx *cli.Context) error { if !cctx.Bool("enable-gpu-proving") { if err := os.Setenv("BELLMAN_NO_GPU", "true"); err != nil { @@ -268,7 +282,7 @@ var runCmd = &cli.Command{ log.Info("Opening local storage; connecting to master") const unspecifiedAddress = "0.0.0.0" - address := cctx.String("address") + address := cctx.String("listen") addressSlice := strings.Split(address, ":") if ip := net.ParseIP(addressSlice[0]); ip != nil { if ip.String() == unspecifiedAddress { @@ -394,7 +408,7 @@ func watchMinerConn(ctx context.Context, cctx *cli.Context, nodeApi api.StorageM fmt.Sprintf("--miner-repo=%s", cctx.String("miner-repo")), fmt.Sprintf("--enable-gpu-proving=%t", cctx.Bool("enable-gpu-proving")), "run", - fmt.Sprintf("--address=%s", cctx.String("address")), + fmt.Sprintf("--listen=%s", cctx.String("listen")), fmt.Sprintf("--no-local-storage=%t", cctx.Bool("no-local-storage")), fmt.Sprintf("--precommit1=%t", cctx.Bool("precommit1")), fmt.Sprintf("--precommit2=%t", cctx.Bool("precommit2")), diff --git a/documentation/en/mining-lotus-worker.md b/documentation/en/mining-lotus-worker.md index 144fbc954..da9ab0997 100644 --- a/documentation/en/mining-lotus-worker.md +++ b/documentation/en/mining-lotus-worker.md @@ -47,15 +47,15 @@ On the machine that will run `lotus-worker`, set the `MINER_API_INFO` environmen Once this is set, run: ```sh -lotus-worker run --address 192.168.2.10:2345 +lotus-worker run ``` -Replace `192.168.2.10:2345` with the proper IP and port. +If you are running multiple workers on the same host, you will need to specify the `--listen` flag and ensure each worker is on a different port. -To check that the **Lotus Worker** is connected to your **Lotus Miner**, run `lotus-miner workers list` and check that the remote worker count has increased. +To check that the **Lotus Worker** is connected to your **Lotus Miner**, run `lotus-miner sealing workers` and check that the remote worker count has increased. ```sh -why@computer ~/lotus> lotus-miner workers list +why@computer ~/lotus> lotus-miner sealing workers Worker 0, host computer CPU: [ ] 0 core(s) in use RAM: [|||||||||||||||||| ] 28% 18.1 GiB/62.7 GiB @@ -77,5 +77,5 @@ To do so you have to first __disable all seal task types__ in the miner config. You can then run the miner on your local-loopback interface; ```sh -lotus-worker run --address 127.0.0.1:2345 -``` \ No newline at end of file +lotus-worker run +```