本文整理汇总了PHP中GearmanClient::jobStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP GearmanClient::jobStatus方法的具体用法?PHP GearmanClient::jobStatus怎么用?PHP GearmanClient::jobStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GearmanClient
的用法示例。
在下文中一共展示了GearmanClient::jobStatus方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: client
public function client()
{
$config = $this->config->item('base_config');
$host = $config['gearman']['host'];
$port = $config['gearman']['port'];
$client = new GearmanClient();
$client->addServer($host, $port);
$data = array('method' => 'get', 'url' => 'http://master.500mi.com/main/gearman/test', 'params' => array('wd' => '哈哈'));
$job_handle = $client->doBackground("send_request", json_encode($data));
if ($client->returnCode() != GEARMAN_SUCCESS) {
echo "bad return code\n";
exit;
}
$done = false;
do {
sleep(1);
$stat = $client->jobStatus($job_handle);
var_dump($stat);
if (!$stat[0]) {
$done = true;
}
echo "Running: " . ($stat[1] ? "true" : "false") . ", numerator: " . $stat[2] . ", denomintor: " . $stat[3] . "\n";
} while (!$done);
echo "done!\n";
}
示例2: GearmanClient
<?php
$client = new GearmanClient();
$client->addServer();
$job_handle = $client->doBackground("setup", 1);
var_dump($job_handle);
if ($client->returnCode() != GEARMAN_SUCCESS) {
echo "bad return code\n";
exit;
}
$done = false;
do {
sleep(3);
$stat = $client->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] . "\n";
} while (!$done);
echo "done!\n";
示例3: jobStatus
public function jobStatus($jobHanle)
{
return $this->_gearmanClient->jobStatus($jobHanle);
}
示例4: GearmanClient
<?php
$c = new GearmanClient();
$c->addServer('127.0.0.1');
$h = $c->doBackground('abc', 'abc');
//while(true)
var_dump($c->jobStatus($h));
//exit;
$w = new GearmanWorker();
$w->addServer('127.0.0.1');
var_dump($w->addFunction('abc', function () {
echo "123\n";
}, $ctx, 0));
while (true) {
$w->work();
}
示例5: jobStatus
/**
*
* @param handle $job_handle
* @return array
*/
public function jobStatus($job_handle)
{
return $this->gearmanClient->jobStatus($job_handle);
}
示例6: status
/**
* Returns the Gearman job status for any task or all tasks
*
* // Get the status of all tasks
* $statuses = $request
*
* @param GearmanTask task to return status for (optional)
* @return array
*/
public function status(GearmanTask $task = NULL)
{
if ($task !== NULL) {
return $this->_gearman_client->jobStatus($task->jobHandle());
} else {
$status = array();
foreach ($this->_task_handles as $uuid => $task) {
$status[$uuid] = $this->_gearman_client->jobStatus($task->jobHandle());
}
return $status;
}
}