Skip to content

Commit 412c94e

Browse files
committed
Add scheduling examples to README
1 parent d709b4a commit 412c94e

1 file changed

Lines changed: 74 additions & 5 deletions

File tree

README.md

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,77 @@ pulp workflow run show --href <href>
1818
pulp workflow run cancel --href <href>
1919
```
2020

21-
A workflow is a definition plus a schedule. Each time its schedule fires, a
22-
`WorkflowRun` records that execution. Set `--dispatch-interval` to re-run a
23-
workflow on a recurring schedule; otherwise it runs once at `--start-time`.
24-
`pulp workflow cancel` stops a workflow (removes its schedule and cancels any
25-
in-flight runs), while `pulp workflow run cancel` cancels a single run.
21+
## Examples
22+
23+
The examples below assume `$REPO_HREF`, `$REPO_PK`, and `$REMOTE_PK` for a
24+
[pulp_file](https://github.com/pulp/pulp_file) repository are already set.
25+
26+
### Run a sync once at a specific time
27+
28+
Use `--start-time` with an ISO 8601 datetime to schedule a single run in the future.
29+
Omit `--dispatch-interval` so the workflow runs exactly once.
30+
31+
```bash
32+
pulp workflow create \
33+
--name nightly-sync-once \
34+
--start-time "2026-08-01T02:00:00" \
35+
--task '{
36+
"task_name": "pulp_file.app.tasks.synchronizing.synchronize",
37+
"reserved_resources": ["'"$REPO_HREF"'"],
38+
"task_kwargs": [
39+
{"kwarg_key": "repository_pk", "value": "'"$REPO_PK"'"},
40+
{"kwarg_key": "remote_pk", "value": "'"$REMOTE_PK"'"},
41+
{"kwarg_key": "mirror", "value": false}
42+
]
43+
}'
44+
```
45+
46+
### Run a sync every day
47+
48+
Add `--dispatch-interval '1 00:00:00'` (1 day) to re-run the workflow on a schedule,
49+
creating a new run each interval. Without `--start-time` the first run starts now.
50+
51+
```bash
52+
pulp workflow create \
53+
--name daily-sync \
54+
--dispatch-interval '1 00:00:00' \
55+
--task '{
56+
"task_name": "pulp_file.app.tasks.synchronizing.synchronize",
57+
"reserved_resources": ["'"$REPO_HREF"'"],
58+
"task_kwargs": [
59+
{"kwarg_key": "repository_pk", "value": "'"$REPO_PK"'"},
60+
{"kwarg_key": "remote_pk", "value": "'"$REMOTE_PK"'"},
61+
{"kwarg_key": "mirror", "value": false}
62+
]
63+
}'
64+
```
65+
66+
### Run a sync and publish every day
67+
68+
Pass `--task` twice to chain steps. The publish task's `repository_version_pk` is a
69+
dynamic arg (`content_type: core.repositoryversion`) that the workflow engine resolves
70+
at dispatch time from the repository version the sync creates.
71+
72+
```bash
73+
pulp workflow create \
74+
--name daily-sync-and-publish \
75+
--dispatch-interval '1 00:00:00' \
76+
--task '{
77+
"task_name": "pulp_file.app.tasks.synchronizing.synchronize",
78+
"reserved_resources": ["'"$REPO_HREF"'"],
79+
"task_kwargs": [
80+
{"kwarg_key": "repository_pk", "value": "'"$REPO_PK"'"},
81+
{"kwarg_key": "remote_pk", "value": "'"$REMOTE_PK"'"},
82+
{"kwarg_key": "mirror", "value": false}
83+
]
84+
}' \
85+
--task '{
86+
"task_name": "pulp_file.app.tasks.publish",
87+
"reserved_resources": ["'"$REPO_HREF"'"],
88+
"task_kwargs": [
89+
{"kwarg_key": "manifest", "value": "PULP_MANIFEST"},
90+
{"kwarg_key": "repository_version_pk", "content_type": "core.repositoryversion"}
91+
]
92+
}'
93+
```
94+

0 commit comments

Comments
 (0)