Select Git revision
Unity.RenderPipelines.Universal.Shaders.dll
-
Maximilian Blankschyn authoredMaximilian Blankschyn authored
README.md 3.73 KiB
pikatasks
pikatasks is a minimalistic library that allows you to run remote tasks easily. There's also a Django integration.
Requirements
pip install pika
- RabbitMQ as message broker
How-to
Import:
import pikatasks
Configure:
pikatasks.settings.BROKER_HOST = "localhost"
pikatasks.settings.BROKER_PORT = 5672 # change to 5671 if using SSL
pikatasks.settings.SSL_ENABLED = False # change to True in production :)
pikatasks.settings.VIRTUAL_HOST = "/" # rabbitmq default vhost
pikatasks.settings.USERNAME = "admin" # too lazy to change!
pikatasks.settings.PASSWORD = "qwertz" # easy to remember!
Or in Django settings:
PIKATASKS_BROKER_HOST = "localhost"
PIKATASKS_BROKER_PORT = 5672
...
Implement a task (server):
@pikatasks.task
def hello(something):
msg = "Hello, " + something + "!"
print(msg)
return msg
- The task name (and the queue name) will be the same as the function name. If you want to specify a custom task (and queue) name, use
@pikatasks.task("my_task_name")
. - Note: you will need a queue with exactly the same name as the task. See section: Queues and Permissions.
Start a server:
pikatasks.worker.start(tasks=[hello])
Run a task (client):
To simply run a task:
pikatasks.run("hello", something="World")
Run a task and get its result: