Eugene Goldberg
Eugene Goldberg

Reputation: 15564

how to suppress errors in airflow cli output?

Working on some Airflow monitoring ideas. When I execute airflow list_tasks my_dag I get a whole lot of unneeded garbage along with the actual desired output:

[2018-12-11 22:39:00,301] {__init__.py:51} INFO - Using executor SequentialExecutor
[2018-12-11 22:39:00,423] {models.py:271} INFO - Filling up the DagBag from /root/airflow/dags
[2018-12-11 22:39:00,448] {models.py:380} ERROR - Failed to import: /usr/local/lib/python3.7/site-packages/airflow/example_dags/example_http_operator.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/airflow/models.py", line 377, in process_file
    m = imp.load_source(mod_name, filepath)
  File "/usr/local/lib/python3.7/imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 696, in _load
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.7/site-packages/airflow/example_dags/example_http_operator.py", line 27, in <module>
    from airflow.operators.http_operator import SimpleHttpOperator
  File "/usr/local/lib/python3.7/site-packages/airflow/operators/http_operator.py", line 21, in <module>
    from airflow.hooks.http_hook import HttpHook
  File "/usr/local/lib/python3.7/site-packages/airflow/hooks/http_hook.py", line 23, in <module>
    import tenacity
  File "/usr/local/lib/python3.7/site-packages/tenacity/__init__.py", line 352
    from tenacity.async import AsyncRetrying
                      ^
SyntaxError: invalid syntax
also_run_this
run_after_loop
run_this_last
runme_0
runme_1
runme_2

What I really need out of all this is:

also_run_this

run_after_loop

run_this_last

runme_0

runme_1

runme_2

Is there a way to suppress all, except for the actual result?

Upvotes: 2

Views: 2251

Answers (2)

blueberry
blueberry

Reputation: 354

Upgrade tenacity to the latest version. Although during upgrade it shows a warning: "apache-airflow 1.10.1 has requirement tenacity==4.8.0, but you'll have tenacity 5.0.2 which is incompatible". Please ignore this

Compatibility: Python 3.7.1 apache-airflow 1.10.1 tenacity 5.0.2

Hope this helps!

Upvotes: 5

joebeeson
joebeeson

Reputation: 4366

You're using a version of Python that treats async as a reserved word. You can either downgrade to a version where that is not the case or you can disable the example DAGs in your configuration.

Upvotes: 3

Related Questions