BasPH opened a new pull request #8266: Fix non updating DAG code by checking 
against last modification time
URL: https://github.com/apache/airflow/pull/8266
 
 
   The DAG code only seemed to update in certain conditions. After closer 
inspection, it turns out we save utcnow() in the last_updated column. With a 
threshold of 120 seconds, the result was that a file updated within two minutes 
from the last utcnow(), will never be updated.
   
   This change simply checks if the last updated time is larger than the last 
updated time registered in the DB. If so, that means a change and the file is 
updated.
   
   Draft for now, because I don't understand the reasoning for a 120 second 
threshold yet, plus want to check tests. @kaxil why was the 120 second 
threshold in there? Simply checking for a different modification time makes 
more sense to me, with this change I instantly see the updated code in the 
webserver, and I don't think people update DAG code every second.
   
   Lastly, I noticed the other views seem to suffer from a similar bug when 
using `AIRFLOW__CORE__STORE_SERIALIZED_DAGS=True`. Clicking Refresh in the UI 
doesn't update the DAG structure if I add a new task. Will cover in a separate 
issue.
   
   ---
   Make sure to mark the boxes below before creating PR: [x]
   
   - [ ] Description above provides context of the change
   - [ ] Unit tests coverage for changes (not needed for documentation changes)
   - [ ] Commits follow "[How to write a good git commit 
message](http://chris.beams.io/posts/git-commit/)"
   - [ ] Relevant documentation is updated including usage instructions.
   - [ ] I will engage committers as explained in [Contribution Workflow 
Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
   
   ---
   In case of fundamental code change, Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals))
 is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party 
License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in 
[UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   Read the [Pull Request 
Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)
 for more information.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to