GithubHelp home page GithubHelp logo

x0rzkov / airflow-rest-api-standalone Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oyamin/airflow-rest-api-standalone

0.0 0.0 0.0 5 KB

AirFlow Standalone REST API designed to allow you to manage your DAGs and Tasks via REST calls without the need of webserver

Python 100.00%

airflow-rest-api-standalone's Introduction

AirFlow Standalone REST API

I have created this API for a specific usecase, which required the ability to view DAGs and TASKs based on owners/teams. Also, the ability to perform all the actions via REST calls.

This is a standalone API, which does not require AirFlow webserver to run. Although, you do have to have AirFlow installed and have a setup via Celery. If you do not have Celery setup, you can remove the "WorkerView" class, which uses it to get details about all the workers and queues.

It is also configured to use gevent server, but you are free to change your configuration.

Prerequisites:

Python Libraries:

  • airflow==1.9+
  • celery
  • flask
  • flask_restful
  • flask_mail
  • sqlalchemy
  • pendulum

Enviromental Variables:

  • AIRFLOW_LOG_PATH
  • AIRFLOW__CELERY__BROKER_URL
  • AIRFLOW__CELERY__RESULT_BACKEND

Actions:

DAG:

Enable DAG: http://HOST_URL/airflow/api/v0.1/dagcontrol?dag_id=<dag_id>&action=enable

Disable DAG: http://HOST_URL/airflow/api/v0.1/dagcontrol?dag_id=<dag_id>&action=disable

TASK:

Kill TASK: http://HOST_URL/airflow/api/v0.1/taskcontrol?dag_id=<dag_id>&task_id=<task_id>&execution_date=<execution_date>&action=kill

Restart Aborted TASK: http://HOST_URL/airflow/api/v0.1/taskcontrol?dag_id=<dag_id>&task_id=<task_id>&execution_date=<execution_date>&action=restart&options=<upstream,downstream>

Mark Failed TASK Success: http://HOST_URL/airflow/api/v0.1/taskcontrol?dag_id=<dag_id>&task_id=<task_id>&execution_date=<execution_date>&action=mark_success&options=<upstream,downstream>

View DAG/TASK Stats in JSON:

DAG:

View Dags, filtered by owners: http://HOST_URL/airflow/api/v0.1/dagview?owners=

TASK:

View Running Tasks that are in running and success states, filtered by owners: http://HOST_URL/airflow/api/v0.1/taskview?owners=

Get Latest Log for specific run:

http://HOST_URL/airflow/api/v0.1/getlog?dag_id=<dag_id>&task_id=<task_id>&execution_date=<execution_date>

Celery Worker view, filtered by owners:

http://HOST_URL/airflow/api/v0.1/workerview?owners=

Long Running Tasks, filtered by owners:

http://HOST_URL/airflow/api/v0.1/longrunning?owners=

This is still a work in progress project and once it is more matured, will submit it as PR to the AirFlow official release.

airflow-rest-api-standalone's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.