A distributer that helps to publish to a queue and process tasks from a queue
Project description
Overview
A queue manager based on rq and made for impulsare. It helps to : - add items to a queue - listen for a queue via a cli listener
See tests/static/ for examples of configuration.
Installation / Usage
To install use pip:
$ pip install --upgrade impulsare-distributer
Configuration
You need to create/add to your configuration file:
distributer:
# Required, redis address
host: 192.168.108.3
# Optional
port: 6379
# If a component needs to send data to a queue,
# define here where what is the queue's name (next one)
# used by impulsare-ruler to send to writer for example (ruler: {queue: writer})
testqueue:
queue: my_test_queue
Listener
This is a simple implementation of rq's worker. If you need to listen for a queue, no need to have a config file, run in cli:
$ queue-listener --host redis --queue my_test_queue
To be able to see the next example working, keep that opened in a separate window.
Queue Usage
To use the queue manager, and send jobs to be processed:
from impulsare_distributer import QueueManager
from mymodule import my_method
queue = QueueManager(config_file='tests/static/config_valid.yml', listener='testqueue')
queue.add(method=my_method, item='Hello World', job='test')
Development & Tests
$ pip install -r requirements.txt
$ pip install -r requirements-dev.txt
$ py.test --cov-report html --cov=impulsare_distributer tests/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for impulsare-distributer-1.0b3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b70de1af0c5de439711288b306158673f41d3c0c056a2c338cf65ee3230858f4 |
|
MD5 | 241ad59f1ad6fe3190bbc2a8d208b647 |
|
BLAKE2b-256 | 8aba7596e501b0d718f14746bcd8ec6301bd68d682ad6dfec5cc3bacd1f3bfc8 |