Skip to content

Commit a74fc75

Browse files
committed
docs: add schedule_id as a parameter for schedule in LabelScheduleSource usage example
1 parent db06ba1 commit a74fc75

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docs/available-components/schedule-sources.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@ The format of the schedule label is the following:
3434
@broker.task(
3535
schedule=[
3636
{
37-
"cron": "* * * * *", # type: str, either cron or time should be specified.
37+
"cron": "*/1 * * * *", # type: str, either cron or time should be specified.
3838
"cron_offset": None # type: str | timedelta | None, can be omitted.
3939
"time": None # type: datetime | None, either cron or time should be specified.
4040
"args": [], # type List[Any] | None, can be omitted.
4141
"kwargs": {}, # type: Dict[str, Any] | None, can be omitted.
4242
"labels": {}, # type: Dict[str, Any] | None, can be omitted.
43+
"schedule_id": "every_minute", # type: str | None, can be omitted.
4344
}
4445
]
4546
)
@@ -55,6 +56,7 @@ Parameters:
5556
- `args` - args to use, when invoking the task.
5657
- `kwargs` - key-word arguments to use when invoking the task.
5758
- `labels` - additional labels to use when invoking the task.
59+
- `schedule_id` - unique identifier of the schedule. If not specified, a random uuid will be generated.
5860

5961
To enable this source, just add it to the list of sources:
6062

docs/extending-taskiq/schedule-sources.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ Here's a minimal example of a schedule source:
1212
@[code python](../examples/extending/schedule_source.py)
1313

1414
You can implement a schedule source that write schedules in the database and have delayed tasks in runtime.
15+
16+
::: info Cool tip!
17+
You can also use `LabelScheduleSource` as a base class for your schedule source
18+
if you want to parse schedules from task labels and don't want to implement logic for this from scratch.
19+
:::

0 commit comments

Comments
 (0)