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 jobs.
All job information is stored in Redis. You can inspect a job and its attributes
Some interesting job attributes include:
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:
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
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