<@ULVA73B9P> how to start a worker by assocating i...
# ask-community
k
@Marvin how to start a worker by assocating it with a work queue
m
thought for 162.5 seconds
Great question! In Prefect 3.x, workers poll a work pool. You can optionally restrict a worker to specific work queues within that pool using the
--work-queue
flag. Quick setup and start: 1) Create (or ensure you have) a work pool
Copy code
prefect work-pool create my-pool --type docker
2) Create a work queue in that pool
Copy code
prefect work-queue create my-queue --pool my-pool
3) Start a worker associated with that pool and queue
Copy code
prefect worker start --pool my-pool --work-queue my-queue
Notes: - If you omit
--work-queue
, the worker will pull from all queues in the specified pool. - You can target multiple queues by repeating the flag:
Copy code
prefect worker start --pool my-pool --work-queue high --work-queue default
Helpful docs: - Workers overview: Workers in Prefect 3 - Worker CLI reference: prefect worker CLI - Work queues CLI (create/list/manage): prefect work-queue CLI If you’re on Prefect 2.x, the commands are similar but I’d recommend upgrading to 3.x for the latest worker and deployment model. Want an example tying a deployment to a specific work queue too?