ソースを参照

Merge branch 'master' of http://gogsb.soaringnova.com/sxwl_DL/datax-admin

Zhang Li 2 年 前
コミット
4de4fbc321
3 ファイル変更17 行追加15 行削除
  1. 2 2
      app/core/airflow/uri.py
  2. 14 12
      app/routers/files.py
  3. 1 1
      app/routers/run.py

+ 2 - 2
app/core/airflow/uri.py

@@ -35,7 +35,7 @@ def get_airflow_api_info():
         'content-type': 'application/json',
         'Authorization': f'basic {config.get("AIRFLOW", "api_token")}',
     }
-    host_in_header = config.get("AIRFLOW", "host_in_header", None)
+    host_in_header = config.get("AIRFLOW", "host_in_header", fallback=None)
     if host_in_header not in ['', None]:
         headers['Host'] = host_in_header
     return uri_prefix, headers
@@ -47,7 +47,7 @@ def call_airflow_api(method, uri, args_dict):
         'content-type': 'application/json',
         'Authorization': f'basic {config.get("AIRFLOW", "api_token")}',
     }
-    host_in_header = config.get("AIRFLOW", "host_in_header", None)
+    host_in_header = config.get("AIRFLOW", "host_in_header", fallback=None)
     if host_in_header not in ['', None]:
         headers['Host'] = host_in_header
     if method == 'post':

+ 14 - 12
app/routers/files.py

@@ -19,18 +19,6 @@ router = APIRouter(
     tags=["files-文件管理"],
 )
 
-@router.get("/{uri:path}",name="path-convertor")
-@sxtimeit
-def get_file(uri: str):
-    print("===",uri)
-    file = minio_client.get_file(uri)
-    code = 200
-    if len(file) == 0:
-        code = 404
-    response = StreamingResponse(io.BytesIO(file), status_code=code, media_type="application/octet-stream")
-    # 在请求头进行配置
-    response.headers["Content-Disposition"] = "attachment; filename="+uri
-    return response
 
 @router.delete("/dag")
 @web_try()
@@ -80,4 +68,18 @@ def get_dag_content(uri: str):
     return res
 
 
+# 此接口置于末尾,勿乱动,乱动者砍死
+@router.get("/{uri:path}",name="path-convertor")
+@sxtimeit
+def get_file(uri: str):
+    file = minio_client.get_file(uri)
+    code = 200
+    if len(file) == 0:
+        code = 404
+    response = StreamingResponse(io.BytesIO(file), status_code=code, media_type="application/octet-stream")
+    # 在请求头进行配置
+    response.headers["Content-Disposition"] = "attachment; filename="+uri
+    return response
+
+
 

+ 1 - 1
app/routers/run.py

@@ -161,7 +161,7 @@ def get_airflow_dagrun(job_id: int, af_run_id: str, db: Session = Depends(get_db
 @sxtimeit
 def get_airflow_dagrun_running_status(job_id: int, af_run_id: str, db: Session = Depends(get_db)):
     ret = call_airflow_api(method='get', uri=f'dags/dag_{job_id}/dagRuns/{af_run_id}', args_dict={})
-
+    ret = call_airflow_api(method='get', uri=f'dags/dag_{job_id}/dagRuns/{af_run_id}/taskInstances', args_dict={})
 
     # details = defaultdict(dict)