Uses Azure storage queue/table for a simple worker
Project description
Base project for the paw package. Very much a work in progress.
To create tasks:
# tasks.py
from paw import task
@task(description='Stupid simple example')
def task_one(print_me):
print(print_me)
return True
To start a worker:
# start_workers.py
from paw import MainPawWorker
import tasks # importing tasks from tasks.py in local project
workers = MainPawWorker(
azure_storage_name='storage account name',
azure_storage_private_key='storage account private key',
azure_queue_name='name of the queue',
azure_table_name='name of the table',
tasks_module=tasks,
workers=4
)
if __name__ == '__main__':
workers.start_workers()
To queue a task:
# queue_tasks.py
from paw import queue_task
queue_task(
task_name='task_one',
account_name='storage account name',
account_key='storage account private key',
queue_name='name of the queue',
args=['List', 'of', 'arguments'],
kwargs={'Key_word': 'arguments'}
)
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
mamba-paw-0.2.3.tar.gz
(7.4 kB
view hashes)
Built Distribution
Close
Hashes for mamba_paw-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cbcecd302ae270f01aa16b778aa0a3a2d97e8c6725b1f44cc411d61cdc9d88e |
|
MD5 | d815c921e691166e4db584c9688c420a |
|
BLAKE2b-256 | 7721fdd5d059181d1d058ea586ece0ccab4b42aa6550285af0bd559862e7834b |