7

How can I list all job handles on a Gearman job server? I'm trying to come up with a monitoring approach, where I can list all running threads, and poll their status.

Listing running jobs with 'status', and 'workers' (as described in http://gearman.org/index.php?id=protocol) lists functions and workers, but no job handles. Job handle is required in order to do GET_STATUS etc.

I'm trying to decouple job submitting from monitoring, and thus don't have the job handle that gets returned in the JOB_CREATED packet.

Jon Skarpeteig
  • 4,118
  • 7
  • 34
  • 53
  • Did you ever find a solution? I want to do essentially the same thing - submit background jobs, and let other separate processes monitor them/collect the results at some undetermined time in the future. Im considering submitting the handle id as a seperate job to facilitate this. – goat Jan 15 '13 at 21:01
  • Unfortunately, no - I'm stuck having to save the job handle from the job submit response – Jon Skarpeteig Jan 16 '13 at 10:04
  • Can you save the job Handle? You could also just create a db table called jobs ... add a row, get the id from the insert action and the start the background gearman job including the id in the data. In the gearman job it updates the db after every action. Then your monitor script just keeps checking the db ... you can even create a json service to monitor gearman jobs. I'm unsure as to if there is a native gearman method as I'm not really familiar with gearman, however this would be easier perhaps and also allows for it used by any platform regardless of support for gearman. – user1641165 Jul 22 '14 at 02:24

1 Answers1

1

There are plenty of gearman managers out there,

https://github.com/brianlmoon/GearmanManager is a entire package for managing and viewing.

or https://github.com/yugene/Gearman-Monitor

Or the one I use to monitor https://github.com/liorbk/php/blob/master/GearmanTelnet.php

Simon Bennett
  • 355
  • 3
  • 8
  • I think you're misunderstanding the question. All of the approaches you describe utilize the admin interface - which sends 'status' and 'workers' commands. The output of these does not supply what I'm looking for. – Jon Skarpeteig Oct 06 '12 at 20:44
  • 1
    Yeah sorry about that, I see the problem now. I did have a look at http://www.php.net/manual/en/class.gearmantask.php and at setting call back functions eg http://www.php.net/manual/en/gearmanclient.setstatuscallback.php but also don't think these answer your question. Sorry – Simon Bennett Oct 06 '12 at 23:30