Skip to content

Commit 08b618c

Browse files
authored
Merge branch 'master' into feature/use-app-dir-to-specify-sources-directory
2 parents c650831 + d01e152 commit 08b618c

File tree

24 files changed

+1058
-120
lines changed

24 files changed

+1058
-120
lines changed

docs/available-components/brokers.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ await my_task.kicker().with_broker(broker).kiq()
8282

8383
## Custom brokers
8484

85-
These brokers are not parts of the core taskiq lib. You can install them as a separate packages.
85+
These brokers are not parts of the core Taskiq lib. But they are maintained by Taskiq developers.
86+
You can install them as a separate packages.
8687

8788
You can read more about parameters and abilities of these brokers in README.md of each repo.
8889

@@ -110,3 +111,33 @@ Project link: [taskiq-nats](https://github.com/taskiq-python/taskiq-nats).
110111
```bash
111112
pip install taskiq-nats
112113
```
114+
115+
## Third-party brokers
116+
117+
These brokers are not part of the core Taskiq library. They are maintained by other open‑source contributors. You can install them as a separate packages.
118+
119+
You can read more about parameters and abilities of these brokers in README.md of each repo.
120+
121+
### PostgreSQL broker
122+
123+
Project link: [taskiq-postgresql](https://github.com/z22092/taskiq-postgresql).
124+
125+
```bash
126+
pip install taskiq-postgresql
127+
```
128+
129+
### SQS broker
130+
131+
Project link: [taskiq-aio-sqs](https://github.com/vonsteer/taskiq-aio-sqs).
132+
133+
```bash
134+
pip install taskiq-aio-sqs
135+
```
136+
137+
### YDB broker
138+
139+
Project link: [taskiq-ydb](https://github.com/danfimov/taskiq-ydb).
140+
141+
```bash
142+
pip install taskiq-ydb
143+
```

docs/available-components/result-backends.md

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,60 @@ This includes:
1010
- return value;
1111
- Execution time in seconds.
1212

13-
## DummyResultBackend
13+
## Built-in result backends
14+
15+
### DummyResultBackend
1416

1517
This result backend doesn't do anything. It doesn't store results and cannot be used in cases,
1618
where you need actual results.
1719

1820
This broker will always return `None` for any return_value. Please be careful.
1921

20-
## Redis result backend
2122

22-
This result backend is not part of the core taskiq library. You can install it as a separate package [taskiq-redis](https://pypi.org/project/taskiq-redis/).
23+
## Official result backends
24+
25+
This result backends is not part of the core Taskiq library. But they are maintained by Taskiq developers. You can install them as a separate package.
26+
27+
### Redis result backend
28+
29+
Project link: [taskiq-redis](https://pypi.org/project/taskiq-redis/).
2330

2431
```bash
2532
pip install taskiq-redis
2633
```
2734

28-
You can read more about parameters and abilities of this broker in [README.md](https://github.com/taskiq-python/taskiq-redis).
35+
### NATS result backend
36+
37+
Project link: [taskiq-nats](https://github.com/taskiq-python/taskiq-nats).
38+
39+
```bash
40+
pip install taskiq-nats
41+
```
42+
43+
## Third-party result backends
44+
45+
These result backends are not part of the core Taskiq library. They are maintained by other open‑source contributors. You can install them as a separate packages.
46+
47+
### PostgreSQL result backend
48+
49+
Project link: [taskiq-postgresql](https://github.com/z22092/taskiq-postgresql).
50+
51+
```bash
52+
pip install taskiq-postgresql
53+
```
54+
55+
### S3 result backend
56+
57+
Project link: [taskiq-aio-sqs](https://github.com/vonsteer/taskiq-aio-sqs).
58+
59+
```bash
60+
pip install taskiq-aio-sqs
61+
```
62+
63+
### YDB result backend
64+
65+
Project link: [taskiq-ydb](https://github.com/danfimov/taskiq-ydb).
66+
67+
```bash
68+
pip install taskiq-ydb
69+
```

docs/available-components/schedule-sources.md

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ order: 4
55
# Available schedule sources
66

77
These objects are used to fetch current schedule for tasks.
8-
Currently we have only one schedule source.
98

10-
## RedisScheduleSource
9+
## Official schedule sources
10+
11+
These schedule sources are not part of the core Taskiq library. But they are maintained by Taskiq developers. You can install them as a separate package.
12+
13+
### RedisScheduleSource
1114

1215
This source is capable of adding new schedules in runtime. It uses Redis as a storage for schedules.
1316
To use this source you need to install `taskiq-redis` package.
@@ -24,7 +27,7 @@ scheduler = TaskiqScheduler(broker, sources=[redis_source])
2427
For more information on how to use dynamic schedule sources read [Dynamic scheduling section](../guide/scheduling-tasks.md#dynamic-scheduling).
2528

2629

27-
## LabelScheduleSource
30+
### LabelScheduleSource
2831

2932
This source parses labels of tasks, and if it finds a `schedule` label, it considers this task as scheduled.
3033

@@ -34,12 +37,13 @@ The format of the schedule label is the following:
3437
@broker.task(
3538
schedule=[
3639
{
37-
"cron": "* * * * *", # type: str, either cron or time should be specified.
40+
"cron": "*/1 * * * *", # type: str, either cron or time should be specified.
3841
"cron_offset": None # type: str | timedelta | None, can be omitted.
3942
"time": None # type: datetime | None, either cron or time should be specified.
4043
"args": [], # type List[Any] | None, can be omitted.
4144
"kwargs": {}, # type: Dict[str, Any] | None, can be omitted.
4245
"labels": {}, # type: Dict[str, Any] | None, can be omitted.
46+
"schedule_id": "every_minute", # type: str | None, can be omitted.
4347
}
4448
]
4549
)
@@ -55,6 +59,7 @@ Parameters:
5559
- `args` - args to use, when invoking the task.
5660
- `kwargs` - key-word arguments to use when invoking the task.
5761
- `labels` - additional labels to use when invoking the task.
62+
- `schedule_id` - unique identifier of the schedule. If not specified, a random uuid will be generated.
5863

5964
To enable this source, just add it to the list of sources:
6065

@@ -76,3 +81,43 @@ In order to resolve all labels correctly, don't forget to import
7681
all task modules using CLI interface.
7782

7883
:::
84+
85+
### NATS schedule source
86+
87+
This source is capable of adding new schedules in runtime. It uses NATS as a storage for schedules.
88+
To use this source you need to install `taskiq-nats` package.
89+
90+
```python
91+
from taskiq_nats import NATSKeyValueScheduleSource
92+
from taskiq.scheduler import TaskiqScheduler
93+
94+
95+
broker = ...
96+
97+
scheduler = TaskiqScheduler(
98+
broker=broker,
99+
sources=[NATSKeyValueScheduleSource(broker)],
100+
)
101+
```
102+
103+
This schedule source doesn't use `schedule` label on tasks. To add new schedules, you need to call `add_schedule` method on the source.
104+
105+
## Third-party schedule sources
106+
107+
These schedule sources are not part of the core Taskiq library. They are maintained by other open‑source contributors. You can install them as a separate packages.
108+
109+
### PostgreSQL schedule source
110+
111+
Project link: [taskiq-postgres](https://github.com/danfimov/taskiq-postgres)
112+
113+
```bash
114+
pip install taskiq-postgres
115+
```
116+
117+
### YDB schedule source
118+
119+
Project link: [taskiq-ydb](https://github.com/danfimov/taskiq-ydb)
120+
121+
```bash
122+
pip install taskiq-ydb
123+
```

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+
:::

docs/guide/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ We created this project because we couldn't find any project that can execute an
2121

2222
You might have seen projects built on top of asyncio that solve a similar problem, but here's a comparison table of the taskiq and other projects.
2323

24-
| Feature name | Taskiq | Arq | AioTasks |
25-
| --------------------------: | :----: | :---: | :------: |
26-
| Actively maintained ||||
27-
| Multiple broker backends ||||
28-
| Multiple result backends ||||
29-
| Have a rich documentation ||||
30-
| Startup & Shutdown events ||||
31-
| Have ability to abort tasks ||||
32-
| Custom serializers ||||
33-
| Dependency injection ||||
34-
| Task pipelines ||||
35-
| Task schedules ||||
36-
| Global middlewares ||||
24+
| Feature name | Taskiq | Arq | AioTasks | streaQ |
25+
| --------------------------: | :----: | :---: | :------: | :----: |
26+
| Actively maintained |||||
27+
| Multiple broker backends |||||
28+
| Multiple result backends |||||
29+
| Have a rich documentation |||||
30+
| Startup & Shutdown events |||||
31+
| Have ability to abort tasks |||||
32+
| Custom serializers |||||
33+
| Dependency injection |||||
34+
| Task pipelines |||||
35+
| Task schedules |||||
36+
| Global middlewares |||||
3737

3838
If you have a fully synchronous project, consider using celery or dramatiq instead.

docs/guide/testing-taskiq.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,7 @@ In such a way you don't need to manually call the `wait_result` in your code.
161161
To set it up, define the broker as the following:
162162

163163
```python
164-
...
165-
broker = InMemoryBroker(await_inplace=True)
166-
...
167-
164+
broker = InMemoryBroker(await_inplace=True)
168165
```
169166

170167
With this setup all `await function.kiq()` calls will behave similarly to `await function()`, but

0 commit comments

Comments
 (0)