本文整理匯總了PHP中BatchJob::setFinishTime方法的典型用法代碼示例。如果您正苦於以下問題:PHP BatchJob::setFinishTime方法的具體用法?PHP BatchJob::setFinishTime怎麽用?PHP BatchJob::setFinishTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BatchJob
的用法示例。
在下文中一共展示了BatchJob::setFinishTime方法的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;
}