![]() ![]() This is nothing more than a proxy object that can be used to check the outcomeįor this purpose, it has a convenience result accessor property, that When jobs get enqueued, the queue.enqueue() method returns a Job instance. To serialize the jobs, so it’s a Python-only system. Lastly, it does not speak a portable protocol, since it depends on pickle May consider this an awesome advantage or a handicap, depending on the problem RQ does not use an advanced broker to do the message routing for you. As soon as you enqueue a job to a queue thatĭoes not exist yet, it is created on the fly. Specify any channels, exchanges, routing rules, or whatnot. With RQ, you don’t have to set up any queues upfront, and you don’t have to It can be recreated by enqueueing jobs to it. delete ( delete_jobs = True ) # Passing in `True` will remove all jobs in the queue # Emptying a queue, this will delete all jobs in this queue fetch_job ( 'my_id' ) # Returns job having ID "my_id" jobs # Gets a list of enqueued job instances job_ids # Gets a list of job IDs from the queue # Note: Only queued jobs are counted, not including deferred ones Working with Queuesīesides enqueuing jobs, Queues have a few useful methods:įrom rq import Queue from redis import Redis redis_conn = Redis () q = Queue ( connection = redis_conn ) # Getting the number of jobs in the queue If the value starts with : or % or includes = it would be recognised as something else. Warning: Do not use plain text without keyword if you do not know what the value is. rq enqueue path.to.func -> queue.enqueue(path.to.func, key=json.loads(open('path/to/file.json', 'r').read())).rq enqueue path.to.func -> queue.enqueue(path.to.func, json.loads(open('path/to/file.json', 'r').read())).rq enqueue path.to.func -> queue.enqueue(path.to.func, key=open('path/to/file', 'r').read()).rq enqueue path.to.func -> queue.enqueue(path.to.func, open('path/to/file', 'r').read()).rq enqueue path.to.func abc=def -> queue.enqueue(path.to.func, abc='def').rq enqueue path.to.func abc -> queue.enqueue(path.to.func, 'abc').If the first character of is the subsequent path will be read. Where is the keyword and is the value which is parsed with the corresponding Because it is technicallyĪn import _name_ = '_main_' will not work. Execute a python file: dot-separated pathname of the file.Execute a function: dot-separated string of package, module and function (Just like.-schedule-at Schedule job to be enqueued at a certain time formatted.-schedule-in Delay until the function is enqueued (e.g.-retry-interval Interval between retries in seconds.-at-front Will place the job at the front of the queue, instead.-depends-on Specifies another job id that must complete before this.-description Additional description of the job.-failure-ttl Specifies how long failed jobs are kept.-ttl Specifies the maximum queued time of the job before.-result-ttl Specifies how long successful jobs and their results.-timeout Specifies the maximum runtime of the job before it is. ![]() To your job and not to RQ’s enqueue function, this is what you do: In the last case, if you want to pass description and ttl keyword arguments This is useful if your function happens to haveĬonflicting argument names with RQ, for example description or ttl. args and kwargs: use these to explicitly pass arguments and keyword to the.on_stopped allows you to run a function after a job is stopped. ![]() on_failure allows you to run a function after a job fails.on_success allows you to run a function after a job completes successfully.description to add additional description to enqueued jobs.at_front will place the job at the front of the queue, instead of the.job_id allows you to manually specify this job’s job_id.depends_on specifies another job (or list of jobs) that must complete before this.failure_ttl specifies how long failed jobs are kept (defaults to 1 year).This argument defaults to None (infinite TTL). ttl specifies the maximum queued time (in seconds) of the job before it’s discarded.Expired jobs will be automatically deleted. result_ttl specifies how long (in seconds) successful jobs and their.Furthermore, it can be a string with specify unit including hour, minute, second(e.g. ![]() Its default unit is second and it can be an integer or a string representing an integer(e.g.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |