-
Notifications
You must be signed in to change notification settings - Fork 16.4k
[AIRFLOW-4760] Fix package DAGs disappearing from DagBag when reloaded #5404
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
Conversation
ashb
left a comment
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.
Code looks good - though there is already a text/dags/test_zip.zip that we should use instead of creating a new example dag (those show up in every new install which we don't want here)
|
Thanks for the lightning-fast review @ashb. ⚡️Updated and waiting for Travis... |
80840a4 to
b779d64
Compare
Codecov Report
@@ Coverage Diff @@
## master #5404 +/- ##
==========================================
- Coverage 78.97% 10.8% -68.17%
==========================================
Files 483 483
Lines 30254 30254
==========================================
- Hits 23893 3270 -20623
- Misses 6361 26984 +20623
Continue to review full report at Codecov.
|
|
Phew! 😓 Wow, @ashb, that change caused a totally unexpected (to me) failure in Travis. Very painful to track down, but it's ✅ now! |
…loaded (apache#5404) (cherry picked from commit 34056f8)
…loaded (apache#5404) (cherry picked from commit 34056f8)
* changes: Cherrypick [AIRFLOW-4760] PR apache/airflow#5404 Cherrypick [AIRFLOW-3626] apache/airflow#4439 GitOrigin-RevId: 05ea000a888d92c30b83c649efc888cbeb149a6e
* changes: Cherrypick [AIRFLOW-4760] PR apache/airflow#5404 Cherrypick [AIRFLOW-3626] apache/airflow#4439 GitOrigin-RevId: 05ea000a888d92c30b83c649efc888cbeb149a6e
* changes: Cherrypick [AIRFLOW-4760] PR apache/airflow#5404 Cherrypick [AIRFLOW-3626] apache/airflow#4439 GitOrigin-RevId: 05ea000a888d92c30b83c649efc888cbeb149a6e
* changes: Cherrypick [AIRFLOW-4760] PR apache/airflow#5404 Cherrypick [AIRFLOW-3626] apache/airflow#4439 GitOrigin-RevId: 05ea000a888d92c30b83c649efc888cbeb149a6e
Make sure you have checked all steps below.
Jira
Description
AIRFLOW-2900 introduced a change that broke Airflow whenever it tries to reprocess a packaged DAG. Since that change, the
fileloccolumn in the database for packaged DAGs isn't an actual filepath. It looks something like:/usr/local/airflow/dags/package.zip/my_dag.py-- notice that the path to the DAG inside the zip is appended to the zip file's path. Then, when theDagBag#process_filemethod tries to load that filepath, it bails because that filepath is invalid.This PR fixes that behavior by updating the
DagBag#get_dagmethod such that when it fetches the DAG from the database and proceeds to reprocess the file, instead of using theorm_dag.filelocproperty directly, we reuse thecorrect_maybe_zippedhelper function to ensure that the passed value is an actual filepath.Before
After
Tests
My PR adds the following unit tests OR does not need testing for this extremely good reason:
filelocproperty does not change for packaged DAGs.pyDAGs can also be refreshed (seems silly to have test coverage for only packaged DAGs 😄)Commits
Documentation
Code Quality
flake8