Airflow HTTP Operator/Sensor 额外选项的文档?
Documentation for Airflow HTTP Operator/Sensor Extra Options?
我正在尝试阅读 Airflow 的 extra_options 设置,看看可以设置哪些属性(主要对 http 超时感兴趣)。我在任何地方都找不到这个特定参数的任何支持文档:https://airflow.readthedocs.io/en/1.9.0/code.html?highlight=requests#airflow.operators.SimpleHttpOperator。
有没有人以前用过这个并且能够提供帮助?
根据 source code (airflow.hooks.http_hook.HttpHook.run_and_check
) extra_options
使用这些参数:
response = session.send(
prepped_request,
stream=extra_options.get("stream", False),
verify=extra_options.get("verify", False),
proxies=extra_options.get("proxies", {}),
cert=extra_options.get("cert"),
timeout=extra_options.get("timeout"),
allow_redirects=extra_options.get("allow_redirects", True))
您可以在 requests library docs 阅读更多关于它们的信息:
stream
- (可选)是否立即下载响应内容。默认为假。
verify
–(可选)布尔值,在这种情况下它控制我们是否验证服务器的 TLS 证书,或字符串,在这种情况下它必须是要使用的 CA 包的路径。默认为真。
proxies
–(可选)字典映射协议或协议和主机名到代理的 URL。
cert
–(可选)如果为字符串,则为 ssl 客户端证书文件 (.pem) 的路径。 If Tuple, (‘cert’, ‘key’) pair.
timeout
(float or tuple) – (可选) 在放弃之前等待服务器发送数据的时间,作为一个浮点数,或者一个(连接超时,读取超时)元组。
allow_redirects
(bool) –(可选)默认设置为 True。
在 Airflow's source-code, you can easily determine what all things can be passed in SimpleHttpOperator
, or more specifically, in extra
field of Http
Connection
中跟踪此链接。我特此在 Airflow 的源代码中添加了我用来跟踪 extra_options
用法的调用轨迹
extra_options
are passed 到 run()
HttpHook
的方法
run()
方法 HttpHook
passes those extra_options
到 run_and_check()
方法
run_and_check()
方法 extracts variety of information 来自 extra_options
,如下面的源代码片段所示
try:
response = session.send(
prepped_request,
stream=extra_options.get("stream", False),
verify=extra_options.get("verify", False),
proxies=extra_options.get("proxies", {}),
cert=extra_options.get("cert"),
timeout=extra_options.get("timeout"),
allow_redirects=extra_options.get("allow_redirects", True))
if extra_options.get('check_response', True):
self.check_response(response)
return response
except requests.exceptions.ConnectionError as ex:
self.log.warning(str(ex) + ' Tenacity will retry to execute the operation')
raise ex
我正在尝试阅读 Airflow 的 extra_options 设置,看看可以设置哪些属性(主要对 http 超时感兴趣)。我在任何地方都找不到这个特定参数的任何支持文档:https://airflow.readthedocs.io/en/1.9.0/code.html?highlight=requests#airflow.operators.SimpleHttpOperator。
有没有人以前用过这个并且能够提供帮助?
根据 source code (airflow.hooks.http_hook.HttpHook.run_and_check
) extra_options
使用这些参数:
response = session.send( prepped_request, stream=extra_options.get("stream", False), verify=extra_options.get("verify", False), proxies=extra_options.get("proxies", {}), cert=extra_options.get("cert"), timeout=extra_options.get("timeout"), allow_redirects=extra_options.get("allow_redirects", True))
您可以在 requests library docs 阅读更多关于它们的信息:
stream
- (可选)是否立即下载响应内容。默认为假。verify
–(可选)布尔值,在这种情况下它控制我们是否验证服务器的 TLS 证书,或字符串,在这种情况下它必须是要使用的 CA 包的路径。默认为真。proxies
–(可选)字典映射协议或协议和主机名到代理的 URL。cert
–(可选)如果为字符串,则为 ssl 客户端证书文件 (.pem) 的路径。 If Tuple, (‘cert’, ‘key’) pair.timeout
(float or tuple) – (可选) 在放弃之前等待服务器发送数据的时间,作为一个浮点数,或者一个(连接超时,读取超时)元组。allow_redirects
(bool) –(可选)默认设置为 True。
在 Airflow's source-code, you can easily determine what all things can be passed in SimpleHttpOperator
, or more specifically, in extra
field of Http
Connection
中跟踪此链接。我特此在 Airflow 的源代码中添加了我用来跟踪 extra_options
extra_options
are passed 到run()
HttpHook
的方法
run()
方法HttpHook
passes thoseextra_options
到run_and_check()
方法run_and_check()
方法 extracts variety of information 来自extra_options
,如下面的源代码片段所示
try: response = session.send( prepped_request, stream=extra_options.get("stream", False), verify=extra_options.get("verify", False), proxies=extra_options.get("proxies", {}), cert=extra_options.get("cert"), timeout=extra_options.get("timeout"), allow_redirects=extra_options.get("allow_redirects", True)) if extra_options.get('check_response', True): self.check_response(response) return response except requests.exceptions.ConnectionError as ex: self.log.warning(str(ex) + ' Tenacity will retry to execute the operation') raise ex