A simple queue service using Amazon SQS and boto
Project description
pysqes
======
Simple queue service for python using SQS and boto.
Usage
======
In order to create a task you can use the SQSTask class to create
an instance that include a function decorator which can be sent
to the queue when you run the delay method that will be added
to the function. The delay function takes the parameters that will
be used by the worker when it actually executes the task.
```python
from boto.sqs.connection import SQSConnection
from pysqes.task import SQSTask
conn = SQSConnection('ACCESS_KEY', 'SECRETE_KEY')
task = SQSTask(conn)
@task.task
def add(a, b):
return a + b
# this will submit a job to the queue
add.delay(1, 3)
```
You can run the task by using the work method included in the
SQSWorker class, all you need to do is create a worker instance.
```python
from boto.sqs.connection import SQSConnection
from pysqes.worker import SQSWorker
conn = SQSConnection('ACCESS_KEY', 'SECRETE_KEY')
worker = SQSWorker(conn)
worker.work()
```
Running the tests
======
If you are using python 2.7 you can run the unit tests by
using the new discover runner included in the unittest module:
```shell
python -m unittest discover -s tests
```
else you can just run each unit test individually.
======
Simple queue service for python using SQS and boto.
Usage
======
In order to create a task you can use the SQSTask class to create
an instance that include a function decorator which can be sent
to the queue when you run the delay method that will be added
to the function. The delay function takes the parameters that will
be used by the worker when it actually executes the task.
```python
from boto.sqs.connection import SQSConnection
from pysqes.task import SQSTask
conn = SQSConnection('ACCESS_KEY', 'SECRETE_KEY')
task = SQSTask(conn)
@task.task
def add(a, b):
return a + b
# this will submit a job to the queue
add.delay(1, 3)
```
You can run the task by using the work method included in the
SQSWorker class, all you need to do is create a worker instance.
```python
from boto.sqs.connection import SQSConnection
from pysqes.worker import SQSWorker
conn = SQSConnection('ACCESS_KEY', 'SECRETE_KEY')
worker = SQSWorker(conn)
worker.work()
```
Running the tests
======
If you are using python 2.7 you can run the unit tests by
using the new discover runner included in the unittest module:
```shell
python -m unittest discover -s tests
```
else you can just run each unit test individually.
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
pysqes-0.1.1.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for pysqes-0.1.1.macosx-10.8-intel.exe
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d25844f289084217ecc0cf40a1608b98ed6b6a5c6f459bb90f0746a53a4e8ed |
|
MD5 | ef0e8cb1887a5ca88030ce7b44906e59 |
|
BLAKE2b-256 | 42b42dcb005bd553962b4ad282e03ddb7ff9fb488672449211f722f6067de840 |