mirror of https://github.com/peter4431/rq.git
export worker id and job id to env of work horse
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 workersmain
parent
1a089887c0
commit
bad054989d
Loading…
Reference in New Issue