Skip to main content

Blast off a list of tasks calling each tasks methods defined

Project description

Blaster

PR-Verification 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.

# Create a python virtual environment
python3 -m venv venv

# Activate the virtual environment
source venv/bin/activate

# Install blaster
(venv) 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'
    }
]

You also have the ability to set a timeout for each task. If the timeout is reached, the task will be exited.

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

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.

Project details


Download files

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

Source Distribution

blaster-0.6.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blaster-0.6.0-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file blaster-0.6.0.tar.gz.

File metadata

  • Download URL: blaster-0.6.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.1

File hashes

Hashes for blaster-0.6.0.tar.gz
Algorithm Hash digest
SHA256 78c365b6e056107e0aa29fddb91cb07ecbc66e2ed066c29d3a92e0e8364fe92b
MD5 d9d89da6c260ca215b26237effc1909b
BLAKE2b-256 7ca63df19807d71e2b644ca47a63efffc8197b2bdf72f78bc315711a349b014a

See more details on using hashes here.

File details

Details for the file blaster-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: blaster-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.1

File hashes

Hashes for blaster-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 594d6754c18f0514c62aa2498df7a489d9cb8fae7157c07a45b49e0a67bf9605
MD5 245241060d4ddef74b30106f673e6729
BLAKE2b-256 d426d74c5796e0c916b2496618cbc748a06525cb5883150ba9e3422449d4cda1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page