本文整理汇总了PHP中BatchJob::getQueueTime方法的典型用法代码示例。如果您正苦于以下问题:PHP BatchJob::getQueueTime方法的具体用法?PHP BatchJob::getQueueTime怎么用?PHP BatchJob::getQueueTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BatchJob
的用法示例。
在下文中一共展示了BatchJob::getQueueTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatedJob
/**
* @param BatchJob $dbBatchJob
* @param BatchJob $twinJob
* @return bool true if should continue to the next consumer
*/
public function updatedJob(BatchJob $dbBatchJob, BatchJob $twinJob = null)
{
try {
$jobType = $dbBatchJob->getJobType();
if (is_null($dbBatchJob->getQueueTime()) && $dbBatchJob->getStatus() != BatchJob::BATCHJOB_STATUS_PENDING) {
$dbBatchJob->setQueueTime(time());
$dbBatchJob->save();
}
if ($dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FINISHED) {
$dbBatchJob->setFinishTime(time());
$dbBatchJob->save();
}
if ($dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_RETRY) {
$dbBatchJob->setCheckAgainTimeout(time() + BatchJobPeer::getCheckAgainTimeout($jobType));
$dbBatchJob->setQueueTime(null);
$dbBatchJob->save();
}
if ($dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_ALMOST_DONE) {
$dbBatchJob->setCheckAgainTimeout(time() + BatchJobPeer::getCheckAgainTimeout($jobType));
$dbBatchJob->save();
}
if ($dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FAILED || $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FATAL) {
$dbBatchJob->setFinishTime(time());
$dbBatchJob->save();
// TODO - don't abort if it's bulk upload
kJobsManager::abortChildJobs($dbBatchJob);
}
switch ($jobType) {
case BatchJobType::IMPORT:
$dbBatchJob = $this->updatedImport($dbBatchJob, $dbBatchJob->getData(), $twinJob);
break;
case BatchJobType::EXTRACT_MEDIA:
$dbBatchJob = $this->updatedExtractMedia($dbBatchJob, $dbBatchJob->getData(), $twinJob);
break;
case BatchJobType::CONVERT:
$dbBatchJob = $this->updatedConvert($dbBatchJob, $dbBatchJob->getData(), $twinJob);
break;
case BatchJobType::POSTCONVERT:
$dbBatchJob = $this->updatedPostConvert($dbBatchJob, $dbBatchJob->getData(), $twinJob);
break;
case BatchJobType::BULKUPLOAD:
$dbBatchJob = $this->updatedBulkUpload($dbBatchJob, $dbBatchJob->getData(), $twinJob);
break;
case BatchJobType::CONVERT_PROFILE:
$dbBatchJob = $this->updatedConvertProfile($dbBatchJob, $dbBatchJob->getData(), $twinJob);
break;
case BatchJobType::BULKDOWNLOAD:
$dbBatchJob = $this->updatedBulkDownload($dbBatchJob, $dbBatchJob->getData(), $twinJob);
break;
case BatchJobType::PROVISION_PROVIDE:
$dbBatchJob = $this->updatedProvisionProvide($dbBatchJob, $dbBatchJob->getData(), $twinJob);
break;
case BatchJobType::PROVISION_DELETE:
$dbBatchJob = $this->updatedProvisionDelete($dbBatchJob, $dbBatchJob->getData(), $twinJob);
break;
case BatchJobType::CONVERT_COLLECTION:
$dbBatchJob = $this->updatedConvertCollection($dbBatchJob, $dbBatchJob->getData(), $twinJob);
break;
case BatchJobType::STORAGE_EXPORT:
$dbBatchJob = $this->updatedStorageExport($dbBatchJob, $dbBatchJob->getData(), $twinJob);
break;
case BatchJobType::STORAGE_DELETE:
$dbBatchJob = $this->updatedStorageDelete($dbBatchJob, $dbBatchJob->getData(), $twinJob);
break;
case BatchJobType::CAPTURE_THUMB:
$dbBatchJob = $this->updatedCaptureThumb($dbBatchJob, $dbBatchJob->getData(), $twinJob);
break;
default:
break;
}
if (!kConf::get("batch_ignore_duplication")) {
if ($dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FINISHED) {
$twinBatchJobs = $dbBatchJob->getTwinJobs();
// update status at all twin jobs
foreach ($twinBatchJobs as $twinBatchJob) {
if ($twinBatchJob->getStatus() != BatchJob::BATCHJOB_STATUS_FINISHED) {
kJobsManager::updateBatchJob($twinBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED);
}
}
}
}
if ($dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_RETRY && $dbBatchJob->getExecutionAttempts() >= BatchJobPeer::getMaxExecutionAttempts($jobType)) {
$dbBatchJob = kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_FAILED);
}
} catch (Exception $ex) {
self::alert($dbBatchJob, $ex);
KalturaLog::err("Error:" . $ex->getMessage());
}
return true;
}