本文整理汇总了PHP中BatchJobPeer::getCheckAgainTimeout方法的典型用法代码示例。如果您正苦于以下问题:PHP BatchJobPeer::getCheckAgainTimeout方法的具体用法?PHP BatchJobPeer::getCheckAgainTimeout怎么用?PHP BatchJobPeer::getCheckAgainTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BatchJobPeer
的用法示例。
在下文中一共展示了BatchJobPeer::getCheckAgainTimeout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: retryJob
/**
* @param int $jobId
* @param int $jobType
* @param bool $force - forces retry even if the job is locked.
* @return BatchJob
*/
public static function retryJob($jobId, $jobType, $force = false)
{
$dbBatchJob = BatchJobPeer::retrieveByPK($jobId);
if ($dbBatchJob->getJobType() != $jobType) {
throw new APIException(APIErrors::GET_EXCLUSIVE_JOB_WRONG_TYPE, $jobType, $dbBatchJob->getId());
}
$dbBatchJob->setAbort(false);
// if not currently locked
if (!$dbBatchJob->getSchedulerId()) {
$dbBatchJob->setExecutionAttempts(0);
$dbBatchJob = self::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_RETRY);
} elseif ($force) {
$dbBatchJob->setExecutionAttempts(0);
$dbBatchJob->setStatus(BatchJob::BATCHJOB_STATUS_RETRY);
$dbBatchJob->setStatus(BatchJob::BATCHJOB_STATUS_RETRY);
$dbBatchJob->setCheckAgainTimeout(time() + BatchJobPeer::getCheckAgainTimeout($jobType));
$dbBatchJob->save();
}
return $dbBatchJob;
}
示例2: 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;
}