airflow.decorators.external_python

Module Contents

Functions

external_python_task([python, python_callable, ...])

Wraps a callable into an Airflow operator to run via a Python virtual environment.

airflow.decorators.external_python.external_python_task(python=None, python_callable=None, multiple_outputs=None, **kwargs)[source]

Wraps a callable into an Airflow operator to run via a Python virtual environment.

Accepts kwargs for operator kwarg. Can be reused in a single DAG.

This function is only used during type checking or auto-completion.

Parameters
  • python (str | None) – Full path string (file-system specific) that points to a Python binary inside a virtualenv that should be used (in VENV/bin folder). Should be absolute path (so usually start with “/” or “X:/” depending on the filesystem/os used).

  • python_callable (Callable | None) – Function to decorate

  • multiple_outputs (bool | None) – If set to True, the decorated function’s return value will be unrolled to multiple XCom values. Dict will unroll to XCom values with its keys as XCom keys. Defaults to False.

Was this entry helpful?