This has been discussed in #514, #282 and #88.
Using an explicit type check via `isinstance`, rather than duck typing, is typically considered unpythonic and breaks compatibility with mock objects such as FakeRedis. This patches removes the type check, and instead looks for a common method that should be present on the object as a hint on whether it's compatible or not.
syntax: assertEquals -> assertEqual, assertNotEquals -> assertNotEqual
usage: status of worker and job now will use get/set method instead of property method
For tracing job execution in a distributed system it is useful to tag log
entries with the worker id and job id. The current job is accessible
via get_current_job(), but that requires an extra redis connection. And
the current worker id (the worker id of the parent process) does not appear
to be available.
Rather than introducing an `rqworker` alternative or subclassing Worker, it
feels simple and efficient to make these contextual ids available as
environment variables. This should have no performance cost and no
API compatibility issues.
Some useful things to do with these values in the worker horse process:
+ include them in log messages
+ include them as 'x-' headers in HTTP requests made by workers
Current implementation is using the first job queue
to insert the dependent jobs. This makes RQ to ignore
the original queue where the jobs were enqueued.
With this change, we will use job origin attribute to
fetch the original queue, then insert the dependent
job to the fetched queue.
fixes issue #512