Skip to content

Commit 9612326

Browse files
author
lijianguo
committed
fix(controller): upgrade celery config
1 parent 89b4678 commit 9612326

2 files changed

Lines changed: 16 additions & 20 deletions

File tree

rootfs/helmbroker/celery.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
import os
22
from 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

1122
app = Celery(
1223
'helmbroker',
@@ -15,8 +26,7 @@
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

2131
if __name__ == '__main__':
2232
app.start()

rootfs/helmbroker/config.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,3 @@
1212

1313
class 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

0 commit comments

Comments
 (0)