astronomer.providers.cncf.kubernetes.operators.kubernetes_pod

Module Contents

Classes

KubernetesPodOperatorAsync

Async (deferring) version of KubernetesPodOperator

exception astronomer.providers.cncf.kubernetes.operators.kubernetes_pod.PodNotFoundException[source]

Bases: airflow.exceptions.AirflowException

Expected pod does not exist in kube-api.

class astronomer.providers.cncf.kubernetes.operators.kubernetes_pod.KubernetesPodOperatorAsync(*, poll_interval=5, logging_interval=None, **kwargs)[source]

Bases: airflow.providers.cncf.kubernetes.operators.kubernetes_pod.KubernetesPodOperator

Async (deferring) version of KubernetesPodOperator

Warning

By default, logs will not be available in the Airflow Webserver until the task completes. However, you can configure KubernetesPodOperatorAsync to periodically resume and fetch logs. This behavior is controlled by param logging_interval.

Parameters:
  • poll_interval (int) – interval in seconds to sleep between checking pod status

  • logging_interval (Optional[int]) – max time in seconds that task should be in deferred state before resuming to fetch latest logs. If None, then the task will remain in deferred state until pod is done, and no logs will be visible until that time.

static raise_for_trigger_status(event)[source]

Raise exception if pod is not in expected state.

defer(last_log_time=None, **kwargs)[source]

Defers to WaitContainerTrigger optionally with last log time.

execute(context)[source]

This is the main method to derive when creating an operator. Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

execute_complete(context, event)[source]

Deprecated; replaced by trigger_reentry.

trigger_reentry(context, event)[source]

Point of re-entry from trigger.

If logging_interval is None, then at this point the pod should be done and we’ll just fetch the logs and exit.

If logging_interval is not None, it could be that the pod is still running and we’ll just grab the latest logs and defer back to the trigger again.