如何为 prefect 中的 control_flow 指定名称?

Ita*_*vni 5 python python-3.x prefect

如何将 a 分配namemerge流程中的任务?

thing_three = merge(thing_one, thing_two)
Run Code Online (Sandbox Code Playgroud)

最终目标是merge使用检索flow.get_tasks(name="thing_merger")

提前致谢。

小智 5

处理这个问题最直接的方法是使用:

thing_three = merge(thing_one, thing_two)

thing_three.name = "thing_merger"
Run Code Online (Sandbox Code Playgroud)

然后当你调用 时flow.get_tasks(name="thing_merger"),它会返回:

[<Task: thing_merger>]
Run Code Online (Sandbox Code Playgroud)