芹菜没有错误的远程任务名称,为什么?

2024-09-30 22:23:38 发布

您现在位置:Python中文网/ 问答频道 /正文

使用“send_task”芹菜实际上从不验证远程任务是否存在,即:

app.send_task('tasks.i.dont.exist', args=[], kwargs={})

芹菜似乎仍会返回一条信息,即:

<AsyncResult: b8c1425a-7411-491f-b75a-34313832b8ba>

如果远程任务不存在,是否有方法使其失败

我尝试添加.get(),但它只是冻结了


Tags: 方法send信息apptask远程argskwargs
1条回答
网友
1楼 · 发布于 2024-09-30 22:23:38

根据文件:

If the task is not registered in the current process then you can also execute a task by name.

You do this by using the send_task() method of the celery instance

如果需要验证,请考虑使用^ {CD1>}。

您可以阅读有关如何执行芹菜任务here的更多信息

相关问题 更多 >