File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import os
22from celery import Celery
33
4- from flask import current_app , Flask
54
6- from helmbroker .config import Config
5+ class Config :
6+ # Celery Configuration Options
7+ timezone = "Asia/Shanghai"
8+ enable_utc = True
9+ task_serializer = 'pickle'
10+ accept_content = frozenset ([
11+ 'application/data' ,
12+ 'application/text' ,
13+ 'application/json' ,
14+ 'application/x-python-serialize' ,
15+ ])
16+ task_track_started = True
17+ task_time_limit = 30 * 60
18+ worker_max_tasks_per_child = 200
19+ result_expires = 24 * 60 * 60
720
8- flask_app = Flask (__name__ )
9- flask_app .config .from_object (Config )
1021
1122app = Celery (
1223 'helmbroker' ,
1526 include = ['helmbroker.tasks' ]
1627)
1728
18- with flask_app .app_context ():
19- app .conf .update (current_app .config )
29+ app .config_from_object (Config )
2030
2131if __name__ == '__main__' :
2232 app .start ()
Original file line number Diff line number Diff line change 1212
1313class Config :
1414 DEBUG = bool (os .environ .get ('DRYCC_DEBUG' , True ))
15- # Celery Configuration Options
16- timezone = "Asia/Shanghai"
17- enable_utc = True
18- task_serializer = 'pickle'
19- accept_content = frozenset ([
20- 'application/data' ,
21- 'application/text' ,
22- 'application/json' ,
23- 'application/x-python-serialize' ,
24- ])
25- task_track_started = True
26- task_time_limit = 30 * 60
27- worker_max_tasks_per_child = 200
28- result_expires = 24 * 60 * 60
You can’t perform that action at this time.
0 commit comments