The administrator protocol is what you usually used, but as you discovered, it will not list the actual tasks in the queue. We solved this by tracking the current tasks that we started at our application level and a callback in our working document telling the application when the task was completed. This allows us to perform cleaning, notification, etc., when the task is completed, and allows us to save this logic in the application, rather than the working one.
Regarding progress, it is best to use the built-in progressive mechanics in Gearman itself, in the PHP module you can call this using $job->sendStatus(percentDone, 100) . The client can then retrieve this value from the server using the task descriptor (which will be returned when the task starts). This will allow you to show the current progress to users in your interface.
As long as you have the currently running tasks in your application, you can use this to answer that similar tasks are already being performed, but you can also use joint merging / removing duplicates of the mechanism; see the $ unique parameter when adding a task.
The position in the current queue will not be available through Gearman, so you will have to do this in your application. I would stay away from the question of maintaining the Gearman layer for this information.
source share