研究一些气流监测的想法。
当我执行airflow list_tasks my_dag
时,会得到大量不必要的垃圾以及实际的期望输出:
[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
我真正需要的是:
also_run_this
run_after_loop
run_this_last
runme_0
runme_1
runme_2
除了实际结果之外,是否有一种方法可以抑制所有情况?
答案 0 :(得分:5)
将韧性升级到最新版本 虽然在升级时,它显示警告: “ apache-airflow 1.10.1要求韧度== 4.8.0,但您将具有不相容的韧度5.0.2”。请忽略此
兼容性: 的Python 3.7.1 apache-airflow 1.10.1 韧性5.0.2
希望这会有所帮助!
答案 1 :(得分:3)
您使用的Python版本将async
视为保留字。您可以降级到不是这种情况的版本,或者可以在配置中禁用示例DAG。