Skip to main content

A Dependency Graph Manager

Project description

A dependency graph analysis and processing tool written in Python..

codecov CircleCI PyPI version License Code style: black

Motivation

In a micro-services scenario, we usually have multiple services with various dependencies. This give us many advantages such as loose coupling, high maintainability & testability.

On the other hand, it brings on its own complexity. Services have multiple dependencies between each other, and it can quickly get difficult to manage.

Introduction

This tool allows us to scan a services’ spec, then determine in what order we can start them or stop them. In order to make things faster, we can start or stop them in parallel in some cases. Namely:

  • Services should be started in parallel if all their dependencies (if any) have already started.
  • Services should be stopped in parallel if all their dependents (if any) have already stopped.

Installation

From the PyPi repository

Use the package manager pip to install mograph.

pip install mograph

Manually from this repository

You can also clone this repository, install its dependencies and run the tool from there.

# Clone the repository
git clone git@github.com:molamk/mograph.git && cd mograph

# Install the project
python3 setup.py develop

Usage

The program works as follows:

  1. Load a yaml file describing some services with dependencies.
  2. Analyze the dependencies and build the graph.
  3. Print the starting (or stopping) sequence.

The yaml file looks something like this:

# services.yaml

mysql:
  deps: []
zookeeper:
  deps: []
kibana:
  deps:
    - mysql
fullhouse:
  deps:
    - kibana
    - zookeeper

To run the program, invoke it with either the start command or stop:

mograph start ./services.yaml

# or (depending on your configuration)

python3 -m mograph ./services.yaml

The output should be:

START SEQUENCE

0   : ['mysql', 'zookeeper']
1   : ['kibana']
2   : ['fullhouse']

And for the stop command, it should look like this:

STOP SEQUENCE

0   : ['fullhouse']
1   : ['zookeeper', 'kibana']
2   : ['mysql']

Tech Stack

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mograph, version 0.1.5
Filename, size File type Python version Upload date Hashes
Filename, size mograph-0.1.5-py3-none-any.whl (12.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size mograph-0.1.5.tar.gz (11.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page