from rq import Worker, Queue, Connection
from rq.job import Job

from cloudly.cache import redis
from cloudly.memoized import Memoized

def enqueue(function, *args):
    return _get_queue().enqueue(function, *args)


def fetch_job(job_id):
    return Job.fetch(job_id, redis)


@Memoized
def _get_queue():
    return Queue(connection=redis)


if __name__ == '__main__':
    listen = ['high', 'default', 'low']
    with Connection(redis):
        worker = Worker(map(Queue, listen))
        worker.work()

@@ -340,34 +340,71 @@
 )%0A%0A%0A
-if __name__ == '__main__':
+def work(setup_fct=None):%0A    if setup_fct:%0A        setup_fct()
 %0A   
@@ -534,8 +534,48 @@
 .work()%0A
+%0A%0Aif __name__ == '__main__':%0A    work()%0A

Add `work` function to rqworker.