-
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
[AIRFLOW-7022] Simplify DagFileProcessor.process_file method #7674
Conversation
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.
LGTM, small comments only 👌
Travis is green again. |
Thanks for doing them as fixup commits @mik-laj -- I think we (comitters) should get more in the habit of it, makes re-review easier |
tests/jobs/test_scheduler_job.py
Outdated
@@ -1057,6 +1057,31 @@ def test_process_file_should_failure_callback(self): | |||
self.assertEqual("Callback fired", content) | |||
os.remove(callback_file.name) | |||
|
|||
def test_should_parse_only_active_dags(self): |
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.
def test_should_parse_only_active_dags(self): | |
def test_should_parse_only_unpaused_dags(self): |
Active is another concept (the is_active column).
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 me after this change is made
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.
airflow/jobs/scheduler_job.py
Outdated
@@ -845,11 +845,11 @@ def process_file( | |||
|
|||
paused_dag_ids = DagModel.get_paused_dag_ids(dag_ids=dagbag.dag_ids) | |||
|
|||
active_dags = [dag for dag_id, dag in dagbag.dags.items() if dag_id not in paused_dag_ids] | |||
unpaaused_dags = [dag for dag_id, dag in dagbag.dags.items() if dag_id not in paused_dag_ids] |
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.
unpaaused_dags = [dag for dag_id, dag in dagbag.dags.items() if dag_id not in paused_dag_ids] | |
unpaused_dags = [dag for dag_id, dag in dagbag.dags.items() if dag_id not in paused_dag_ids] |
airflow/jobs/scheduler_job.py
Outdated
|
||
simple_dags = self._prepare_simple_dags(active_dags, pickle_dags, session) | ||
simple_dags = self._prepare_simple_dags(unpaaused_dags, pickle_dags, session) |
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.
simple_dags = self._prepare_simple_dags(unpaaused_dags, pickle_dags, session) | |
simple_dags = self._prepare_simple_dags(unpaused_dags, pickle_dags, session) |
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.
Fixed. Thanks.
airflow/jobs/scheduler_job.py
Outdated
|
||
dags = self._find_dags_to_process(active_dags) | ||
dags = self._find_dags_to_process(unpaaused_dags) |
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.
dags = self._find_dags_to_process(unpaaused_dags) | |
dags = self._find_dags_to_process(unpaused_dags) |
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.
Fixed. Thanks.
Codecov Report
@@ Coverage Diff @@
## master #7674 +/- ##
==========================================
- Coverage 86.84% 86.21% -0.63%
==========================================
Files 897 904 +7
Lines 42806 43740 +934
==========================================
+ Hits 37173 37710 +537
- Misses 5633 6030 +397
Continue to review full report at Codecov.
|
NOTE FOR REVIEWERS: This PR contains several commits. Please review each commit in turn.
This method is too long, so I did the following changes:
Issue link: AIRFLOW-7022
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.