Airflow: distinguish API- and UI-triggered dag runs

Viewed 49

I'm using Apache Airflow 2.2.4. When I trigger a DAG run via UI click or via API call, I get context['dag_run'].external_trigger = True and context['dag_run'].run_type = 'scheduled' in both cases. I would like to distinguish between those two cases though. How can I do so?

1 Answers
  1. Create new Role that doesn't have the permission action = website.
  2. Create a new user that have this role for your API calls.
  3. from the context["dag_run"] you can get "owner"
Related