当前位置: 首页>>代码示例>>PHP>>正文


PHP BatchJobPeer::getMaxExecutionAttempts方法代码示例

本文整理汇总了PHP中BatchJobPeer::getMaxExecutionAttempts方法的典型用法代码示例。如果您正苦于以下问题:PHP BatchJobPeer::getMaxExecutionAttempts方法的具体用法?PHP BatchJobPeer::getMaxExecutionAttempts怎么用?PHP BatchJobPeer::getMaxExecutionAttempts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BatchJobPeer的用法示例。


在下文中一共展示了BatchJobPeer::getMaxExecutionAttempts方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: freeExclusiveJobAction

 /**
  * batch freeExclusiveJobAction action allows to get a generic BatchJob 
  * 
  * @action freeExclusiveJob
  * @param int $id The id of the job
  * @param KalturaExclusiveLockKey $lockKey The unique lock key from the batch-process. Is used for the locking mechanism
  * @param KalturaBatchJobType $jobType The type of the job  
  * @param bool $resetExecutionAttempts Resets the job execution attampts to zero  
  * @return KalturaFreeJobResponse 
  */
 function freeExclusiveJobAction($id, KalturaExclusiveLockKey $lockKey, $jobType, $resetExecutionAttempts = false)
 {
     $jobType = kPluginableEnumsManager::apiToCore('BatchJobType', $jobType);
     $job = BatchJobPeer::retrieveByPK($id);
     // verifies that the job is of the right type
     if ($job->getJobType() != $jobType) {
         throw new KalturaAPIException(APIErrors::UPDATE_EXCLUSIVE_JOB_WRONG_TYPE, $id, $lockKey, null);
     }
     $job = kBatchManager::freeExclusiveBatchJob($id, $lockKey->toObject(), $resetExecutionAttempts);
     $batchJob = new KalturaBatchJob();
     // start from blank
     $batchJob->fromObject($job);
     // gets queues length
     $c = new Criteria();
     $c->add(BatchJobPeer::STATUS, array(KalturaBatchJobStatus::PENDING, KalturaBatchJobStatus::RETRY, KalturaBatchJobStatus::ALMOST_DONE), Criteria::IN);
     $c->add(BatchJobPeer::JOB_TYPE, $jobType);
     $queueSize = BatchJobPeer::doCount($c, false, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
     if (!$queueSize) {
         // gets queues length
         $c = new Criteria();
         $c->add(BatchJobPeer::BATCH_INDEX, null, Criteria::ISNOTNULL);
         $c->add(BatchJobPeer::PROCESSOR_EXPIRATION, time(), Criteria::GREATER_THAN);
         $c->add(BatchJobPeer::EXECUTION_ATTEMPTS, BatchJobPeer::getMaxExecutionAttempts($jobType), Criteria::LESS_THAN);
         $c->add(BatchJobPeer::JOB_TYPE, $jobType);
         $queueSize = BatchJobPeer::doCount($c, false, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
     }
     $response = new KalturaFreeJobResponse();
     $response->job = $batchJob;
     $response->jobType = $jobType;
     $response->queueSize = $queueSize;
     return $response;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:42,代码来源:BatchService.php

示例2: getExpiredJobs

 public static function getExpiredJobs()
 {
     $jobTypes = kPluginableEnumsManager::coreValues('BatchJobType');
     $c = new Criteria();
     $c->add(BatchJobPeer::STATUS, BatchJob::BATCHJOB_STATUS_FATAL, Criteria::NOT_EQUAL);
     $c->add(BatchJobPeer::DC, kDataCenterMgr::getCurrentDcId());
     // each DC should clean its own jobs
     //		$c->add(BatchJobPeer::PROCESSOR_EXPIRATION, time(), Criteria::LESS_THAN);
     //		$c->add(BatchJobPeer::SCHEDULER_ID, 0, Criteria::GREATER_THAN);
     //		$c->add(BatchJobPeer::WORKER_ID, 0, Criteria::GREATER_THAN);
     $jobs = array();
     foreach ($jobTypes as $jobType) {
         $typedCrit = clone $c;
         $typedCrit->add(BatchJobPeer::EXECUTION_ATTEMPTS, BatchJobPeer::getMaxExecutionAttempts($jobType), Criteria::GREATER_THAN);
         $typedCrit->add(BatchJobPeer::JOB_TYPE, $jobType);
         $typedJobs = BatchJobPeer::doSelect($typedCrit, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
         foreach ($typedJobs as $typedJob) {
             $jobs[] = $typedJob;
         }
     }
     return $jobs;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:22,代码来源:kBatchExclusiveLock.class.php

示例3: isRetriesExceeded

 public function isRetriesExceeded()
 {
     return $this->execution_attempts >= BatchJobPeer::getMaxExecutionAttempts($this->job_type);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:4,代码来源:BatchJob.php

示例4: 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;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:95,代码来源:kFlowManager.php


注:本文中的BatchJobPeer::getMaxExecutionAttempts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。