Create dynamic queues with Celery

后端 未结 2 567
耶瑟儿~
耶瑟儿~ 2021-02-01 20:06

Here\'s my scenario:

When a user logs in to my website, I queue up a bunch of tasks for the given user (typically each task takes 100s of msecs and there are 100s of tas

2条回答
  •  时光取名叫无心
    2021-02-01 20:42

    http://docs.celeryproject.org/en/latest/userguide/workers.html#queues

    celery -A proj control add_consumer foo -d worker1.local
    

    The same can be accomplished dynamically using the app.control.add_consumer() method:

    app.control.add_consumer('foo', reply=True)
    [{u'worker1.local': {u'ok': u"already consuming from u'foo'"}}]
    
    app.control.add_consumer('foo', reply=True,
    destination=['worker1@example.com'])
    

提交回复
热议问题