Skip to content

Lightrun for Apache Airflow

In order to run Lightrun for Python with Apache Airflow you'll need to decide which step of the DAG you'd like to debug. Choose one (or more) steps and:

  1. Find a place in your system that has access to the same Python interpreter that is used by Airflow, and install the python agent by running python -m pip install lightrun.
  2. In an Airflow DAG file, add the import statement as part of the DAG definition (DAG-NAME should be, for the sake of convenience, either the name of the DAG or of the step you're trying to debug):
with DAG('dag_name', default_args=default_args, schedule_interval=timedelta(days=1), start_date=days_ago(3)) as dag:
    if 'lightrun' not in sys.modules:
        import lightrun
        lightrun.enable(com_lightrun_server="https://app.lightrun.com/company/<COMPANY-NAME>", com_lightrun_secret="<COMPANY-SECRET>", metadata_registration_tags='[{"name": "<DAG-NAME>"}]')

Airflow with Lightrun's Free Tier

The Lightrun free tier limits usage to one agent per user - note that this means that each step can be debugged individually, but you cannot debug multiple steps simultaneously.


Last update: September 27, 2021