airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] XD-DENG commented on a change in pull request #3698: [AIRFLOW-2855] Check Cron Expression Validity in DagBag.process_file()
Date Mon, 06 Aug 2018 06:50:35 GMT
XD-DENG commented on a change in pull request #3698: [AIRFLOW-2855] Check Cron Expression Validity
in DagBag.process_file()
URL: https://github.com/apache/incubator-airflow/pull/3698#discussion_r207788097
 
 

 ##########
 File path: airflow/models.py
 ##########
 @@ -414,6 +427,16 @@ def process_file(self, filepath, only_if_updated=True, safe_mode=True):
                         self.bag_dag(dag, parent_dag=dag, root_dag=dag)
                         found_dags.append(dag)
                         found_dags += dag.subdags
+                        if isinstance(dag._schedule_interval, six.string_types):
+                            croniter(dag._schedule_interval)
+                    except (CroniterBadCronError,
+                            CroniterBadDateError,
+                            CroniterNotAlphaError) as cron_e:
+                        self.log.exception("Failed to bag_dag: %s", dag.full_filepath)
+                        self.import_errors[dag.full_filepath] = \
+                            "Invalid Cron expression: " + str(cron_e)
+                        self.file_last_changed[dag.full_filepath] = \
+                            file_last_changed_on_disk
 
 Review comment:
   One is for `.py` DAG file, and the another is for package DAG file (`.zip` file).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Mime
View raw message