Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/monitor-history/activity-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
68 changes: 64 additions & 4 deletions docs/monitor-history/rerunning-workflow.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
---
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
to rerun your Workflow.

<iframe width="784" height="441" src="https://www.youtube.com/embed/DvLRA6kloNE?si=Seczc1JFhThQBbUv" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

## Rerun via History page
### Retry via History page

To rerun your Workflow from the `History` page:

Expand All @@ -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:

Expand All @@ -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.
2 changes: 1 addition & 1 deletion docs/monitor-history/status-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
Loading