我正在使用Celery进行分发任务的项目。为了将任务路由到特定的工作者(因为它需要由前一个任务创建的特定文件),我正在尝试使用celery.utils.worker_direct。
我所做的基本上是这样的:
@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
执行task_C.apply_async((arg1, arg2), queue=worker_direct(worker))
时,我收到此错误:
TypeError: object of type 'Queue' has no len()
我做错了什么?
答案 0 :(得分:1)
找到解决方案:
stringValue = cobContractNetworkGroup.SelectedValue
If stringValue = "Something" Then
cobAffiliation.Enabled = True
AppReturnAffiliationBindingSource.Filter = "AffiliationType LIKE '%" & AppReturnGroupContractNetworkBindingSource.Current & "%' "
Else
cobAffiliation.Enabled = False
AppReturnAffiliationBindingSource.Filter = ""
End If