一个Airflow2.1.3 experimental api 请求异常问题

问题

请求:

curl -X POST \
http://localhost:7080/api/experimental/dags/<DAG_ID>/dag_runs \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{"conf":"{\"key\":\"value\"}"}'

报错:
{“error”:“Dag Run conf must be a dictionary object, other types are not supported”}

解决方法

修改源码

/home/airflow/anaconda3/lib/python3.8/site-packages/airflow/www/api/experimental/endpoints.py

91行开始,注释掉后面的判断即可,只需修改WebUI机器所在源码即可,其他节点可不用。

conf = None
    if 'conf' in data:
        conf = data['conf']
        #if not isinstance(conf, dict):
            #error_message = 'Dag Run conf must be a dictionary object, other types are not supported'
            #log.error(error_message)
            #response = jsonify({'error': error_message})
            #response.status_code = 400
            #return response

再次请求成功。

The End.

你可能感兴趣的:(python)