-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
Use Hash of Serialized DAG to determine DAG is changed or not #10227
Conversation
935a138
to
a000450
Compare
Ping @potiuk |
airflow/models/serialized_dag.py
Outdated
@@ -65,6 +66,11 @@ class SerializedDagModel(Base): | |||
fileloc_hash = Column(BigInteger, nullable=False) | |||
data = Column(sqlalchemy_jsonfield.JSONField(json=json), nullable=False) | |||
last_updated = Column(UtcDateTime, nullable=False) | |||
# TODO: Make dag_hash not nullable in Airflow 1.10.13 or Airflow 2.0?? |
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 can make it not nullable and add default value in the migration ("Hash not calculated yet"). This way it will be refreshed with the next run automagically and we will not worry about nullability.
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.
Good point. I was tempted to do that, the only reason I didn't do it was to avoid any impression that it is a hash but I think that might not be a problem.
airflow/models/serialized_dag.py
Outdated
serialized_dag_hash_from_db = session.query( | ||
cls.dag_hash).filter(cls.dag_id == dag.dag_id).scalar() | ||
|
||
if serialized_dag_hash_from_db and (serialized_dag_hash_from_db == new_serialized_dag.dag_hash): |
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.
If make the column nullable with default this might be just ==
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.
Updated
1287765
to
de3f184
Compare
🎉 👍 |
…#10227) closes apache#10116 (cherry picked from commit adce6f0)
closes #10116
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
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.