I need to get status of Gearman jobs by these uniq id, not by open handlers, as desribed every place I seen
Is it possible? using in python-gearman v. 2...
Thanks for assistance!
I need to get status of Gearman jobs by these uniq id, not by open handlers, as desribed every place I seen
Is it possible? using in python-gearman v. 2...
Thanks for assistance!
Copyright © 2021 Jogjafile Inc.
Had to dig quite a bit to solve this issue, as it's not exposed in a friendly manner in the python-gearman-API. You can however solve it by creating appropriate instances of the
GearmanJob
andGearmanJobRequest
yourself.Here's a small example of how you can do this:
You want to keep track of which server got to handle the job (if you have more than one Gearman server handling tasks), and the handle of the task. The connection information is available through
result.job.connection
(.gearman_host
and.gearman_port
), while the handle is available throughresult.job.handle
.To check the status of a currently running job you create a
GearmanClient
, but only supply the server you want to query for the current state:Hopefully that helps!