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


PHP BatchJob::setPriority方法代码示例

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


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

示例1: reconvertEntry

 private function reconvertEntry($entry_id, $conversion_profile_id, $job_priority)
 {
     $entry = entryPeer::retrieveByPK($entry_id);
     $this->error = "";
     if (!$entry) {
         $error = "Cannot reconvert entry [{$entry_id}]. Might be a deleted entry";
         return array($entry_id, null, null, $error);
     }
     $flavorAsset = assetPeer::retrieveOriginalByEntryId($entry_id);
     if (!$flavorAsset) {
         $flavorAsset = assetPeer::retrieveReadyWebByEntryId($entry_id);
         if (!$flavorAsset) {
             $flavorAssets = assetPeer::retrieveFlavorsByEntryId($entry_id);
             if (!$flavorAssets) {
                 $error = "Cannot find good enough flavor asset to re-convert from";
                 return array($entry_id, $entry, null, $error);
             }
             $flavorAsset = $flavorAssets[0];
             // choose the first one
         }
     }
     $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $filePath = kFileSyncUtils::getReadyLocalFilePathForKey($syncKey);
     if (!$filePath) {
         $error = "Cannot find a fileSync for the flavorAsset [" . $flavorAsset->getId() . "]";
         return array($entry_id, $entry, null, $error);
     }
     $dbBatchJob = new BatchJob();
     $dbBatchJob->setEntryId($entry_id);
     $dbBatchJob->setPartnerId($entry->getPartnerId());
     $dbBatchJob->setStatus(BatchJob::BATCHJOB_STATUS_PENDING);
     $dbBatchJob->setDc(kDataCenterMgr::getCurrentDcId());
     $dbBatchJob->setPriority($job_priority);
     $dbBatchJob->save();
     // creates a convert profile job
     $convertProfileData = new kConvertProfileJobData();
     $convertProfileData->setFlavorAssetId($flavorAsset->getId());
     $convertProfileData->setInputFileSyncLocalPath($filePath);
     kJobsManager::addJob($dbBatchJob, $convertProfileData, BatchJobType::CONVERT_PROFILE);
     // save again afget the addJob
     $dbBatchJob->save();
     return array($entry_id, $entry, $dbBatchJob, $error);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:43,代码来源:reconvertAction.class.php

示例2: createChild

 /**
  * @return BatchJob
  */
 public function createChild($same_root = true, $dc = null)
 {
     $child = new BatchJob();
     $child->setStatus(self::BATCHJOB_STATUS_PENDING);
     $child->setParentJobId($this->id);
     $child->setPartnerId($this->partner_id);
     $child->setEntryId($this->entry_id);
     $child->setPriority($this->priority);
     $child->setSubpId($this->subp_id);
     $child->setBulkJobId($this->bulk_job_id);
     // the condition is required in the special case of file_sync import jobs which are created on one dc but run from the other
     $child->setDc($dc === null ? $this->dc : $dc);
     if ($same_root && $this->root_job_id) {
         $child->setRootJobId($this->root_job_id);
     } else {
         $child->setRootJobId($this->id);
     }
     $child->save();
     return $child;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:23,代码来源:BatchJob.php

示例3: createChild

 /**
  * @return BatchJob
  */
 public function createChild($same_root = true)
 {
     $child = new BatchJob();
     $child->setStatus(self::BATCHJOB_STATUS_PENDING);
     $child->setParentJobId($this->id);
     $child->setPartnerId($this->partner_id);
     $child->setEntryId($this->entry_id);
     $child->setPriority($this->priority);
     $child->setSubpId($this->subp_id);
     $child->setBulkJobId($this->bulk_job_id);
     $child->setDc($this->dc);
     if ($same_root && $this->root_job_id) {
         $child->setRootJobId($this->root_job_id);
     } else {
         $child->setRootJobId($this->id);
     }
     $child->save();
     return $child;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:22,代码来源:BatchJob.php

示例4: addJob

 /**
  * @param BatchJob $batchJob
  * @param $data
  * @param int $type
  * @param int $subType
  * @return BatchJob
  */
 public static function addJob(BatchJob $batchJob, $data, $type, $subType = null)
 {
     $batchJob->setJobType($type);
     $batchJob->setJobSubType($subType);
     $batchJob->setData($data);
     if (!$batchJob->getParentJobId() && $batchJob->getEntryId()) {
         $currentJob = kBatchManager::getCurrentUpdatingJob();
         if ($currentJob && $currentJob->getEntryId() == $batchJob->getEntryId()) {
             $batchJob->setParentJobId($currentJob->getId());
             $batchJob->setBulkJobId($currentJob->getBulkJobId());
             $batchJob->setRootJobId($currentJob->getRootJobId());
         } else {
             $entry = entryPeer::retrieveByPKNoFilter($batchJob->getEntryId());
             // some jobs could be on deleted entry
             if ($entry) {
                 $batchJob->setRootJobId($entry->getBulkUploadId());
                 $batchJob->setBulkJobId($entry->getBulkUploadId());
             }
         }
     }
     // validate partner id
     $partnerId = $batchJob->getPartnerId();
     //		if(!$partnerId)
     //			throw new APIException(APIErrors::PARTNER_NOT_SET);
     // validate that partner exists
     $partner = PartnerPeer::retrieveByPK($partnerId);
     if (!$partner) {
         KalturaLog::err("Invalid partner id [{$partnerId}]");
         throw new APIException(APIErrors::INVALID_PARTNER_ID, $partnerId);
     }
     // set the priority and work group
     $batchJob->setPriority($partner->getPriority($batchJob->getBulkJobId()));
     $batchJob = self::updateBatchJob($batchJob, BatchJob::BATCHJOB_STATUS_PENDING);
     // look for identical jobs
     $twinJobs = BatchJobPeer::retrieveDuplicated($type, $data);
     $twinJob = null;
     if (count($twinJobs)) {
         foreach ($twinJobs as $currentTwinJob) {
             if ($currentTwinJob->getId() != $batchJob->getId()) {
                 $twinJob = reset($twinJobs);
             }
         }
     }
     if (!is_null($twinJob)) {
         $batchJob->setTwinJobId($twinJob->getId());
         if (!kConf::get("batch_ignore_duplication")) {
             $batchJob = self::updateBatchJob($batchJob, $twinJob->getStatus(), $twinJob);
         } else {
             $batchJob->save();
         }
     }
     return $batchJob;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:60,代码来源:kJobsManager.php


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