https://prefect.io logo
Title
t

Tanishq Hooda

02/24/2023, 5:22 AM
Hi, I'm using Deployment.build_from_flow(.....) to create deployments for my flow and want to mention worker_pool name here as well. I tried work_pool_name parameter but it is not allowed, can anyone please help me what to use? Thanks!
Deployment.build_from_flow(
    flow=my_flow,
    name="my_flow",
    parameters={},
    infra_overrides={
        "image": SHARED_CONFIG.value["prefect_image_name"],
        "service_account_name": "my-sa",
        "image_pull_policy": "Always",
        "namespace": "mynamespace",
    },
    infrastructure={"block_type_slug": "kubernetes-job"},
    work_queue_name="k8s",
    work_pool_name="my-worker-pool", # doesn't work
    storage=storage,
    .....
    .....
Even though I can update the worker pool from the UI but I want to do it from code. Prefect version :
2.7.7
1
deployment = cls(name=name, **kwargs)
  File "pydantic\main.py", line 342, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for Deployment
work_pool_name
  extra fields not permitted (type=value_error.extra)
s

Samuel Hinton

02/24/2023, 6:40 AM
Youll need to update prefect to the latest version, work_pool_name is a new experimental attribute
:thank-you: 3