Hash airflow in the first line of dag

68 views Asked by At

Is there any significance of adding '''# airflow''' as the first line in airflow dag. Because python will treat it as a comment.

1

There are 1 answers

0
Bas Harenslak On BEST ANSWER

TLDR; no, there is no significance. I would remove it to avoid any confusion.

I suspect you might have seen this somewhere on the internet, where the topic was around Airflow & DAG processing. Airflow uses a heuristic to discover files that potentially contain DAG objects: it checks if the words "airflow" and "DAG" exist in the file. I suspect adding "# airflow" might have been a workaround for Airflow to parse that script. However, in normal circumstances this should not be needed: if you have a DAG object in your script, you will need to import from airflow import DAG, which automatically makes Airflow parse that script, so an additional comment "# airflow" is therefore not needed.