Subflow Task Runner Inheritance #12563
-
I would like to know the behavior of the task runner. For example: from prefect import flow
from prefect.task_runners import ConcurrentTaskRunner
from prefect_ray.task_runners import RayTaskRunner
@flow(task_runner=ConcurrentTaskRunner())
def child_flow():
# do something
pass
@flow(task_runner=RayTaskRunner())
def parent_flow():
child_flow()
if __name__ == "__main__":
parent_flow() Will it use RayTaskRunner or ConcurrentTaskRunner on the child_flow? If so, I think overriding subflow's task runner can be easily done by invoking the https://chat.openai.com/share/a3e95e9e-97ae-463f-a13f-c6f4cbaa02d1 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Seems subflows are not concurrent now |
Beta Was this translation helpful? Give feedback.
-
Inherit task runner from parent flow can be done like this from prefect import flow
from prefect_ray.task_runners import RayTaskRunner
from prefect.context import FlowRunContext
@flow
def child_flow():
# do something
pass
@flow(task_runner=RayTaskRunner(), log_prints=True)
def parent_flow():
print(f"Inherit parent flow task runner {FlowRunContext.get().task_runner}")
child_flow.with_options(task_runner=FlowRunContext.get().task_runner)()
if __name__ == "__main__":
parent_flow() |
Beta Was this translation helpful? Give feedback.
Inherit task runner from parent flow can be done like this