airflow.providers.cncf.kubernetes.callbacks

Attributes

client_type

Classes

ExecutionMode

Enum class for execution mode.

KubernetesPodOperatorCallback

KubernetesPodOperator callbacks methods.

Module Contents

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, operator, **kwargs)[source]

Invoke this callback after creating the sync client.

Parameters:

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

static on_pod_manifest_created(*, pod_request, client, mode, operator, context, **kwargs)[source]

Invoke this callback after KPO creates the V1Pod manifest but before the pod is created.

Parameters:
  • pod_request (kubernetes.client.V1Pod) – the kubernetes pod manifest

  • 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_creation(*, pod, client, mode, operator, context, **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, operator, context, **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, operator, context, **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_teardown(*, pod, client, mode, operator, context, **kwargs)[source]

Invoke this callback after all pod completion callbacks but before the pod is deleted.

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, operator, context, **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, operator, context, **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?