-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathcelery.py
54 lines (41 loc) · 1.08 KB
/
celery.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import logging
import os
from celery import Celery
logger = logging.getLogger(__name__)
if os.name == 'nt':
# Windows configuration to make celery run ok on Windows
os.environ.setdefault('FORKED_BY_MULTIPROCESSING', '1')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'demoproj.settings')
app = Celery('django_guid')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()
@app.task()
def debug_task() -> None:
"""
This is just an example task.
"""
logger.info('Debug task 1')
second_debug_task.delay()
second_debug_task.delay()
@app.task()
def second_debug_task() -> None:
"""
This is just an example task.
"""
logger.info('Debug task 2')
third_debug_task.delay()
fourth_debug_task.delay()
@app.task()
def third_debug_task() -> None:
"""
This is just an example task.
"""
logger.info('Debug task 3')
fourth_debug_task.delay()
fourth_debug_task.delay()
@app.task()
def fourth_debug_task() -> None:
"""
This is just an example task.
"""
logger.info('Debug task 4')