Skip to content

Commit

Permalink
Merge pull request #853 from ipfs-force-community/fix/0x5459/revert-a…
Browse files Browse the repository at this point in the history
…bort-command

fix(manager): revert the sectors abort command
  • Loading branch information
LinZexiao authored Jul 31, 2023
2 parents 050107b + 1ca3abe commit 6b93d6f
Showing 1 changed file with 37 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,36 +114,44 @@ var utilSealerSectorsAbortCmd = &cli.Command{
Name: "abort",
Usage: "Abort specified online sector job",
ArgsUsage: "<miner actor> <sector number>",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "really-do-it",
Usage: "WARNING: This command may result in inconsistent state of damocles-manager and damocles-worker. If you know what you're doing, use it",
Value: false,
},
},
Action: func(cctx *cli.Context) error {
return fmt.Errorf("this command is not available in the current version, please use the `damocles-worker worker -c <config file path> resume --state Aborted --index <index>` or `damocles-manager util worker resume <worker instance name or address> <thread index> Aborted` commands instead.\n See: https://github.com/ipfs-force-community/damocles/blob/main/docs/en/11.task-status-flow.md#1-for-a-sector-sealing-task-that-has-been-paused-due-to-an-error-and-cannot-be-resumed-such-as-the-ticket-has-expired-you-can-use")
// if count := cctx.Args().Len(); count < 2 {
// return fmt.Errorf("both miner actor id & sector number are required, only %d args provided", count)
// }

// miner, err := ShouldActor(cctx.Args().Get(0), true)
// if err != nil {
// return fmt.Errorf("invalid miner actor id: %w", err)
// }

// sectorNum, err := strconv.ParseUint(cctx.Args().Get(1), 10, 64)
// if err != nil {
// return fmt.Errorf("invalid sector number: %w", err)
// }

// cli, gctx, stop, err := extractAPI(cctx)
// if err != nil {
// return err
// }

// defer stop()

// _, err = cli.Sealer.ReportAborted(gctx, abi.SectorID{
// Miner: miner,
// Number: abi.SectorNumber(sectorNum),
// }, "aborted via CLI")
// if err != nil {
// return fmt.Errorf("abort sector failed: %w", err)
// }
// return fmt.Errorf("this command is not available in the current version, please use the `damocles-worker worker -c <config file path> resume --state Aborted --index <index>` or `damocles-manager util worker resume <worker instance name or address> <thread index> Aborted` commands instead.\n See: https://github.com/ipfs-force-community/damocles/blob/main/docs/en/11.task-status-flow.md#1-for-a-sector-sealing-task-that-has-been-paused-due-to-an-error-and-cannot-be-resumed-such-as-the-ticket-has-expired-you-can-use")
if count := cctx.Args().Len(); count < 2 {
return fmt.Errorf("both miner actor id & sector number are required, only %d args provided", count)
}

miner, err := ShouldActor(cctx.Args().Get(0), true)
if err != nil {
return fmt.Errorf("invalid miner actor id: %w", err)
}

sectorNum, err := strconv.ParseUint(cctx.Args().Get(1), 10, 64)
if err != nil {
return fmt.Errorf("invalid sector number: %w", err)
}

cli, gctx, stop, err := extractAPI(cctx)
if err != nil {
return err
}

defer stop()

_, err = cli.Damocles.ReportAborted(gctx, abi.SectorID{
Miner: miner,
Number: abi.SectorNumber(sectorNum),
}, "aborted via CLI")
if err != nil {
return fmt.Errorf("abort sector failed: %w", err)
}
return nil
},
}

Expand Down

0 comments on commit 6b93d6f

Please sign in to comment.