Skip to content

Commit d6bf973

Browse files
committed
Adds documentation for $ dapr scheduler
See dapr/cli#1559 Signed-off-by: joshvanl <[email protected]>
1 parent d9ce2af commit d6bf973

File tree

6 files changed

+424
-13
lines changed

6 files changed

+424
-13
lines changed

daprdocs/content/en/concepts/dapr-services/scheduler.md

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,25 +115,85 @@ services:
115115
- ./dapr_scheduler/2:/var/run/dapr/scheduler
116116
```
117117
118-
## Back Up and Restore Scheduler Data
118+
## Managing jobs with the Dapr CLI
119119
120-
In production environments, it's recommended to perform periodic backups of this data at an interval that aligns with your recovery point objectives.
120+
Dapr provides a CLI for inspecting and managing all scheduled jobs, regardless of type.
121+
The CLI is the recommended way to view, back up, and delete jobs.
121122
122-
### Port Forward for Backup Operations
123123
124-
To perform backup and restore operations, you'll need to access the embedded etcd instance. This requires port forwarding to expose the etcd ports (port 2379).
124+
### List jobs
125125
126-
#### Kubernetes Example
126+
```bash
127+
dapr scheduler list
128+
```
127129

128-
Here's how to port forward and connect to the etcd instance:
130+
Example output:
131+
132+
```bash
133+
NAME BEGIN COUNT LAST TRIGGER
134+
actor/myactortype/actorid1/test1 -3.89s 1 2025-10-03T16:58:55Z
135+
actor/myactortype/actorid2/test2 -3.89s 1 2025-10-03T16:58:55Z
136+
app/test-scheduler/test1 -3.89s 1 2025-10-03T16:58:55Z
137+
app/test-scheduler/test2 -3.89s 1 2025-10-03T16:58:55Z
138+
activity/test-scheduler/xyz1::0::1 -888.8ms 0
139+
activity/test-scheduler/xyz2::0::1 -888.8ms 0
140+
workflow/test-scheduler/abc1/timer-0-TVIQGkvu +50.0h 0
141+
workflow/test-scheduler/abc2/timer-0-OM2xqG9m +50.0h 0
142+
```
129143

130-
```shell
131-
kubectl port-forward svc/dapr-scheduler-server 2379:2379 -n dapr-system
144+
For more detail, use the wide output format:
145+
146+
```bash
147+
dapr scheduler list -o wide
148+
```
149+
150+
```yaml
151+
NAMESPACE NAME BEGIN EXPIRATION SCHEDULE DUE TIME TTL REPEATS COUNT LAST TRIGGER
152+
default actor/myactortype/actorid1/test1 2025-10-03T16:58:55Z @every 2h46m40s 2025-10-03T17:58:55+01:00 100 1 2025-10-03T16:58:55Z
153+
default actor/myactortype/actorid2/test2 2025-10-03T16:58:55Z @every 2h46m40s 2025-10-03T17:58:55+01:00 100 1 2025-10-03T16:58:55Z
154+
default app/test-scheduler/test1 2025-10-03T16:58:55Z @every 100m 2025-10-03T17:58:55+01:00 1234 1 2025-10-03T16:58:55Z
155+
default app/test-scheduler/test2 2025-10-03T16:58:55Z 2025-10-03T19:45:35Z @every 100m 2025-10-03T17:58:55+01:00 10000s 56788 1 2025-10-03T16:58:55Z
156+
default activity/test-scheduler/xyz1::0::1 2025-10-03T16:58:58Z 0s 0
157+
default activity/test-scheduler/xyz2::0::1 2025-10-03T16:58:58Z 0s 0
158+
default workflow/test-scheduler/abc1/timer-0-TVIQGkvu 2025-10-05T18:58:58Z 2025-10-05T18:58:58Z 0
159+
default workflow/test-scheduler/abc2/timer-0-OM2xqG9m 2025-10-05T18:58:58Z 2025-10-05T18:58:58Z 0
160+
```
161+
162+
### Get job details
163+
164+
```bash
165+
dapr scheduler get app/my-app/job1 -o yaml
166+
```
167+
168+
### Delete jobs
169+
170+
Delete one or more specific jobs:
171+
172+
```bash
173+
dapr scheduler delete app/my-app/job1 actor/MyActor/123/reminder1
174+
```
175+
176+
Bulk delete jobs with filters:
177+
178+
```bash
179+
dapr scheduler delete-all all
180+
dapr scheduler delete-all app/my-app
181+
dapr scheduler delete-all actor/MyActorType
132182
```
133183

134-
### Performing Backup and Restore
184+
### Backup and restore jobs
135185

136-
Once you have access to the etcd ports, you can follow the [official etcd backup and restore documentation](https://etcd.io/docs/v3.5/op-guide/recovery/) to perform backup and restore operations. The process involves using standard etcd commands to create snapshots and restore from them.
186+
Export all jobs to a file:
187+
188+
```bash
189+
dapr scheduler export -o backup.bin
190+
```
191+
192+
Re-import jobs from a backup file:
193+
194+
```bash
195+
dapr scheduler import -f backup.bin
196+
```
137197

138198
## Monitoring Scheduler's etcd Metrics
139199

@@ -155,7 +215,7 @@ For more information on running Dapr on Kubernetes, visit the [Kubernetes hostin
155215

156216
A number of Etcd flags are exposed on Scheduler which can be used to tune for your deployment use case.
157217

158-
### External Etcd database
218+
### External Etcd database
159219

160220
Scheduler can be configured to use an external Etcd database instead of the embedded one inside the Scheduler service replicas.
161221
It may be interesting to decouple the storage volume from the Scheduler StatefulSet or container, because of how the cluster or environment is administered or what storage backend is being used.
@@ -230,4 +290,5 @@ dapr_scheduler.etcdMaxSnapshots=10
230290

231291
## Related links
232292

233-
[Learn more about the Jobs API.]({{% ref jobs_api %}})
293+
- [Learn more about the Jobs API.]({{% ref jobs_api %}})
294+
- [Learn more about Actor Reminders.]{{% ref "actors-features-concepts#reminders" %}})

daprdocs/content/en/developing-applications/building-blocks/actors/actors-timers-reminders.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,66 @@ To use protobuf serialization for actor reminders on self-hosted, use the follow
187187
--max-api-level=20
188188
```
189189

190+
## Managing reminders with the CLI
191+
192+
Actor reminders are persisted in the Scheduler.
193+
You can manage them with the dapr scheduler CLI commands.
194+
195+
#### List actor reminders
196+
197+
```bash
198+
dapr scheduler list --filter actor
199+
NAME BEGIN COUNT LAST TRIGGER
200+
actor/MyActorType/actorid1/test1 -3.89s 1 2025-10-03T16:58:55Z
201+
actor/MyActorType/actorid2/test2 -3.89s 1 2025-10-03T16:58:55Z
202+
```
203+
204+
Get reminder details
205+
206+
```bash
207+
dapr scheduler get actor/MyActorType/actorid1/test1 -o yaml
208+
```
209+
210+
#### Delete reminders
211+
212+
Delete a single reminder:
213+
214+
```bash
215+
dapr scheduler delete actor/MyActorType/actorid1/test1
216+
```
217+
218+
Delete all reminders for a given actor type:
219+
220+
```bash
221+
dapr scheduler delete-all actor/MyActorType
222+
```
223+
224+
Delete all reminders for a specific actor instance:
225+
226+
```bash
227+
dapr scheduler delete-all actor/MyActorType/actorid1
228+
```
229+
230+
#### Backup and restore reminders
231+
232+
Export all reminders:
233+
234+
```bash
235+
dapr scheduler export -o reminders-backup.bin
236+
```
237+
238+
Restore from a backup file:
239+
240+
```bash
241+
dapr scheduler import -f reminders-backup.bin
242+
```
243+
244+
#### Summary
245+
246+
- Reminders are stored in the Dapr Scheduler, not in the app.
247+
- Create reminders via the Actors API
248+
- Manage existing reminders (list, get, delete, backup/restore) using the `dapr scheduler` CLI.
249+
190250
## Next steps
191251

192252
{{< button text="Configure actor runtime behavior >>" page="actors-runtime-config.md" >}}

daprdocs/content/en/developing-applications/building-blocks/jobs/jobs-features-concepts.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,60 @@ or the not-before time from which the schedule should take effect
119119
The `DueTime` and `Ttl` fields will reflect an RC3339 timestamp value reflective of the time zone provided when the job was
120120
originally scheduled. If no time zone was provided, these values indicate the time zone used by the server running
121121
Dapr.
122+
123+
### Managing jobs
124+
125+
While jobs are created via API calls, you can manage (list, inspect, delete, back up, and restore) jobs is by using the dapr scheduler CLI commands.
126+
127+
#### List jobs
128+
129+
```bash
130+
dapr scheduler list --filter app
131+
NAME BEGIN COUNT LAST TRIGGER
132+
app/my-app/my-job -3.89s 1 2025-10-03T16:58:55Z
133+
app/my-app/another-job -3.89s 1 2025-10-03T16:58:55Z
134+
```
135+
136+
```bash
137+
dapr scheduler list -o wide
138+
NAMESPACE NAME BEGIN EXPIRATION SCHEDULE DUE TIME TTL REPEATS COUNT LAST TRIGGER
139+
default app/my-app/my-job 2025-10-03T16:58:55Z @every 5s 2025-10-03T17:58:55+01:00 100 1 2025-10-03T16:58:55Z
140+
```
141+
142+
```bash
143+
dapr scheduler get app/my-app/my-job -o yaml
144+
```
145+
146+
#### Delete jobs
147+
148+
Delete a specific job:
149+
150+
```bash
151+
dapr scheduler delete app/my-app/my-job
152+
```
153+
154+
Delete all jobs for an app:
155+
156+
```bash
157+
dapr scheduler delete-all app/my-app
158+
```
159+
160+
#### Backup and restore jobs
161+
162+
Export all jobs:
163+
164+
```bash
165+
dapr scheduler export -o jobs-backup.bin
166+
```
167+
168+
Import them later:
169+
170+
```bash
171+
dapr scheduler import -f jobs-backup.bin
172+
```
173+
174+
#### Summary
175+
176+
- Use the Jobs API to create or update jobs from applications.
177+
- Use the dapr scheduler CLI to view, inspect, back up, or delete jobs.
178+
- Jobs are stored in the Dapr Scheduler, ensuring reliability across restarts and deployments.

daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,67 @@ Now that you've [authored the workflow and its activities in your application]({
1010

1111
{{< tabpane text=true >}}
1212

13+
<!--CLI-->
14+
{{% tab "CLI" %}}
15+
Workflow reminders are stored in the Scheduler and can be managed using the dapr scheduler CLI.
16+
17+
#### List workflow reminders
18+
19+
```bash
20+
dapr scheduler list --filter workflow
21+
NAME BEGIN COUNT LAST TRIGGER
22+
workflow/my-app/instance1/timer-0-ABC123 +50.0h 0
23+
workflow/my-app/instance2/timer-0-XYZ789 +50.0h 0
24+
```
25+
26+
Get reminder details
27+
28+
```bash
29+
dapr scheduler get workflow/my-app/instance1/timer-0-ABC123 -o yaml
30+
```
31+
32+
#### Delete workflow reminders
33+
34+
Delete a single reminder:
35+
36+
```bash
37+
dapr scheduler delete workflow/my-app/instance1/timer-0-ABC123
38+
```
39+
40+
Delete all reminders for a given workflow app"
41+
42+
```bash
43+
dapr scheduler delete-all workflow/my-app
44+
```
45+
46+
Delete all reminders for a specific workflow instance:
47+
48+
```bash
49+
dapr scheduler delete-all workflow/my-app/instance1
50+
```
51+
52+
#### Backup and restore reminders
53+
54+
Export all reminders:
55+
56+
```bash
57+
dapr scheduler export -o workflow-reminders-backup.bin
58+
```
59+
60+
Restore from a backup file:
61+
62+
```bash
63+
dapr scheduler import -f workflow-reminders-backup.bin
64+
```
65+
66+
#### Summary
67+
68+
- Workflow reminders are persisted in the Dapr Scheduler.
69+
- Create workflow reminders via the Workflow API.
70+
- Manage reminders (list, get, delete, backup/restore) with the dapr scheduler CLI.
71+
72+
{{% /tab %}}
73+
1374
<!--Python-->
1475
{{% tab "Python" %}}
1576

@@ -356,7 +417,7 @@ To resume a workflow with an ID `12345678`, run:
356417
curl -X POST "http://localhost:3500/v1.0/workflows/dapr/12345678/resume"
357418
```
358419

359-
### Purge a workflow
420+
### Purge a workflow
360421

361422
The purge API can be used to permanently delete workflow metadata from the underlying state store, including any stored inputs, outputs, and workflow history records. This is often useful for implementing data retention policies and for freeing resources.
362423

daprdocs/content/en/getting-started/quickstarts/jobs-quickstart.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ dapr run -f .
8181
== APP - job-scheduler == Deleted job: BB-8
8282
```
8383

84+
You should eventually see the jobs being scheduled in scheduler:
85+
86+
```bash
87+
$ dapr scheduler list
88+
NAME TARGET BEGIN COUNT LAST TRIGGER
89+
C-3PO job +13.40s 0
90+
R2-D2 job +3.40s 0
91+
```
92+
8493
After 5 seconds, the terminal output should present the `R2-D2` job being processed:
8594

8695
```text
@@ -95,6 +104,13 @@ After 10 seconds, the terminal output should present the `C3-PO` job being proce
95104
== APP - job-service == Executing maintenance job: Memory Wipe
96105
```
97106

107+
The jobs will no longer be listed in the scheduler:
108+
109+
```bash
110+
$ dapr scheduler list
111+
NAME TARGET BEGIN COUNT LAST TRIGGER
112+
```
113+
98114
Once the process has completed, you can stop and clean up application processes with a single command.
99115

100116
```bash

0 commit comments

Comments
 (0)