<@ULVA73B9P> I have two process workers (one name...
# ask-marvin
s
@Marvin I have two process workers (one named, one unnamed) listening to the same work pool, but one of them is started with:
Copy code
prefect worker start -n named_worker -p same_work_pool -q my_different_queue
I am using this yaml for a particular deployment:
Copy code
deployments:
  - name: my_deployment
    
    concurrency_limit: null
    description: "The eds dev workflow"
    entrypoint: flows/my_flow.py:my_flow
    work_pool:
      name: same_work_pool
      work_queue_name: my_different_queue
      job_variables:
        working_dir: ...
Copy code
How can I point this deployment so that jobs are only sent to the `named_worker` process worker?
m
thought for 336.8 seconds
Short answer: you can’t pin a deployment to a specific worker instance by name in Prefect 3.x. Routing is done by work pool and work queue. If two workers poll the same pool/queue, either can pick up the run. In your setup, the unnamed worker (started without
-q
) will poll all queues in
same_work_pool
, including
my_different_queue
, so it will compete with
named_worker
. Ways to ensure only
named_worker
runs this deployment: - Restrict the other worker’s queues - Start the unnamed worker with explicit queues that do not include `my_different_queue`:
Copy code
prefect worker start -p same_work_pool -q default -q some_other_queue
- Keep
named_worker
as-is:
Copy code
prefect worker start -n named_worker -p same_work_pool -q my_different_queue
- Or isolate via a dedicated work pool - Create a pool just for
named_worker
and update the deployment’s
work_pool.name
to that pool:
Copy code
prefect work-pool create "dedicated-pool" --type process
  prefect worker start -n named_worker -p dedicated-pool -q my_different_queue
- Update your deployment YAML:
Copy code
deployments:
    - name: my_deployment
      entrypoint: flows/my_flow.py:my_flow
      work_pool:
        name: dedicated-pool
        work_queue_name: my_different_queue
Notes: - Setting
concurrency_limit
or queue concurrency won’t force runs to a specific worker; it just limits total concurrent runs across all workers polling that queue. - A worker started without
-q
polls all queues in the pool by default. References: - Workers concept (includes
-q
behavior): Workers - Work pools and queues: Work Pools and Queues - CLI reference for `prefect worker start`: Worker CLI