-
Notifications
You must be signed in to change notification settings - Fork 0
/
celeryconfig.py
65 lines (62 loc) · 1.69 KB
/
celeryconfig.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
55
56
57
58
59
60
61
62
63
64
65
# Celery configs
BROKER_URL = "redis://localhost:6379/0"
RESULT_BACKEND = "redis://localhost:6379/1"
TASK_SERIALIZER = "json"
RESULT_SERIALIZER = "json"
ACCEPT_CONTENT = ["json"]
CELERYBEAT_SCHEDULE = {
"my-python-task": {
"task": "glorified_cron.tasks.my_python_task",
"schedule": 60.0, "args": []
}
}
ENABLE_UTC = True
# Custom configs
# Because some periodic tasks needs to be scheduled using crontabs method.
# For help, see this http://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html#crontab-schedules
SCHEDULED_TASKS = [
{
'name': 'call-bash-command',
'task': 'glorified_cron.tasks.call_command',
'schedule': {'minute': '*'},
'args': [],
'kwargs': {'command': 'echo "hello world"'}
}
]
LOGGER_CONFIG = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"standard": {
"format": "%(asctime)s [%(levelname)s] %(name)s: %(message)s"
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"formatter": "standard",
"level": 10
},
"file": {
"class": "logging.handlers.TimedRotatingFileHandler",
"filename": "glorified_cron.log",
"formatter": "standard",
"backupCount": 10,
"interval": 1,
"when": "d",
"level": 30
}
},
"loggers": {
"": {
"handlers": ["console", "file"],
"level": 30,
"propagate": True
},
"glorified_cron": {
"handlers": ["console", "file"],
"level": 10,
"propagate": False
}
}
}