Skip to content
Snippets Groups Projects
Select Git revision
  • 81f0d4d020f77e97ea0b9a9899cde3fec5695cf8
  • master default protected
  • hsh_v3.11
  • hsh_v3.10-r6
  • hsh_v3.10-r3
  • v3.9-r9
  • v3.10-r6
  • v3.9-r8
  • v3.10-r5
  • v3.9-r7
  • v3.10-r4
  • v3.9-r6
  • v3.10-r3
  • v3.9-r5
  • v3.10-r2
  • v3.9-r4
  • v3.10-r1
  • v3.9-r3
  • v3.9-r2
  • v3.9-r1
  • v3.8-r5
  • v3.8-r4
  • v3.8-r3
  • v3.8-r2
  • v3.8-r1
25 results

config.php

Blame
  • README.md 3.43 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 = "5671"
    pikatasks.settings.SSL_ENABLED = False
    pikatasks.settings.VIRTUAL_HOST = "foo"
    pikatasks.settings.USERNAME = "lancelot"
    pikatasks.settings.PASSWORD = "swalloWcoc0nut"
    

    Or in Django settings:

    PIKATASKS_BROKER_HOST = "localhost"
    PIKATASKS_BROKER_PORT = "5671"
    PIKATASKS_SSL_ENABLED = False
    PIKATASKS_VIRTUAL_HOST = "foo"
    PIKATASKS_USERNAME = "lancelot"
    PIKATASKS_PASSWORD = "swalloWcoc0nut"
    Implement a task (server):
    @pikatasks.task(name="hello")
    def hello(something):
        msg = "Hello, " + something + "!"
        print(msg)
        return msg

    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 reult: