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 

[ Full content available at: 
https://github.com/apache/incubator-superset/pull/5726 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to