ExternalPythonOperator
Apache AirflowAllows one to run a function in a virtualenv that is not re-created but used as is without the overhead of creating the virtualenv (with certain caveats).
Access Instructions
Install the Apache Airflow provider package into your Airflow environment.
Import the module into your DAG file and instantiate it with your desired params.
Parameters
Documentation
Allows one to run a function in a virtualenv that is not re-created but used as is without the overhead of creating the virtualenv (with certain caveats).
The function must be defined using def, and not be part of a class. All imports must happen inside the function and no variables outside the scope may be referenced. A global scope variable named virtualenv_string_args will be available (populated by string_args). In addition, one can pass stuff through op_args and op_kwargs, and one can use a return value. Note that if your virtualenv runs in a different Python major version than Airflow, you cannot use return values, op_args, op_kwargs, or use any macros that are being provided to Airflow through plugins. You can use string_args though.
If Airflow is installed in the external environment in different version that the version used by the operator, the operator will fail.,
See also
For more information on how to use this operator, take a look at the guide: ExternalPythonOperator