<@ULVA73B9P> in Prefect 3 what is a Runner
# marvin-ai
f
@Marvin in Prefect 3 what is a Runner
m
In Prefect 3.x, a "Runner" typically refers to a "TaskRunner," which is an abstract base class designed for executing tasks. TaskRunners manage how tasks are executed, whether concurrently or in parallel, and handle task-related futures and exceptions. They are a crucial part of Prefect's execution model, allowing you to define the behavior of task execution within flows. For more details, you can explore the task_runners.py source code.
n
hi @Fernando Correia - are you referring to a task runner? separately there is a thing called the Runner but it is an internal abstraction that you generally shouldn’t need to know about as a user, is there a reason it came up?
f
hi @Nate, I'm just trying to learn more about prefect settings and to understand the difference between
PREFECT_RUNNER_POLL_FREQUENCY
and
PREFECT_WORKER_QUERY_SECONDS
.
PREFECT_RUNNER_POLL_FREQUENCY
's description is
Number of seconds a runner should wait between queries for scheduled work.
That's why I got curious about what a runner is. I am just trying to understand the different components.
n
ah i understand why those 2 settings might cause some confusion essentially they're the same thing, which is "how often to ask the server if there are scheduled runs?", but why do they both ask the same question? to summarize:
.serve
is an easy-mode deployment where the
Runner
listens for scheduled work (i.e. no separate long-lived worker process required), so while the worker is typically the long-lived process that only listens for scheduled work (and therefore has a setting to decide how often to ask for work), the Runner can take on this responsibility in the case of
.serve
we have some work in flight to clarify the separation of concerns here internally, but tldr, you generally don't have to change these settings, but if you do: •
PREFECT_WORKER_QUERY_SECONDS
controls how often your long-lived worker process checks for work •
PREFECT_RUNNER_POLL_FREQUENCY
controls how often your
Runner
asks for work in the case of
.serve
where there is no separate listening process
f
Understood, it's crystal clear now. Thanks for the explanation!
catjam 1