-
Notifications
You must be signed in to change notification settings - Fork 776
Adds documentation for $ dapr scheduler
#4909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v1.16
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,25 +115,85 @@ services: | |
- ./dapr_scheduler/2:/var/run/dapr/scheduler | ||
``` | ||
|
||
## Back Up and Restore Scheduler Data | ||
## Managing jobs with the Dapr CLI | ||
|
||
In production environments, it's recommended to perform periodic backups of this data at an interval that aligns with your recovery point objectives. | ||
Dapr provides a CLI for inspecting and managing all scheduled jobs, regardless of type. | ||
The CLI is the recommended way to view, back up, and delete jobs. | ||
|
||
### Port Forward for Backup Operations | ||
|
||
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). | ||
### List jobs | ||
|
||
#### Kubernetes Example | ||
```bash | ||
dapr scheduler list | ||
``` | ||
|
||
Here's how to port forward and connect to the etcd instance: | ||
Example output: | ||
|
||
```bash | ||
NAME BEGIN COUNT LAST TRIGGER | ||
actor/myactortype/actorid1/test1 -3.89s 1 2025-10-03T16:58:55Z | ||
actor/myactortype/actorid2/test2 -3.89s 1 2025-10-03T16:58:55Z | ||
app/test-scheduler/test1 -3.89s 1 2025-10-03T16:58:55Z | ||
app/test-scheduler/test2 -3.89s 1 2025-10-03T16:58:55Z | ||
activity/test-scheduler/xyz1::0::1 -888.8ms 0 | ||
activity/test-scheduler/xyz2::0::1 -888.8ms 0 | ||
workflow/test-scheduler/abc1/timer-0-TVIQGkvu +50.0h 0 | ||
workflow/test-scheduler/abc2/timer-0-OM2xqG9m +50.0h 0 | ||
``` | ||
|
||
```shell | ||
kubectl port-forward svc/dapr-scheduler-server 2379:2379 -n dapr-system | ||
For more detail, use the wide output format: | ||
|
||
```bash | ||
dapr scheduler list -o wide | ||
``` | ||
|
||
```yaml | ||
NAMESPACE NAME BEGIN EXPIRATION SCHEDULE DUE TIME TTL REPEATS COUNT LAST TRIGGER | ||
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 | ||
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 | ||
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 | ||
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 | ||
default activity/test-scheduler/xyz1::0::1 2025-10-03T16:58:58Z 0s 0 | ||
default activity/test-scheduler/xyz2::0::1 2025-10-03T16:58:58Z 0s 0 | ||
default workflow/test-scheduler/abc1/timer-0-TVIQGkvu 2025-10-05T18:58:58Z 2025-10-05T18:58:58Z 0 | ||
default workflow/test-scheduler/abc2/timer-0-OM2xqG9m 2025-10-05T18:58:58Z 2025-10-05T18:58:58Z 0 | ||
``` | ||
|
||
### Get job details | ||
|
||
```bash | ||
dapr scheduler get app/my-app/job1 -o yaml | ||
``` | ||
|
||
### Delete jobs | ||
|
||
Delete one or more specific jobs: | ||
|
||
```bash | ||
dapr scheduler delete app/my-app/job1 actor/MyActor/123/reminder1 | ||
``` | ||
|
||
Bulk delete jobs with filters: | ||
|
||
```bash | ||
dapr scheduler delete-all all | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was using a wildcard (
A single quote ( This would prevent us from have a |
||
dapr scheduler delete-all app/my-app | ||
dapr scheduler delete-all actor/MyActorType | ||
``` | ||
|
||
### Performing Backup and Restore | ||
### Backup and restore jobs | ||
|
||
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. | ||
Export all jobs to a file: | ||
|
||
```bash | ||
dapr scheduler export -o backup.bin | ||
``` | ||
|
||
Re-import jobs from a backup file: | ||
|
||
```bash | ||
dapr scheduler import -f backup.bin | ||
``` | ||
|
||
## Monitoring Scheduler's etcd Metrics | ||
|
||
|
@@ -155,7 +215,7 @@ For more information on running Dapr on Kubernetes, visit the [Kubernetes hostin | |
|
||
A number of Etcd flags are exposed on Scheduler which can be used to tune for your deployment use case. | ||
|
||
### External Etcd database | ||
### External Etcd database | ||
|
||
Scheduler can be configured to use an external Etcd database instead of the embedded one inside the Scheduler service replicas. | ||
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 | |
|
||
## Related links | ||
|
||
[Learn more about the Jobs API.]({{% ref jobs_api %}}) | ||
- [Learn more about the Jobs API.]({{% ref jobs_api %}}) | ||
- [Learn more about Actor Reminders.]{{% ref "actors-features-concepts#reminders" %}}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,6 +187,66 @@ To use protobuf serialization for actor reminders on self-hosted, use the follow | |
--max-api-level=20 | ||
``` | ||
|
||
## Managing reminders with the CLI | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My pref would be if we could move this to the Or if ^ is not preferred, can we at least link to this documentation from the |
||
|
||
Actor reminders are persisted in the Scheduler. | ||
You can manage them with the dapr scheduler CLI commands. | ||
|
||
#### List actor reminders | ||
|
||
```bash | ||
dapr scheduler list --filter actor | ||
NAME BEGIN COUNT LAST TRIGGER | ||
actor/MyActorType/actorid1/test1 -3.89s 1 2025-10-03T16:58:55Z | ||
actor/MyActorType/actorid2/test2 -3.89s 1 2025-10-03T16:58:55Z | ||
``` | ||
|
||
Get reminder details | ||
|
||
```bash | ||
dapr scheduler get actor/MyActorType/actorid1/test1 -o yaml | ||
``` | ||
|
||
#### Delete reminders | ||
|
||
Delete a single reminder: | ||
|
||
```bash | ||
dapr scheduler delete actor/MyActorType/actorid1/test1 | ||
``` | ||
|
||
Delete all reminders for a given actor type: | ||
|
||
```bash | ||
dapr scheduler delete-all actor/MyActorType | ||
``` | ||
|
||
Delete all reminders for a specific actor instance: | ||
|
||
```bash | ||
dapr scheduler delete-all actor/MyActorType/actorid1 | ||
``` | ||
|
||
#### Backup and restore reminders | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we have all docs from the |
||
|
||
Export all reminders: | ||
|
||
```bash | ||
dapr scheduler export -o reminders-backup.bin | ||
``` | ||
|
||
Restore from a backup file: | ||
|
||
```bash | ||
dapr scheduler import -f reminders-backup.bin | ||
``` | ||
|
||
#### Summary | ||
|
||
- Reminders are stored in the Dapr Scheduler, not in the app. | ||
- Create reminders via the Actors API | ||
- Manage existing reminders (list, get, delete, backup/restore) using the `dapr scheduler` CLI. | ||
|
||
## Next steps | ||
|
||
{{< button text="Configure actor runtime behavior >>" page="actors-runtime-config.md" >}} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My nit would be I think we should have a section on job naming convention here since it differs slightly across 'job types'.
For example, we have actor reminders prefixed with
actor/type/id/name
, jobs are prefixed withapp/...
and wf related 'jobs' due to the reminders being used under the hood areworkflow/...
prefixed vsactivity/...
prefixed. I think we should just spell this out very explicitly to limit confusion to users.