Configuring worker pod resources in a DAG file

In Cloudera Workflow Orchestrator, tasks execute inside isolated Kubernetes worker pods. By default, these pods are assigned standard resource limits. To optimize pipeline performance and prevent memory or CPU bottlenecks, you can override these defaults at either the task level or the DAG level using the executor_config dictionary.

By default, worker pods execute with the following standard resource specifications:

  • Requests: 100m CPU and 1 GB of RAM.
  • Limits: Unrestricted CPU and a strict limit of 1 GB of RAM.
  1. Identify the CPU and memory requirements for your workload. Resources are defined using standard Kubernetes syntax:
    • CPU: Specified in cores (example, 1) or millicores (example, 500m).
    • Memory: Specified in bytes, Ki, Mi, Gi, and so on. (example, 2Gi).
  2. Open the DAG file.
  3. Define the worker pod resources in the DAG file.

    Example,

    config_resource_requirements = {
        "pod_override": k8s.V1Pod(
            spec=k8s.V1PodSpec(
                containers=[
                    k8s.V1Container(
                        name="base",
                        resources=k8s.V1ResourceRequirements(
                            requests={"cpu": "200m", "memory": "1024Mi"},
                            limits={"cpu": "200m", "memory": "1024Mi"},
                        ),
                    )
                ]
            )
        )
    }
  4. Configure the worker pod resources for a specific task or across the DAG file for all the tasks. Perform one of the following steps:
    • Configure the worker pod resources for a specific task using the executor_config dictionary in that task.

      Example,

      from airflow import DAG
      from airflow.operators.bash import BashOperator
      from kubernetes.client import models as k8s
      from pendulum import datetime
      
      config_resource_requirements = {
          "pod_override": k8s.V1Pod(
              spec=k8s.V1PodSpec(
                  containers=[
                      k8s.V1Container(
                          name="base",
                          resources=k8s.V1ResourceRequirements(
                              requests={"cpu": "200m", "memory": "1024Mi"},
                              limits={"cpu": "200m", "memory": "1024Mi"},
                          ),
                      )
                  ]
              )
          )
      }
      
      with DAG(
          dag_id="worker_resources_override",
          start_date=datetime(2026, 1, 1),
          schedule=None,
          catchup=False,
      ):
          BashOperator(
              task_id="whoami",
              bash_command="whoami",
              executor_config=config_resource_requirements,
          )
    • Configure the worker pod resources in the DAG globally for all the tasks using the executor_config dictionary.

      Example,

      from airflow import DAG
      from airflow.operators.bash import BashOperator
      from kubernetes.client import models as k8s
      from pendulum import datetime
      
      config_resource_requirements = {
          "pod_override": k8s.V1Pod(
              spec=k8s.V1PodSpec(
                  containers=[
                      k8s.V1Container(
                          name="base",
                          resources=k8s.V1ResourceRequirements(
                              requests={"cpu": "200m", "memory": "1024Mi"},
                              limits={"cpu": "200m", "memory": "1024Mi"},
                          ),
                      )
                  ]
              )
          )
      }
      
      with DAG(
          dag_id="worker_resources_override",
          start_date=datetime(2026, 1, 1),
          schedule=None,
          catchup=False,
          default_args={"executor_config": config_resource_requirements},
      ) as dag:
  5. Deploy the DAG and monitor the worker pods to make sure that they are initialized with the requested resource limits and requests.