Query: gearman_job_status
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
GEARMAN_JOB_STATUS(3) 1 GEARMAN_JOB_STATUS(3) GearmanClient::jobStatus - Get the status of a background job Object oriented style (method):SYNOPSISpublic array GearmanClient::jobStatus (string $job_handle)DESCRIPTIONGets 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.PARAMETERSo $job_handle - The job handle assigned by the Gearman serverRETURN VALUESAn 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.EXAMPLESExample #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 ALSOGearmanClient::doStatus. PHP Documentation Group GEARMAN_JOB_STATUS(3)
Related Man Pages |
---|
gearman_job_free_all(3) - debian |
gearman_job_function_name(3) - debian |
gearman_job_handle(3) - debian |
gearman_job_unique(3) - debian |
gearmanclient(3) - php |
Similar Topics in the Unix Linux Community |
---|
How to know the status of process running in background |
Searching set of string from Live Running Logs |
Cron job and tty |
Check for DB status and startup DB |
Cron doesn't run job in background |