python - celery: how to use celery.utils.worker_direct -


i working on project using celery distributing tasks. in order route task specific worker (because needs specific files, created previous task), trying use celery.utils.worker_direct.

what i'm doing this:

@app.task(bind=true) def task_a(self, arg):     worker = str(self.request.hostname)     # ...     s = task_b.s(arg1, worker)     s.delay()  @app.task def task_b(arg1, worker):     task_c.apply_async((arg1, arg2), queue=worker_direct(worker))  @app.task def task_c(arg1, arg2):     pass 

when task_c.apply_async((arg1, arg2), queue=worker_direct(worker)) executed, error:

typeerror: object of type 'queue' has no len() 

what doing wrong?

found solution:

# task_a worker = worker_direct(self.request.hostname).name  # task_b task_c.apply_async((arg1, arg2), queue=worker) 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -