mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 20:40:17 +02:00
Merge branch 'master' into 'master'
Celery documentation improvements See merge request allianceauth/allianceauth!1663
This commit is contained in:
commit
d639617eba
@ -40,10 +40,10 @@ Please use the following approach to ensure your tasks are working properly with
|
|||||||
Here is an example implementation of a task:
|
Here is an example implementation of a task:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import logging
|
from allianceauth.services.hooks import get_extension_logger
|
||||||
from celery import shared_task
|
from celery import shared_task
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = get_extension_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
@ -80,10 +80,10 @@ However, many long-running tasks consist of several smaller processes that need
|
|||||||
Example implementation for a celery chain:
|
Example implementation for a celery chain:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import logging
|
from allianceauth.services.hooks import get_extension_logger
|
||||||
from celery import shared_task, chain
|
from celery import shared_task, chain
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = get_extension_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
@ -96,7 +96,7 @@ def long_runner():
|
|||||||
my_tasks = list()
|
my_tasks = list()
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
task_signature = example.si()
|
task_signature = example.si()
|
||||||
my_task.append(task_signature)
|
my_tasks.append(task_signature)
|
||||||
|
|
||||||
chain(my_tasks).delay()
|
chain(my_tasks).delay()
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user