Git Product home page Git Product logo

shuriken's Introduction

Shuriken Build Status

Shuriken is a simple distributed task executor that can horizontally scalable. It uses RabbitMQ as task queue. The workers will take the task and then execute. You can track results of the task via status and output endpoints.

Requirements

  • Vagrant - 1.x.x or 2.x.x

Run

vagrant up
vagrant ssh
cd /vagrant # After that, you are ready to go.
make queue # Run a Rabbitmq if you don't have. You can edit endpoints in config file if you have.
make service # Run this in one terminal
make worker # Run this in another terminal. You can execute multiple times on one node or on different nodes.

Run With Docker

# Master
docker run -d -p 5000:5000 boranx/shuriken-master -e BROKER_HOST=172.17.0.1 # Pass broker URL

# Workers
docker run -d boranx/shuriken-worker -e BROKER_HOST=172.17.0.1 # Pass broker URL
docker run -d boranx/shuriken-worker -e BROKER_HOST=172.17.0.1 # Pass broker URL
.
.
.
# N times on different nodes

Example Requests

API Default port : 5000

POST /command/execute Payload :

{
    "command":"echo 'foo'"
}

Or if you want to broadcast to all workers,

{
    "command":"sudo apt-get update"
}

And the response should be like :

{
    "task_id": "45e972c3-5227-4982-bed9-f475d925825e"
}

And you can request the status of a task.

GET /command/status/45e972c3-5227-4982-bed9-f475d925825e

And the response should be like :

{
    "Status": "SUCCESS",
    "description": "Task run successfully"
}

GET /command/output/45e972c3-5227-4982-bed9-f475d925825e

And the response should be like : (This is also a json now)

{
"output": "foo\n",
"hostname": "celery@vagrant",
"returncode": 0,
"description": "Task run successfully"
}

Swagger

You can track endpoints via swagger

http://localhost:5000/apidocs

ShurikenServiceUI

Development

vagrant up # Which will create a VM using Virtualbox, imports current folder as shared folder, install the dependencies from scratch.
vagrant ssh
cd /vagrant # After that, you are ready to go.
make ...

Tests

make test

shuriken's People

Contributors

boranx avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  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.