본문 바로가기

카테고리 없음

[airflow] 버전 확인하고 airflow config설정 및 airflow rest API 호출 방법

 

Airflow API 를 통한 DAG list 확인

 

 

  • airflow 버전 확인 명령어
$ airflow version

airflow version

FutureWarning 가볍게 무시

 

 

  • auth_backends 옵션 확인
$ airflow config get-value api auth_backends
airflow.api.auth.backend.session
  • airflow.cfg 에서 auth_backends 옵션 수정
    • airflow.api.auth.backend.session -> auth_backends = airflow.api.auth.backend.basic_auth
[api]
auth_backends = airflow.api.auth.backend.basic_auth

 

 

  • openAPI script 내려받기

https://airflow.apache.org/docs/apache-airflow/stable/stable-rest-api-ref.html

 

  • 내려받은 script를 postman에 import
    • 다운로드 받은 v1.yaml파일을 import

postman import

 

  • import완료후 Airflow API script확인!

airflow script

> Airflow rest API 호출

{{baseUrl}} : /api/v1

  • GET version information 호출
    • CURL
curl --location 'http://localhost:8080/api/v1/version'
    • postman

get version

 

  • GET List DAGs 호출
    • CURL
curl -X GET --user "admin:admin" "http://localhost:8080/api/v1/dags"
    • postman
      • Authorization을 포함하여 호출필요

get List DAGs

 

 

 

>  Airflow Docs(API)
 

API — Airflow Documentation

 

airflow.apache.org