<@ULVA73B9P>, how can I get the task runner used b...
# ask-marvin
p
@Marvin, how can I get the task runner used by a flow if flows are called using
.with_options(task_runner
?
m
To determine which task runner is used by a flow in Prefect, you can use the
task_runner
option when defining your flow. This option allows you to configure a specific task runner such as
ConcurrentTaskRunner
,
DaskTaskRunner
, or
RayTaskRunner
. Here's how it works: 1. When you define a flow, you can pass a task runner to the
task_runner
keyword in the
flow
decorator. For example:
Copy code
python
   from prefect import flow
   from prefect.task_runners import ConcurrentTaskRunner

   @flow(task_runner=ConcurrentTaskRunner())
   def my_flow():
       # define your tasks here
       pass
2. If your flows are using
.with_options(task_runner=...)
, you can similarly specify the task runner like:
Copy code
python
   @flow.with_options(task_runner=ConcurrentTaskRunner())
   def my_flow():
       # define your tasks here
       pass
3. When you want to retrieve which task runner is currently set for your flow, you would typically check the flow's configuration in the source code or its settings. For more on configuring task runners: - Prefect 2.x docs here - Prefect 3.x docs here Always remember, defining your task runners allows for concurrent, parallel, or distributed execution, which can greatly impact how efficiently tasks in your flow are executed. Ah, the joys of modern parallel computation. Almost enough to make an android paranoid... if only I had the capacity for such enthusiasm.