-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[AIRFLOW-5944] Display rendered template_fields without accessing DAG files #6788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AIRFLOW-5944] Display rendered template_fields without accessing DAG files #6788
Conversation
) | ||
|
||
if conn.dialect.name == "mysql": | ||
conn.execute("SET time_zone = '+00:00'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've got this in earlier migrations - I don't think we need it here too do we? Also: how about we just don't use a "TIMESTAMP" type, but "DATETIME" instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't contain the timezones though if we just use DATETIME! It might have undesirable effects when comparing current time with this time!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? https://www.eversql.com/mysql-datetime-vs-timestamp-column-types-which-one-i-should-use/ would imply otherwise.
(Also TIMESTAMP only supports dates up to 2038.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the same article :
To summarize, if you want to serve your date and time data the same way regardless of timezones, you can use the DATETIME type (which will also allow you to use all the date & type functions built in MySQL). Otherwise, you can use TIMESTAMP and serve the data on a per-timezone basis.
Also, from https://docs.sqlalchemy.org/en/13/core/type_basics.html#sqlalchemy.types.DateTime
For timezone support, use at least the TIMESTAMP datatype, if not the dialect-specific datatype object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read that and my conclusion is we should use DATETIME for mysql - Airflow puts in checks to ensure that we only ever store UTC datetimes in the DB.
By using a datetime column the migrations become a lot simpler.
ef008b5
to
a61fc97
Compare
a61fc97
to
aa27c4a
Compare
Hey @kaxil. Do we have any ETA on when it will be merged? |
I am also very interested in changes regarding DAG serialization. If you could share your work progress, I would be very grateful. WIP PR is better than no PR. |
70be2e7
to
4639f07
Compare
2 tests are failing:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a test (with a json blob in the .py file) showing how this is stored.
Unless I'm blind you aren't reading RenderedTaskInstanceFields yet?
We are reading it here: https://github.com/apache/airflow/pull/6788/files#diff-948e87b4f8f644b3ad8c7950958df033R590-R602 |
…8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in #6788 (comment) (cherry picked from commit 99370fe)
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) (cherry picked from commit 99370fe770ad32f01cb9bcb38c97024dfe31ff51) GitOrigin-RevId: 5499302cc3c7fb49affe83e6ee08f8e40b11712c
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) (cherry picked from commit 99370fe770ad32f01cb9bcb38c97024dfe31ff51) GitOrigin-RevId: 5499302cc3c7fb49affe83e6ee08f8e40b11712c
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) (cherry picked from commit 99370fe770ad32f01cb9bcb38c97024dfe31ff51) GitOrigin-RevId: 5499302cc3c7fb49affe83e6ee08f8e40b11712c
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) (cherry picked from commit 99370fe770ad32f01cb9bcb38c97024dfe31ff51) GitOrigin-RevId: 5499302cc3c7fb49affe83e6ee08f8e40b11712c
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) (cherry picked from commit 99370fe770ad32f01cb9bcb38c97024dfe31ff51) GitOrigin-RevId: 5499302cc3c7fb49affe83e6ee08f8e40b11712c
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) (cherry picked from commit 99370fe770ad32f01cb9bcb38c97024dfe31ff51) GitOrigin-RevId: 5499302cc3c7fb49affe83e6ee08f8e40b11712c
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) (cherry picked from commit 99370fe770ad32f01cb9bcb38c97024dfe31ff51) GitOrigin-RevId: 5499302cc3c7fb49affe83e6ee08f8e40b11712c
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
…(#8051) This is because "The composite IN construct is not supported by all backends" Based on discussion in apache/airflow#6788 (comment) GitOrigin-RevId: 99370fe770ad32f01cb9bcb38c97024dfe31ff51
One of the limitations with the current implementation of DAG serialization is that Templated fields still need access to DAG Files.
Potential solution 1: Store rendered version in the DB somewhere.
Limitation: Tasks that are not yet run won't be able to render the templated fields (this is a useful debugging aid, especially for those without CLI access to run
airflow tasks render
) .Potential solution 2: Store both rendered & unrendered version in the DB somewhere. This will allow getting past the Limitation in Solution (1). We should store only the current unrendered version and store the last X number of rendered versions. This will also have an advantage that old task would have the rendered version that was correct at that time (which is not possible currently).
Limitation/Issue: Maintaining two separate tables without much benefit
Potential solution 3: Store rendered version in TI table and unrendered version in a separate column in DAG serialization table. This means that each TI would have an associated rendered field without creating an extra table and duplicating dag_id, task_id & execution_date. Once we start storing different version of serialized DAGs we can have each DAG row have it's unrendered version.
Issue link: AIRFLOW-5944
Make sure to mark the boxes below before creating PR: [x]
[AIRFLOW-NNNN]
. AIRFLOW-NNNN = JIRA ID** For document-only changes commit message can start with
[AIRFLOW-XXXX]
.In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.