[GitHub] [airflow] mik-laj commented on a change in pull request #7476: [AIRFLOW-6856] Bulk fetch paused_dag_ids

2020-03-02 Thread GitBox
mik-laj commented on a change in pull request #7476: [AIRFLOW-6856] Bulk fetch 
paused_dag_ids
URL: https://github.com/apache/airflow/pull/7476#discussion_r386300967
 
 

 ##
 File path: airflow/jobs/scheduler_job.py
 ##
 @@ -816,7 +811,12 @@ def process_file(self, file_path, zombies, 
pickle_dags=False, session=None):
 # Save individual DAGs in the ORM and update 
DagModel.last_scheduled_time
 dagbag.sync_to_db()
 
-paused_dag_ids = {dag.dag_id for dag in dagbag.dags.values() if 
dag.is_paused}
+paused_dag_ids = (
+session.query(DagModel.dag_id)
+.filter(DagModel.is_paused.is_(True))
+.filter(DagModel.dag_id.in_(dagbag.dag_ids))
 
 Review comment:
   This is executed only for DAGs from one file. In one file you would have to 
have several thousand DAGs to cause problems. For now, I focused on the 
situation when we have up to 200 DAGs. If we want to support several thousand 
DAGs in one file, we need to introduce much more optimization and this one 
would not change anything.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] mik-laj commented on a change in pull request #7476: [AIRFLOW-6856] Bulk fetch paused_dag_ids

2020-03-02 Thread GitBox
mik-laj commented on a change in pull request #7476: [AIRFLOW-6856] Bulk fetch 
paused_dag_ids
URL: https://github.com/apache/airflow/pull/7476#discussion_r386300967
 
 

 ##
 File path: airflow/jobs/scheduler_job.py
 ##
 @@ -816,7 +811,12 @@ def process_file(self, file_path, zombies, 
pickle_dags=False, session=None):
 # Save individual DAGs in the ORM and update 
DagModel.last_scheduled_time
 dagbag.sync_to_db()
 
-paused_dag_ids = {dag.dag_id for dag in dagbag.dags.values() if 
dag.is_paused}
+paused_dag_ids = (
+session.query(DagModel.dag_id)
+.filter(DagModel.is_paused.is_(True))
+.filter(DagModel.dag_id.in_(dagbag.dag_ids))
 
 Review comment:
   This is executed only for DAGs from one file. You would have to have a few 
thousand DAGs in one file. For now, I focused on the situation when we have up 
to 200 DAGs. If we want to support several thousand DAGs in one file, we need 
to introduce much more optimization and this one would not change anything.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] mik-laj commented on a change in pull request #7476: [AIRFLOW-6856] Bulk fetch paused_dag_ids

2020-02-21 Thread GitBox
mik-laj commented on a change in pull request #7476: [AIRFLOW-6856] Bulk fetch 
paused_dag_ids
URL: https://github.com/apache/airflow/pull/7476#discussion_r382545084
 
 

 ##
 File path: airflow/jobs/scheduler_job.py
 ##
 @@ -780,7 +788,12 @@ def process_file(self, file_path, zombies, 
pickle_dags=False, session=None):
 for dag in dagbag.dags.values():
 dag.sync_to_db()
 
-paused_dag_ids = {dag.dag_id for dag in dagbag.dags.values() if 
dag.is_paused}
+paused_dag_ids = (
+session.query(DagModel.dag_id)
+.filter(DagModel.is_paused.is_(True))
+.filter(DagModel.dag_id.in_(dagbag.dag_ids))
+.all()
+)
 
 Review comment:
   Good catch. dags parameters contain only active dags, so we don't have to 
check it a second time.


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:
us...@infra.apache.org


With regards,
Apache Git Services