You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/01/14 12:09:39 UTC

[GitHub] [airflow] ashb commented on a change in pull request #7157: [AIRFLOW-6251] add config for max tasks per dag

ashb commented on a change in pull request #7157: [AIRFLOW-6251] add config for max tasks per dag
URL: https://github.com/apache/airflow/pull/7157#discussion_r366303058
 
 

 ##########
 File path: airflow/models/dagbag.py
 ##########
 @@ -300,26 +302,37 @@ def process_file(self, filepath, only_if_updated=True, safe_mode=True):
                         dag.full_filepath = filepath
                         if dag.fileloc != filepath and not is_zipfile:
                             dag.fileloc = filepath
-                    try:
-                        dag.is_subdag = False
-                        self.bag_dag(dag, parent_dag=dag, root_dag=dag)
-                        if isinstance(dag._schedule_interval, str):
-                            croniter(dag._schedule_interval)
-                        found_dags.append(dag)
-                        found_dags += dag.subdags
-                    except (CroniterBadCronError,
-                            CroniterBadDateError,
-                            CroniterNotAlphaError) as cron_e:
-                        self.log.exception("Failed to bag_dag: %s", dag.full_filepath)
+
+                    num_tasks = len(dag.tasks)
+                    if max_tasks_per_dag > 0 and num_tasks > max_tasks_per_dag:
 
 Review comment:
   That doens't wotk @zhongjiajie 
   
   ```
   In [1]: x = 0                                                                                                                                                  
   
   In [2]: num_task = 10                                                                                                                                          
   
   In [3]: 0 < x < num_task                                                                                                                                       
   Out[3]: False
   ```

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


With regards,
Apache Git Services