You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/08/25 04:53:11 UTC
[GitHub] john-bodley opened a new pull request #5726: [celery] Using
preferred configuration proceedure
john-bodley opened a new pull request #5726: [celery] Using preferred configuration proceedure
URL: https://github.com/apache/incubator-superset/pull/5726
We've been using the [celery_statsd](https://github.com/lyst/celery-statsd) for additional Celery monitoring but have recently noticed issues with the config passing, i.e.,
```
>>> from celery import Celery
>>>
>>>
>>> class Config:
... STATSD_HOST = 'localhost'
...
>>> app = Celery(source_config=Config)
>>> app.conf.STATSD_HOST
Traceback (most recent call last):
File ".../celery/utils/collections.py", line 130, in __getattr__
return self[k]
File ".../celery/utils/collections.py", line 436, in __getitem__
return self.__missing__(key)
File ".../celery/utils/collections.py", line 269, in __missing__
raise KeyError(key)
KeyError: 'STATSD_HOST'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".../celery/utils/collections.py", line 134, in __getattr__
type(self).__name__, k))
AttributeError: 'Settings' object has no attribute 'STATSD_HOST'
```
According to the [documentation](http://docs.celeryproject.org/en/latest/userguide/application.html#config-from-object) it seems like the `config_from_object` is the suggested approach, which provides the correct behavior,
```
>>> app = Celery()
>>> app.config_from_object(Config)
>>> app.conf.STATSD_HOST
'localhost'
>>>
```
to: @graceguo-supercat @kristw @michellethomas @mistercrunch @timifasubaa
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org