Skip to content

Commit 54daeee

Browse files
authored
[Workflows] Added pause and resume commands to manage Workflows and removed the delete command (#17855)
1 parent 631374d commit 54daeee

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

src/content/docs/workers/wrangler/commands.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,6 @@ wrangler workflows instances terminate <WORKFLOW_NAME> <ID> [OPTIONS]
13251325
- `ID` <Type text="string" /> <MetaInfo text="required" />
13261326
- The ID of a Workflow instance.
13271327

1328-
{/*
13291328
### `instances pause`
13301329

13311330
Pause (until resumed) a Workflow instance.
@@ -1352,8 +1351,6 @@ wrangler workflows instances resume <WORKFLOW_NAME> <ID> [OPTIONS]
13521351
- `ID` <Type text="string" /> <MetaInfo text="required" />
13531352
- The ID of a Workflow instance.
13541353

1355-
*/}
1356-
13571354
### `describe`
13581355

13591356
```sh
@@ -1367,7 +1364,7 @@ wrangler workflows describe <WORKFLOW_NAME> [OPTIONS]
13671364

13681365
Trigger (create) a Workflow instance.
13691366
```sh
1370-
wrangler workflows describe <WORKFLOW_NAME> <PARAMS> [OPTIONS]
1367+
wrangler workflows trigger <WORKFLOW_NAME> <PARAMS> [OPTIONS]
13711368
```
13721369

13731370
- `WORKFLOW_NAME` <Type text="string" /> <MetaInfo text="required" />
@@ -1377,9 +1374,11 @@ wrangler workflows describe <WORKFLOW_NAME> <PARAMS> [OPTIONS]
13771374

13781375
```sh
13791376
# Pass optional params to the Workflow.
1380-
wrangler workflows instances trigger my-workflow '{"hello":"world"}'
1377+
wrangler workflows trigger my-workflow '{"hello":"world"}'
13811378
```
13821379

1380+
{/*
1381+
13831382
### `delete`
13841383
13851384
Delete (unregister) a Workflow.
@@ -1391,6 +1390,8 @@ wrangler workflows delete <WORKFLOW_NAME> [OPTIONS]
13911390
- `WORKFLOW_NAME` <Type text="string" /> <MetaInfo text="required" />
13921391
- The name of a registered Workflow.
13931392
1393+
*/}
1394+
13941395
## `tail`
13951396

13961397
Start a session to livestream logs from a deployed Worker.

src/content/docs/workflows/build/sleeping-and-retrying.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const defaultConfig: WorkflowStepConfig = {
7070
When providing your own `StepConfig`, you can configure:
7171

7272
* The total number of attempts to make for a step
73-
* The delay between attempts
73+
* The delay between attempts (accepts both `number` (ms) or a human-readable format)
7474
* What backoff algorithm to apply between each attempt: any of `constant`, `linear`, or `exponential`
7575
* When to timeout (in duration) before considering the step as failed (including during a retry attempt)
7676

src/content/docs/workflows/build/trigger-workflows.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,20 @@ interface Env {
6262

6363
export default {
6464
async fetch(req: Request, env: Env) {
65-
//
66-
const instanceId = new URL(req.url).searchParams.get("instanceId")
65+
// Get instanceId from query parameters
66+
const instanceId = new URL(req.url).searchParams.get("instanceId")
6767

68-
// If an ?instanceId=<id> query parameter is provided, fetch the status
69-
// of an existing Workflow by its ID.
70-
if (instanceId) {
71-
let instance = await env.MY_WORKFLOW.get(instanceId);
68+
// If an ?instanceId=<id> query parameter is provided, fetch the status
69+
// of an existing Workflow by its ID.
70+
if (instanceId) {
71+
let instance = await env.MY_WORKFLOW.get(instanceId);
7272
return Response.json({
7373
status: await instance.status(),
7474
});
75-
}
75+
}
7676

77-
// Else, create a new instance of our Workflow, passing in any (optional) params
78-
// and return the ID.
77+
// Else, create a new instance of our Workflow, passing in any (optional)
78+
// params and return the ID.
7979
const newId = await crypto.randomUUID();
8080
let instance = await env.MY_WORKFLOW.create({ id: newId });
8181
return Response.json({

src/content/docs/workflows/get-started/guide.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,8 @@ curl -s https://workflows-starter.YOUR_WORKERS_SUBDOMAIN.workers.dev/
507507
{"id":"16ac31e5-db9d-48ae-a58f-95b95422d0fa","details":{"status":"queued","error":null,"output":null}}
508508
```
509509

510+
{/*
511+
510512
## 7. (Optional) Clean up
511513
512514
You can optionally delete the Workflow, which will prevent the creation of any (all) instances by using `wrangler`:
@@ -517,6 +519,8 @@ npx wrangler workflows delete my-workflow
517519
518520
Re-deploying the Workers script containing your Workflow code will re-create the Workflow.
519521
522+
*/}
523+
520524
---
521525

522526
## Next steps

0 commit comments

Comments
 (0)