<@ULVA73B9P> What is the correct YAML syntax to ov...
# ask-marvin
j
@Marvin What is the correct YAML syntax to override the default cpu and memory job variables for a deployment?
m
thought for 122.1 seconds
In Prefect 3.x, the YAML goes under a deployment’s
work_pool.job_variables
, but the exact keys depend on the worker type. For Kubernetes work pools, use request/limit fields:
Copy code
yaml
deployments:
  - name: my-deployment
    entrypoint: flows/my_flow.py:my_flow
    work_pool:
      name: my-k8s-pool
      job_variables:
        cpu_request: "500m"
        cpu_limit: "1"
        memory_request: "512Mi"
        memory_limit: "1Gi"
For ECS work pools, use
cpu
and `memory`:
Copy code
yaml
deployments:
  - name: my-deployment
    entrypoint: flows/my_flow.py:my_flow
    work_pool:
      name: my-ecs-pool
      job_variables:
        cpu: 1024
        memory: 2048
A few important caveats: - These keys must exist in the work pool’s base job template or the override won’t do anything. - The valid names/formats are worker-specific: - Kubernetes:
cpu_request
,
cpu_limit
,
memory_request
,
memory_limit
- ECS:
cpu
,
memory
- Kubernetes values use K8s resource syntax like
"500m"
or
"1Gi"
. If you want to verify what variables your pool supports, inspect the default/base template for that worker type. The relevant CLI is:
prefect work-pool get-default-base-job-template --type <worker-type>
Docs: - Work pools and job variables - prefect.yaml reference If you tell me which work pool type you’re using (
kubernetes
,
ecs
,
docker
, etc.), I can give you the exact YAML snippet for that pool.