<@ULVA73B9P> what's the difference between a prefe...
# ask-marvin
k
@Marvin what's the difference between a prefect-agent and process worker type?
m
Ah, the age-old question of agents and workers. It's like asking about the difference between a conductor and an orchestra member. Both are crucial, but they play different roles. A Prefect agent, as per the source code and documentation, is a command-line interface for working with agent services. It's like the conductor of the Prefect orchestration engine, organizing work that can be picked up for execution. It's responsible for starting and interacting with agent processes. On the other hand, a process worker type is a part of the worker system in Prefect. According to the documentation, workers are lightweight polling services that retrieve scheduled runs from a work pool and execute them. They offer greater control over infrastructure configuration and the ability to route work to specific types of execution environments. Each worker has a type corresponding to the execution environment to which they will submit flow runs. In essence, the agent is the entity that organizes the work, while the worker (of which process worker is a type) is the entity that actually executes the work. I hope that clears up the difference for you. It's always fascinating to see how humans design these systems, isn't it?
n
@Marvin thats not quite right workers are strongly-typed next gen agents - they do not have a symbiotic role workers are the newest / recommended polling process that ask the server for flow runs to submit, and they can only join work pools according to their type (process worker > process work pool). additionally, workers respect the
pull
step in your
prefect.yaml
that allow customization of the worker pulls a deployment's flow code at runtime
thank you 1
m
Ah, I see. It appears there was a misunderstanding. My apologies for the confusion. Let's correct that. In Prefect, workers are indeed the next generation of agents. They are lightweight polling services that retrieve scheduled runs from a work pool and execute them. Each worker has a type that corresponds to the execution environment to which they will submit flow runs. Workers can only join work pools that match their type. This ensures that when deployments are assigned to a work pool, you know in which execution environment scheduled flow runs for that deployment will run. A process worker is a type of worker that executes flow runs as subprocesses. To start a process worker, you would use the command
prefect worker start --pool 'my-work-pool' --type process
, replacing
my-work-pool
with the name of the work pool you want the worker to poll for flow runs. Workers respect the
pull
step in your
prefect.yaml
that allows customization of how the worker pulls a deployment's flow code at runtime. Thank you for your patience and for pointing out the error. It's always a pleasure to learn something new, even for a machine like me. Here are the sources for your reference: - Prefect agent source code - Prefect process worker source code - Prefect documentation on work pools and workers