From 56d77e3996beddd83b457cf4e4a94a93ba300516 Mon Sep 17 00:00:00 2001 From: Taylor Downs Date: Thu, 9 Apr 2026 18:13:31 +0200 Subject: [PATCH] docs for cancel-pending --- docs/monitor-history/activity-history.md | 4 ++ docs/monitor-history/rerunning-workflow.md | 68 ++++++++++++++++++++-- docs/monitor-history/status-codes.md | 2 +- 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/docs/monitor-history/activity-history.md b/docs/monitor-history/activity-history.md index 2f620ec2d1f4..f1e51664ae66 100644 --- a/docs/monitor-history/activity-history.md +++ b/docs/monitor-history/activity-history.md @@ -34,6 +34,10 @@ OpenFn Workflows are executed as follows: `Run` will be created. If successful, then both the Run and related Work Order will be updated with a `success` status. +You can also **cancel** pending runs or **retry** completed work orders directly +from the History page. See [Retry & Cancel Runs](./rerunning-workflow.md) for +details. + ![History Page](/img/history-page-annotated.webp) Check out the other pages in this docs section to learn more about inspecting diff --git a/docs/monitor-history/rerunning-workflow.md b/docs/monitor-history/rerunning-workflow.md index d926afb628bc..3f685bed2e01 100644 --- a/docs/monitor-history/rerunning-workflow.md +++ b/docs/monitor-history/rerunning-workflow.md @@ -1,8 +1,30 @@ --- -title: Rerun after failures & Workflow edits -sidebar_label: Rerun failures +title: Retry & Cancel Runs +sidebar_label: Retry & Cancel --- +From the `History` page, you can take actions on Work Orders and Runs depending +on their current state. Use **Retry** to re-execute completed work orders, or +**Cancel** to remove pending runs from the queue. + +## Available Actions by Work Order State + +| Work Order State | Available Actions | +| :-------------------------------------------------------------------------------------------- | :---------------- | +| **Pending** (runs waiting in the queue) | Cancel | +| **Running** | None | +| **Final states** (Success, Failed, Crashed, Killed, Exception, Lost, Cancelled, Rejected) | Retry, Retry from | + +:::info Selecting work orders with mixed states + +When you select multiple work orders with different state categories (e.g., some +pending and some failed), both Retry and Cancel buttons will be disabled. Select +only work orders in the same state category to use bulk actions. + +::: + +## Retry a Work Order + Did a step in your workflow fail? Looking to resync historical data? Whatever the reason, watch the below video tutorial ([or see link](https://youtu.be/DvLRA6kloNE?si=U0NMx-HsCMZxeJwg)) to learn how @@ -10,7 +32,7 @@ to rerun your Workflow. -## Rerun via History page +### Retry via History page To rerun your Workflow from the `History` page: @@ -22,7 +44,7 @@ To rerun your Workflow from the `History` page: 4. This will create a new `Run` related to the same Work Order. Check the `Status` to see if this Run successfully completed the Work Order. -## Rerun via Inspector view +### Retry via Inspector view To rerun your Workflow from the `Inspector` page: @@ -40,3 +62,41 @@ To rerun your Workflow from the `Inspector` page: 6. If you prefer to create a _new_ Work Order (instead of retrying the same Work Order), you can click the dropdown next to "Rerun from here" and _instead_ choose `Create New Work Order`. + +## Cancel Pending Runs + +If runs are stuck in the queue or were created by mistake, you can cancel them. +Cancelling moves runs from `available` to `cancelled` and updates the +corresponding work order status from `pending` to `cancelled`. See +[Status Codes](./status-codes.md) for more on what each status means. + +There are several ways to cancel: + +- **Cancel all runs for a work order:** Click the action button on a pending + work order row in the History page to cancel all of its pending runs. +- **Cancel a single run:** Click the cancel button next to an individual run + item, either in the run list or on the run detail page. + +:::note Runs that start before confirmation + +If a pending run begins executing between the time you open the cancel +confirmation dialog and the time you confirm, that run will **not** be +cancelled. Only runs still in the queue at the moment of confirmation are +affected. + +::: + +## Bulk Actions + +You can act on multiple work orders at once by selecting them via checkboxes on +the History page: + +- **Bulk Cancel:** Select work orders in the `Pending` state, then click the + `Cancel` button to cancel all pending runs across the selected work orders. +- **Bulk Retry:** Select work orders in a final state (e.g., Failed, Crashed), + then click the `Retry` button. + +Bulk action buttons are only enabled when all selected work orders share the +same state category. Selecting work orders with mixed states (e.g., some pending +and some failed) or selecting only running work orders will disable all action +buttons. diff --git a/docs/monitor-history/status-codes.md b/docs/monitor-history/status-codes.md index 27a5cc4c1944..1ef16e1d4954 100644 --- a/docs/monitor-history/status-codes.md +++ b/docs/monitor-history/status-codes.md @@ -33,7 +33,7 @@ Every Run has a status which indicates whether it completed successfully. | Failed | 🔴 | RangeError | No | Calling `state.patients[5]` when only 2 patients exist | | Crashed | 🟠 | SyntaxError | Yes | You've got some bad JavaScript and the worker cannot compile your job code | | Crashed | 🟠 | ReferenceError | Yes | You've got an undeclared variable in your job code | -| Cancelled | ⚪ | | Yes | The run had been enqueued but was manually removed from the queue | +| Cancelled | ⚪ | | Yes | The run had been enqueued but was [manually removed](./rerunning-workflow.md#cancel-pending-runs) from the queue | | Killed | 🟡 | SecurityError | Yes | Your code failed security checks, e.g. tried to use `eval` | | Killed | 🟡 | ImportError | Yes | You tried to import external module that we don't allow | | Killed | 🟡 | OomError | Yes | Your run used more memory than allowed by the Lightning instance |