气流 HttpSensor 将无法工作
Airflow HttpSensor won't work
我正在尝试使用以下代码在 Airflow 中创建一个 HttpSensor:
wait_to_launch = HttpSensor(
task_id="wait-to-launch",
endpoint='http://' + socket.gethostname() + ":8500/v1/kv/launch-cluster?raw",
response_check=lambda response: True if 'oui'==response.content else False,
dag=dag
)
但是我一直收到这个错误:
Traceback (most recent call last):
File "http_sensor_test.py", line 30, in <module>
dag=dag
File "/home/me/.local/lib/python2.7/site-packages/airflow/utils/decorators.py", line 86, in wrapper
result = func(*args, **kwargs)
File "/home/me/.local/lib/python2.7/site-packages/airflow/operators/sensors.py", line 663, in __init__
self.hook = hooks.http_hook.HttpHook(method='GET', http_conn_id=http_conn_id)
File "/home/me/.local/lib/python2.7/site-packages/airflow/utils/helpers.py", line 436, in __getattr__
raise AttributeError
AttributeError
我错过了什么?
您 运行 遇到了一个已知问题,请参阅 AIRFLOW-1030. A fix has been merged (#2180),但遗憾的是尚未发布 airflow 版本。该修复已标记为下一个版本 (1.9.0),但在发布之前可能 weeks/months。您可以 运行 通过此更改创建气流分支,或将 HttpSensor 的更新版本添加为自定义运算符(插件)。
我正在尝试使用以下代码在 Airflow 中创建一个 HttpSensor:
wait_to_launch = HttpSensor(
task_id="wait-to-launch",
endpoint='http://' + socket.gethostname() + ":8500/v1/kv/launch-cluster?raw",
response_check=lambda response: True if 'oui'==response.content else False,
dag=dag
)
但是我一直收到这个错误:
Traceback (most recent call last):
File "http_sensor_test.py", line 30, in <module>
dag=dag
File "/home/me/.local/lib/python2.7/site-packages/airflow/utils/decorators.py", line 86, in wrapper
result = func(*args, **kwargs)
File "/home/me/.local/lib/python2.7/site-packages/airflow/operators/sensors.py", line 663, in __init__
self.hook = hooks.http_hook.HttpHook(method='GET', http_conn_id=http_conn_id)
File "/home/me/.local/lib/python2.7/site-packages/airflow/utils/helpers.py", line 436, in __getattr__
raise AttributeError
AttributeError
我错过了什么?
您 运行 遇到了一个已知问题,请参阅 AIRFLOW-1030. A fix has been merged (#2180),但遗憾的是尚未发布 airflow 版本。该修复已标记为下一个版本 (1.9.0),但在发布之前可能 weeks/months。您可以 运行 通过此更改创建气流分支,或将 HttpSensor 的更新版本添加为自定义运算符(插件)。