气流-一些端点的实验性API返回405s [英] Airflow - Experimental API returning 405s for some endpoints

查看:89
本文介绍了气流-一些端点的实验性API返回405s的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我的应用程序设置为使用Airflow的实验API。我正在使用 apache-airflow == 1.10.2

I'm trying to set up my application to use Airflow's Experimental API. I'm using apache-airflow==1.10.2.

使用开箱即用的配置(未启用身份验证),我可以使用 POST / api / experimental创建DAG运行/ dags /< DAG_ID> / dag_runs 端点。但是,当我尝试使用 GET / api / experimental / dags /< DAG_ID> / dag_runs 时,我会得到405s。

Using the config straight out of the box (no authentication enabled), I'm able to create DAG runs using the POST /api/experimental/dags/<DAG_ID>/dag_runs endpoint. However, when I try to use GET /api/experimental/dags/<DAG_ID>/dag_runs I get 405s.

当我发现GET端点是 www_rbac 文件夹的一部分,而不是 www 文件。为了验证我能够成功设置身份验证,我同时为api和网络服务器配置了身份验证。

I tried enabling authentication when I noticed that that GET endpoint is part of the www_rbac folder, but not part of the www file. To verify I was able to successfully setup authentication, I configured it for both the api and webserver.

[api]
authenticate = True
auth_backend = airflow.contrib.auth.backends.password_auth

网络服务器:

[webserver]
# additional config omitted for brevity
authenticate = True
auth_backend = airflow.contrib.auth.backends.password_auth

我使用气流cli创建了一个用户。然后,我能够使用这些凭据登录到Web服务器。问题是,当我尝试在API上使用相同的凭据进行身份验证时,仍然收到405s。

I created a user using the airflow cli. Then, I was able to log into the webserver using those credentials. Problem is when I try to use that same credentials authenticating on the API, I'm still getting 405s.

我正在使用的示例卷曲是:

Sample curl I'm using is:

curl -X GET \
  http://api_admin:password666@fakeHostName.com/api/experimental/dags/example_bash_operator/dag_runs \
  -H 'Cache-Control: no-cache'

(实际curl具有实际的用户名,密码和主机名。)

(Real curl has actual username, password, and hostname.)

响应正文为:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>405 Method Not Allowed</title>
<h1>Method Not Allowed</h1>
<p>The method is not allowed for the requested URL.</p>

起作用的POST请求的卷曲:

Curl for POST request that does work:

curl -X POST \
  http://api_admin:password666@fakeHostName.com/api/experimental/dags/example_bash_operator/dag_runs \
  -H 'Cache-Control: no-cache' \
  -d '{}'

好消息是,当我启用身份验证并从请求中忽略用户名和密码时,我得到401-未经授权。

Good news is that when I have authentication enabled and omit the username and password from the request, I get 401 - Unauthorized.

有人能够使用 GET dag_run端点工作吗?

Has anybody been able to use the GET dag_run endpoint to work?

推荐答案

1.10.2 中的一个错误,并已在 1.10.3 中修复,该错误将于本周发布。

That is a bug in 1.10.2 and has been fixed for 1.10.3 which will be released this week.

直到您可以使用rbac UI:

Till then you can use the rbac UI:

通过修改 airflow启用RBAC UI。 cfg 文件。

[webserver] 部分下,更改 rbac = False rbac = True

请注意,根据 https://airflow.apache.org/security.html吃掉用户?highlight = rbac#密码

这篇关于气流-一些端点的实验性API返回405s的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆