GithubHelp home page GithubHelp logo

dannyb48 / blaster Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ryankwilliams/blaster

0.0 1.0 0.0 53 KB

Blast off a list of tasks concurrently calling each tasks methods defined

License: GNU General Public License v3.0

Makefile 1.31% Python 98.69%

blaster's Introduction

Blaster

Build Status Coverage Status PyPI version

Blaster is a library that provides the ability to blast off a list of tasks and call each of their given methods concurrently. Blaster uses Python's built-in multiprocessing library to run the list of tasks.

Installation

Blaster can be easily installed with a one line command. It is available on pypi. It is recommended (as best practice) to create a virtual environment and install blaster. Please see the commands below to install blaster.

# install python virtualenv
$ pip install python-virtualenv

# create virtualenv
$ virtualenv blaster

# activate virtualenv
$ source blaster/bin/activate

# install blaster
$ (blaster) pip install blaster

Examples

At the root of blaster project, you will see a examples folder. Within this folder you will find simple examples on how you can use blaster to efficiently run many tasks.

Output

When blaster calls its blastoff method, on completion. It will return back to you a list of task results. Within each task dictionary it will have the original task data passed in along with a couple new keys. A status key which is an integer (0 or 1) to determine pass or fail. If a task failed, it would have a traceback key with the exception raised for helpful troubleshooting.

Terminology

Task

A task is a python dictionary that defines the task to be blasted off. A task must contain three keys name, task and methods. The name key just tells blaster what the task name is. The task key is a Python class reference. Finally the methods key is a list of methods to be run for the given task. You can then define any other key:value pairs that will be passed to the task given when an object is created for that class.

Below is an example task for building a contemporary house. You will see the task key has a value of the House class which contains all the methods defined. Blaster will create a house object (passing any extra data in this case style) and then call the methods defined.

[
    {
        'name': 'House #1',
        'task': House,
        'methods': [
            'foundation',
            'frame',
            'roof',
            'furnish',
            'enjoy'
        ],
        'style': 'contemporary'
    }
]

The nice feature with blaster is you can have multiple tasks but each one can call various methods within that task class. They do not all need to call the same methods! See the example below:

[
    {
        'name': 'House #1',
        'task': House,
        'methods': [
            'foundation',
            'frame',
            'roof',
            'furnish',
            'enjoy'
        ],
        'style': 'contemporary'
    },
    {
        'name': 'House #2',
        'task': House,
        'methods': [
            'foundation',
            'frame',
            'roof'
        ],
        'style': 'cape'
    }
]

Issues

For any issues that you may find while using blaster library. Please open a new issue or you can open pull request.

blaster's People

Contributors

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