For some use cases it might be useful have access to the current job ID or
instance from within the job function itself. Or to store arbitrary data on
Accessing the “current” job
New in version 0.3.3.
Since job functions are regular Python functions, you have to ask RQ for the
current job ID, if any. To do this, you can use:
Storing arbitrary data on jobs
Improved in 0.8.0.
To add/update custom status information on this job, you have access to the
meta property, which allows you to store arbitrary pickleable data on the job
Time to live for job in queue
New in version 0.4.7.
A job has two TTLs, one for the job result and one for the job itself. This means that if you have
job that shouldn’t be executed after a certain amount of time, you can define a TTL as such:
If a job fails and raises an exception, the worker will put the job in a failed job queue.
On the Job instance, the is_failed property will be true. To fetch all failed jobs, scan
through the get_failed_queue() queue.