Adding Jobs to MRQ from code 0 comments

The MRQ documention is vague on how to add jobs to a queue from code. Particularly if you want to do it from a remote system (one the worker is not running on). 

The following snippet does the job

from mrq.job import queue_job, context

context.setup_context(
extra={
'redis': 'redis://my_redis_url',
'mongodb_jobs': 'mongodb://my_mongo_url',
})

queue_job("tasks.MyTask", {'arg1': "myarg"}, queue="myqueue")

Comments

There are currently no comments

New Comment

required

required (not published)

optional