Git Product home page Git Product logo

dag_task_runner's Introduction

DAG Task Runner

A workflow runner script that accepts a DAG represented in JSON and outputs the letter of each vertex after the prescribed elapsed time defined by the edges.

My solution's code can be found in the scripts/dag_task_runner.py file.

Setup

This task runner was built on Python 3.11.4 using pyenv. To get set up, run:

pyenv install 3.11.4
pyenv local 3.11.4

Then download the project requirements by running:

pip install -r requirements.txt

Run program

To run the program, use the command below:

python scripts/dag_task_runner.py --dag_json data/dag_example.json

Once running, you'll see the printout of nodes and the time they were printed at, i.e.:

Node: A, Timestamp: 1709063290.889846
Node: B, Timestamp: 1709063295.8946261
Node: C, Timestamp: 1709063297.8947148
Node: E, Timestamp: 1709063297.8948328
Node: F, Timestamp: 1709063298.899458
Node: G, Timestamp: 1709063307.894979
Node: D, Timestamp: 1709063307.895016
...

Run tests

To run tests, simply run pytest in the root directory

Assumptions

The task runner assumes that the json files are in the following format and that they are true DAGs without cycles.

{
  "A": {
    "start": true,
    "edges": {
      "B": 5,
      "C": 7
    }
  },
  "B": {},
  "C": {},
}

dag_task_runner's People

Contributors

tiffyb avatar

Watchers

 avatar

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.