Skip to content

Try Except block that hides why DAGs are not found #714

@ziky90

Description

@ziky90

I am currently having problem that I am not able to see one from my DAGs.

After a while of debugging I have realised, that the problem is in the file airflow/models.py on lines 314 and 315 where is:

try:
....
....
except:
    pass

This perfectly hides the problem which in my case was:

Traceback (most recent call last):
  File "/Users/.virtualenvs/pipeline/bin/airflow", line 17, in <module>
    args.func(args)
  File "/Users/.virtualenvs/pipeline/lib/python2.7/site-packages/airflow/bin/cli.py", line 55, in backfill
    dagbag = DagBag(process_subdir(args.subdir))
  File "/Users/.virtualenvs/pipeline/lib/python2.7/site-packages/airflow/models.py", line 134, in __init__
    self.collect_dags(dag_folder)
  File "/Users/.virtualenvs/pipeline/lib/python2.7/site-packages/airflow/models.py", line 292, in collect_dags
    self.process_file(dag_folder, only_if_updated=only_if_updated)
  File "/Users/.virtualenvs/pipeline/lib/python2.7/site-packages/airflow/models.py", line 181, in process_file
    if not all([s in content for s in ('DAG', 'airflow')]):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1515: ordinal not in range(128)

I would like to ask, what is the reason of this try except block that catches everything? Wouldn't it be better to at least do something like:
logger.warning(exception text)

If you agree, I can fix it and do the PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions