airflow.providers.cncf.kubernetes.triggers.pod

Module Contents

Classes

ContainerState

Possible container states

KubernetesPodTrigger

KubernetesPodTrigger run on the trigger worker to check the state of Pod.

class airflow.providers.cncf.kubernetes.triggers.pod.ContainerState[source]

Bases: str, enum.Enum

Possible container states See https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase.

WAITING = 'waiting'[source]
RUNNING = 'running'[source]
TERMINATED = 'terminated'[source]
FAILED = 'failed'[source]
UNDEFINED = 'undefined'[source]
class airflow.providers.cncf.kubernetes.triggers.pod.KubernetesPodTrigger(pod_name, pod_namespace, trigger_start_time, base_container_name, kubernetes_conn_id=None, poll_interval=2, cluster_context=None, config_dict=None, in_cluster=None, should_delete_pod=True, get_logs=True, startup_timeout=120)[source]

Bases: airflow.triggers.base.BaseTrigger

KubernetesPodTrigger run on the trigger worker to check the state of Pod.

Parameters
  • pod_name (str) – The name of the pod.

  • pod_namespace (str) – The namespace of the pod.

  • kubernetes_conn_id (str | None) – The kubernetes connection id for the Kubernetes cluster.

  • cluster_context (str | None) – Context that points to kubernetes cluster.

  • config_dict (dict | None) – Kubernetes config file content in dict format. If not specified, default value is ~/.kube/config

  • poll_interval (float) – Polling period in seconds to check for the status.

  • trigger_start_time (datetime.datetime) – time in Datetime format when the trigger was started

  • in_cluster (bool | None) – run kubernetes client with in_cluster configuration.

  • should_delete_pod (bool) – What to do when the pod reaches its final state, or the execution is interrupted. If True (default), delete the pod; if False, leave the pod.

  • get_logs (bool) – get the stdout of the container as logs of the tasks.

  • startup_timeout (int) – timeout in seconds to start up the pod.

serialize()[source]

Serializes KubernetesCreatePodTrigger arguments and classpath.

async run()[source]

Gets current pod status and yields a TriggerEvent

define_container_state(pod)[source]
static should_wait(pod_phase, container_state)[source]

Was this entry helpful?