Skip to content

Commit 4f37acc

Browse files
Updated celery config usage to new lowercase settings (#1185)
* Updated celery config usage to new lowercase settings Ref: https://docs.celeryproject.org/en/v5.2.3/userguide/configuration.html#new-lowercase-settings * Update tasks.py * Update broker.py
1 parent b92c114 commit 4f37acc

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

examples/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
app = Celery("tasks",
99
broker=os.environ.get('CELERY_BROKER_URL', 'redis://'),
1010
backend=os.environ.get('CELERY_RESULT_BACKEND', 'redis'))
11-
app.conf.CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']
12-
app.conf.CELERY_WORKER_SEND_TASK_EVENTS = True
11+
app.conf.accept_content = ['pickle', 'json', 'msgpack', 'yaml']
12+
app.conf.worker_send_task_events = True
1313

1414

1515
@app.task

flower/api/tasks.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,24 +396,24 @@ async def get(self):
396396
:statuscode 503: result backend is not configured
397397
"""
398398
app = self.application
399-
broker_options = self.capp.conf.BROKER_TRANSPORT_OPTIONS
399+
broker_options = self.capp.conf.broker_transport_options
400400

401401
http_api = None
402402
if app.transport == 'amqp' and app.options.broker_api:
403403
http_api = app.options.broker_api
404404

405405
broker_use_ssl = None
406-
if self.capp.conf.BROKER_USE_SSL:
407-
broker_use_ssl = self.capp.conf.BROKER_USE_SSL
406+
if self.capp.conf.broker_use_ssl:
407+
broker_use_ssl = self.capp.conf.broker_use_ssl
408408

409409
broker = Broker(app.capp.connection().as_uri(include_password=True),
410410
http_api=http_api, broker_options=broker_options, broker_use_ssl=broker_use_ssl)
411411

412412
queue_names = self.get_active_queue_names()
413413

414414
if not queue_names:
415-
queue_names = set([self.capp.conf.CELERY_DEFAULT_QUEUE]) |\
416-
set([q.name for q in self.capp.conf.CELERY_QUEUES or [] if q.name])
415+
queue_names = set([self.capp.conf.task_default_queue]) |\
416+
set([q.name for q in self.capp.conf.task_queues or [] if q.name])
417417

418418
queues = await broker.queues(sorted(queue_names))
419419
self.write({'active_queues': queues})

flower/views/broker.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ class BrokerView(BaseHandler):
1515
@web.authenticated
1616
async def get(self):
1717
app = self.application
18-
broker_options = self.capp.conf.BROKER_TRANSPORT_OPTIONS
18+
broker_options = self.capp.conf.broker_transport_options
1919

2020
http_api = None
2121
if app.transport == 'amqp' and app.options.broker_api:
2222
http_api = app.options.broker_api
2323

2424
broker_use_ssl = None
25-
if self.capp.conf.BROKER_USE_SSL:
26-
broker_use_ssl = self.capp.conf.BROKER_USE_SSL
25+
if self.capp.conf.broker_use_ssl:
26+
broker_use_ssl = self.capp.conf.broker_use_ssl
2727

2828
try:
2929
broker = Broker(app.capp.connection(connect_timeout=1.0).as_uri(include_password=True),
@@ -36,8 +36,8 @@ async def get(self):
3636
try:
3737
queue_names = self.get_active_queue_names()
3838
if not queue_names:
39-
queue_names = set([self.capp.conf.CELERY_DEFAULT_QUEUE]) |\
40-
set([q.name for q in self.capp.conf.CELERY_QUEUES or [] if q.name])
39+
queue_names = set([self.capp.conf.task_default_queue]) |\
40+
set([q.name for q in self.capp.conf.task_queues or [] if q.name])
4141

4242
queues = await broker.queues(sorted(queue_names))
4343
except Exception as e:

flower/views/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ def get(self):
114114
capp = self.application.capp
115115

116116
time = 'natural-time' if app.options.natural_time else 'time'
117-
if capp.conf.CELERY_TIMEZONE:
118-
time += '-' + str(capp.conf.CELERY_TIMEZONE)
117+
if capp.conf.timezone:
118+
time += '-' + str(capp.conf.timezone)
119119

120120
self.render(
121121
"tasks.html",

0 commit comments

Comments
 (0)