Skip to content

Commit

Permalink
try catch when loading dag
Browse files Browse the repository at this point in the history
  • Loading branch information
quy196hp committed Oct 25, 2023
1 parent aad7600 commit 9d8035a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions dagfactory/dagfactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,15 @@ def load_yaml_dags(
suffix = [".yaml", ".yml"]
candidate_dag_files = []
for suf in suffix:
candidate_dag_files = chain(
candidate_dag_files = list(chain(
candidate_dag_files, Path(dags_folder).rglob(f"*{suf}")
)

))
logging.info(candidate_dag_files)
for config_file_path in candidate_dag_files:
config_file_abs_path = str(config_file_path.absolute())
DagFactory(config_file_abs_path).generate_dags(globals_dict)
logging.info("DAG loaded: %s", config_file_path)
logging.info(f"Loading {config_file_abs_path}")
try:
DagFactory(config_file_abs_path).generate_dags(globals_dict)
logging.info("DAG loaded: %s", config_file_path)
except Exception as e:
logging.warning(f"Failed to load dag from {config_file_path}: {e}")

0 comments on commit 9d8035a

Please sign in to comment.