Skip to content
This repository has been archived by the owner on Apr 18, 2018. It is now read-only.

Feature Request: retrieve job result from client #60

Open
dnephin opened this issue May 28, 2014 · 4 comments
Open

Feature Request: retrieve job result from client #60

dnephin opened this issue May 28, 2014 · 4 comments

Comments

@dnephin
Copy link

dnephin commented May 28, 2014

looking at http://pythonhosted.org/gearman/client.html#retrieving-job-status there does not appear to be any way to get the result of a background job. Waiting on status complete does not work because "complete" for a background job is when it receives it.

@niklasfemerstrand
Copy link

This may be helpful: #61 (comment)

@lidio601
Copy link

lidio601 commented Dec 3, 2014

Ok, if I understood well it says to send the GEARMAN_COMMAND_GET_STATUS command that answers with a message like this:
{'known': '1', 'numerator': '0', 'running': '1', 'denominator': '0', 'job_handle': 'H:lab-vm12:2266'}
But it only says if there is a job running, and after the worker has finished it turns to:
{'known': '0', 'numerator': '0', 'running': '0', 'denominator': '0', 'job_handle': 'H:lab-vm12:2266'}
So I cannot reach the resulting data.
Is there a command such as "GEARMAN_COMMAND_GET_WORKING_DATA" that I can send to the gearman server to obtain the job result?

@niklasfemerstrand
Copy link

@lidio601

The easiest way to handle this with background jobs is to use job_handle as a key in an alternative storage engine and then looking the data up there if known==0, running==0 and you're sure that the job has existed (use job_handle for that).

Unfortunately GET_STATUS responses will say known==0 && running==0 for both jobs that have finished and jobs that never existed in the first place. This goes beyond the use case of Gearman, use alternative storage in your application to keep track of it and populate the key there (job_handle) with the status msgs that you want to access later.

@niklasfemerstrand
Copy link

@lidio601

WORK_STATUS is only for non-background jobs. With background jobs you have to substitute Gearman's WORK_STATUS. I think the Gearman daemon even drops the status of background jobs entirely once executed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants