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_JOB_FREE(3)						     Gearmand						       GEARMAN_JOB_FREE(3)

NAME
gearman_job_free - Gearmand Documentation, http://gearman.info/ SYNOPSIS
#include <libgearman/gearman.h> gearman_job_st void gearman_job_free(gearman_job_st *job) gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size) gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size) gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator) gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size) gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size) gearman_return_t gearman_job_send_fail(gearman_job_st *job) const char *gearman_job_handle(const gearman_job_st *job) const char *gearman_job_function_name(const gearman_job_st *job) const char *gearman_job_unique(const gearman_job_st *job) const void *gearman_job_workload(const gearman_job_st *job) size_t gearman_job_workload_size(const gearman_job_st *job) void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size) Link with -lgearman DESCRIPTION
gearman_job_st are passed to worker functions to represent jobs that are being run by gearman_worker_work(). gearman_job_free() is used to free a job. This only needs to be done if a task was created with a preallocated structure. gearman_job_handle() returns the job handle(see gearman_job_handle_t for more information). gearman_job_function_name() return the name of the function that the job was set to execute against. gearman_job_unique() return the unique value that was used for gearman_job_st. returns the gearman_job_st workload. The size of it can be determined with gearman_job_workload_size(). gearman_job_take_workload() is the same as gearman_job_workload() with the exception that the result must be free(3) by the caller. RETURN VALUE
A value of gearman_return_t is returned. On success that value will be :c:type::GEARMAN_SUCCESS. Use gearman_strerror() to translate this value to a printable string. HOME
To find out more information please check: http://gearman.info/ SEE ALSO
gearmand(8) libgearman(3) AUTHOR
Data Differential http://www.datadifferential.com/ COPYRIGHT
2012, Data Differential, http://www.datadifferential.com/ 0.33 May 04, 2012 GEARMAN_JOB_FREE(3)
Man Page