airflow.providers.cncf.kubernetes.callbacks

Module Contents

Classes

ExecutionMode

Enum class for execution mode.

KubernetesPodOperatorCallback

KubernetesPodOperator callbacks methods.

Attributes

client_type

airflow.providers.cncf.kubernetes.callbacks.client_type[source]
class airflow.providers.cncf.kubernetes.callbacks.ExecutionMode[source]

Bases: str, enum.Enum

Enum class for execution mode.

SYNC = 'sync'[source]
ASYNC = 'async'[source]
class airflow.providers.cncf.kubernetes.callbacks.KubernetesPodOperatorCallback[source]

KubernetesPodOperator callbacks methods.

Currently, the callbacks methods are not called in the async mode, this support will be added in the future.

static on_sync_client_creation(*, client, **kwargs)[source]

Invoke this callback after creating the sync client.

Parameters

client (kubernetes.client.CoreV1Api) – the created kubernetes.client.CoreV1Api client.

static on_pod_creation(*, pod, client, mode, **kwargs)[source]

Invoke this callback after creating the pod.

Parameters
  • pod (kubernetes.client.V1Pod) – the created pod.

  • client (client_type) – the Kubernetes client that can be used in the callback.

  • mode (str) – the current execution mode, it’s one of (sync, async).

static on_pod_starting(*, pod, client, mode, **kwargs)[source]

Invoke this callback when the pod starts.

Parameters
  • pod (kubernetes.client.V1Pod) – the started pod.

  • client (client_type) – the Kubernetes client that can be used in the callback.

  • mode (str) – the current execution mode, it’s one of (sync, async).

static on_pod_completion(*, pod, client, mode, **kwargs)[source]

Invoke this callback when the pod completes.

Parameters
  • pod (kubernetes.client.V1Pod) – the completed pod.

  • client (client_type) – the Kubernetes client that can be used in the callback.

  • mode (str) – the current execution mode, it’s one of (sync, async).

static on_pod_cleanup(*, pod, client, mode, **kwargs)[source]

Invoke this callback after cleaning/deleting the pod.

Parameters
  • pod (kubernetes.client.V1Pod) – the completed pod.

  • client (client_type) – the Kubernetes client that can be used in the callback.

  • mode (str) – the current execution mode, it’s one of (sync, async).

static on_operator_resuming(*, pod, event, client, mode, **kwargs)[source]

Invoke this callback when resuming the KubernetesPodOperator from deferred state.

Parameters
  • pod (kubernetes.client.V1Pod) – the current state of the pod.

  • event (dict) – the returned event from the Trigger.

  • client (client_type) – the Kubernetes client that can be used in the callback.

  • mode (str) – the current execution mode, it’s one of (sync, async).

static progress_callback(*, line, client, mode, **kwargs)[source]

Invoke this callback to process pod container logs.

Parameters
  • line (str) – the read line of log.

  • client (client_type) – the Kubernetes client that can be used in the callback.

  • mode (str) – the current execution mode, it’s one of (sync, async).

Was this entry helpful?