Skip to content

How does 'getting_time' work in a dag in Airflow? #40155

Answered by potiuk
AubrynnReina asked this question in Q&A
Discussion options

You must be logged in to vote

Airflow parses the DAG file multiple times - every 30 seconds by default when DAG file processor is scanning it. Plus every time task gets executed it's parsed again on the worker. There are good reasons for that, but basically every time your "now" will be different so you should use one of the dates available in context - for example execution_date or end_date' or start_date` - see all available context variables here https://airflow.apache.org/docs/apache-airflow/2.9.2/templates-ref.html

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@AubrynnReina
Comment options

@potiuk
Comment options

@AubrynnReina
Comment options

Answer selected by AubrynnReina
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants