celery / kombu memo

kombu.utils.symbol_by_name()

Import the module specified by the string

>>> import kombu.utils
>>> kombu.utils.symbol_by_name('argparse')
<module 'argparse' from '/Users/sximada/.anyenv/envs/pyenv/versions/3.4.2/lib/python3.4/argparse.py'>

Use a semicolon to get the object inside the module

>>> kombu.utils.symbol_by_name('argparse:ArgumentParser')
<class 'argparse.ArgumentParser'>

celery.utils.instantiate()

Instantiate the object specified by the string

>>> import celery.utils
>>> celery.utils.instantiate('argparse:ArgumentParser', description='test')
ArgumentParser(prog='', usage=None, description='test', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)

kombu.utils.cached_property()

property cache. It feels like reify.

Connection pool

When using redis, redis.ConnectionPool () is used by default. So the connection timing is created by make_connection () if there are not enough connections at the timing of pool.get_connetion () when getting the connection of redis.

Flow of application takeover

  1. Specify Celery () object name (specified by --app) and celery command (first argument) in CLI parameters
  2. The app property is set in the constructor of celery.bin.celery.CeleryCommand ()
  3. Get the command corresponding to the first argument in celery.bin.celery.CeleryCommand.execute () and pass the app object when instantiating

Recommended Posts

celery / kombu memo
celery
gzip memo
Raspberry-pi memo
Python memo
graphene memo
Flask memo
pyenv memo
Matplotlib memo
sed memo
Python memo
Install Memo
BeautifulSoup4 memo
networkx memo
python memo
tomcat memo
command memo
Generator memo.
psycopg2 memo
Python memo
SSH memo
Command memo
Memo: rtl8812
pandas memo
Shell memo
Python memo
Pycharm memo
Python memo