astronomer.providers.cncf.kubernetes.triggers.wait_container

Module Contents

Classes

WaitContainerTrigger

This class is deprecated and will be removed in 2.0.0.

exception astronomer.providers.cncf.kubernetes.triggers.wait_container.PodLaunchTimeoutException[source]

Bases: airflow.exceptions.AirflowException

When pod does not leave the Pending phase within specified timeout.

class astronomer.providers.cncf.kubernetes.triggers.wait_container.WaitContainerTrigger(*, container_name, pod_name, pod_namespace, kubernetes_conn_id=None, hook_params=None, pending_phase_timeout=120, poll_interval=5, logging_interval=None, last_log_time=None)[source]

Bases: airflow.triggers.base.BaseTrigger

This class is deprecated and will be removed in 2.0.0. Use :class: ~airflow.providers.cncf.kubernetes.triggers.pod.KubernetesPodTrigger instead

serialize()[source]

Return the information needed to reconstruct this Trigger.

Returns:

Tuple of (class path, keyword arguments needed to re-instantiate).

Return type:

Tuple[str, Dict[str, Any]]

async get_hook()[source]
async wait_for_pod_start(v1_api)[source]

Loops until pod phase leaves PENDING If timeout is reached, throws error.

async wait_for_container_completion(v1_api)[source]

Waits until container self.container_name is no longer in running state. If trigger is configured with a logging period, then will emit an event to resume the task for the purpose of fetching more logs.

async run()[source]

Run the trigger in an asynchronous context.

The trigger should yield an Event whenever it wants to fire off an event, and return None if it is finished. Single-event triggers should thus yield and then immediately return.

If it yields, it is likely that it will be resumed very quickly, but it may not be (e.g. if the workload is being moved to another triggerer process, or a multi-event trigger was being used for a single-event task defer).

In either case, Trigger classes should assume they will be persisted, and then rely on cleanup() being called when they are no longer needed.