Skip to content

us0627/DAG_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DAG Health Checker API

This is a FastAPI that performs asynchronous health checks over a Directed Acyclic Graph (DAG) of system components.

Problem:

Develop a Python web API that checks the health of a system that comprise of a multi-level correlated components in a Directed Acyclic Graph (DAG) form. See a sample graph below.

Solution:

  1. Create a Python API that takes a JSON file with system relationships that translates into a DAG
  2. Traverse through the graph in breadth-first search technique
  3. For each node, check for health of the component in an asynchronous way and store the result
  4. Display the health of the overall system in a table format 5) Optional - Display the graph in a picture format and highlight the failed components in red
  5. Check-in the code into GitHub and share the link when done

Structure:

Schwab/
│
├── main.py                  # Main FastAPI app
│
└── utils/
    ├── plot_util.py        # Plotly DAG rendering
    └── html_header.py      # HTML and health table generation - Visualization

Requirements:

Available in requirements.txt

pip install -r requirements.txt

How to Run?

  1. Start the FastAPI server
uvicorn app:app --reload
  1. View the instant demo at
http://127.0.0.1:8000/demo
  1. For Swagger UI
http://127.0.0.1:8000/docs
  1. On the UI, endpoint can be tested under
POST /check/html
  1. View the saved report locally generated as file
dag_report.html

open dag_report.html        # on macOS

Example run:

DAG Example Sample DAG Graph HTML Report Output Generated Report

Contact

ushakalyani.a@gmail.com

About

Coding exercise for Python Lead contracting position in Schwab

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published