Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

gearman_job_status(3) [php man page]

GEARMAN_JOB_STATUS(3)							 1						     GEARMAN_JOB_STATUS(3)

GearmanClient::jobStatus - Get the status of a background job

       Object oriented style (method):

SYNOPSIS
public array GearmanClient::jobStatus (string $job_handle) DESCRIPTION
Gets the status for a background job given a job handle. The status information will specify whether the job is known, whether the job is currently running, and the percentage completion. PARAMETERS
o $job_handle - The job handle assigned by the Gearman server RETURN VALUES
An array containing status information for the job corresponding to the supplied job handle. The first array element is a boolean indicat- ing whether the job is even known, the second is a boolean indicating whether the job is still running, and the third and fourth elements correspond to the numerator and denominator of the fractional completion percentage, respectively. EXAMPLES
Example #1 Monitor the status of a long running background job <?php /* create our object */ $gmclient= new GearmanClient(); /* add the default server */ $gmclient->addServer(); /* run reverse client */ $job_handle = $gmclient->doBackground("reverse", "this is a test"); if ($gmclient->returnCode() != GEARMAN_SUCCESS) { echo "bad return code "; exit; } $done = false; do { sleep(3); $stat = $gmclient->jobStatus($job_handle); if (!$stat[0]) // the job is known so it is not done $done = true; echo "Running: " . ($stat[1] ? "true" : "false") . ", numerator: " . $stat[2] . ", denomintor: " . $stat[3] . " "; } while(!$done); echo "done! "; ?> The above example will output something similar to: Running: true, numerator: 3, denomintor: 14 Running: true, numerator: 6, denomintor: 14 Running: true, numerator: 9, denomintor: 14 Running: true, numerator: 12, denomintor: 14 Running: false, numerator: 0, denomintor: 0 done! SEE ALSO
GearmanClient::doStatus. PHP Documentation Group GEARMAN_JOB_STATUS(3)

Check Out this Related Man Page

GEARMAN_CLIENT_JOB_STATUS(3)					     Gearmand					      GEARMAN_CLIENT_JOB_STATUS(3)

NAME
gearman_client_job_status - Gearmand Documentation, http://gearman.info/ SYNOPSIS
#include <libgearman/gearman.h> gearman_return_t gearman_client_job_status(gearman_client_st *client, gearman_job_handle_t job_handle, bool *is_known, bool *is_running, uint32_t *numerator, uint32_t *denominator) Link with -lgearman DESCRIPTION
gearman_client_job_status() is used to find the status of a job via its gearman_job_handle_t. The arguments is_known, is_running, numera- tor, and denominator are all optional. Unless a Gearman worker has sent numerator/denominator via gearman_job_send_status(), those values will be zero. If the arguments is_known and is_running are ommitted then the function returns state data via gearman_return_t. RETURN VALUE
gearman_return_t will be returned. GEARMAN_SUCCESS will be returned upon success of the status being updated. If the arguments is_known and is_running are omitted then gearman_client_job_status() will return GEARMAN_JOB_EXISTS if the gearman_job_handle_t is known on the server, and GEARMAN_IN_PROGRESS if it is running. Knowing whether the job is running or not has higher precedence. gearman_continue() can be used for loops where you want to exit from the loop once the job has been completed. Warning For loops you should always check gearman_return_t with gearman_continue() even if you specifiy the argument is_known or is_running. A non-blocking IO call can return something other then GEARMAN_SUCCESS, in some cases you will want to treat those values not as errors. HOME
To find out more information please check: http://gearman.info/ See also gearmand(8) libgearman(3) gearman_client_st(3) gearman_job_handle_t(3) gearman_continue(3 AUTHOR
Data Differential http://www.datadifferential.com/ COPYRIGHT
2012, Data Differential, http://www.datadifferential.com/ 0.33 May 04, 2012 GEARMAN_CLIENT_JOB_STATUS(3)
Man Page