當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BatchJob::setDc方法代碼示例

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


在下文中一共展示了BatchJob::setDc方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addFileSyncImportJob

 /**
  * @param string $entryId
  * @param FileSync $object
  * @param int $fileSyncId
  * @param string $sourceFileUrl
  * @return BatchJob
  */
 public static function addFileSyncImportJob($entryId, FileSync $fileSync, $sourceFileUrl, BatchJob $parentJob = null, $fileSize = null)
 {
     $partnerId = $fileSync->getPartnerId();
     $fileSyncId = $fileSync->getId();
     $dc = $fileSync->getDc();
     KalturaLog::log(__METHOD__ . " entryId[{$entryId}], partnerId[{$partnerId}], fileSyncId[{$fileSyncId}], sourceFileUrl[{$sourceFileUrl}]");
     $fileSyncImportData = new kFileSyncImportJobData();
     $fileSyncImportData->setSourceUrl($sourceFileUrl);
     $fileSyncImportData->setFilesyncId($fileSyncId);
     $fileSyncImportData->setFileSize($fileSize);
     // tmpFilePath and destFilePath will be set later during get exlusive call on the target data center
     $batchJob = null;
     if ($parentJob) {
         $batchJob = $parentJob->createChild(BatchJobType::FILESYNC_IMPORT, null, true, $dc);
     } else {
         $batchJob = new BatchJob();
         $batchJob->setDc($dc);
         $batchJob->setEntryId($entryId);
         $batchJob->setPartnerId($partnerId);
     }
     $batchJob->setObjectId($fileSyncId);
     $batchJob->setObjectType(BatchJobObjectType::FILE_SYNC);
     //In case file sync is of type data and holds flavor asset than we need to check if its the source asset that is being synced and raise it sync priority
     if ($fileSync->getObjectType() == FileSyncObjectType::FLAVOR_ASSET && $fileSync->getObjectSubType() == entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA && $fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_FILE) {
         $assetdb = assetPeer::retrieveById($fileSync->getObjectId());
         if ($assetdb) {
             $isSourceAsset = $assetdb->getIsOriginal();
             if ($isSourceAsset) {
                 $fileSyncImportData->setIsSourceAsset(true);
             }
         }
     }
     KalturaLog::log("Creating Filesync Import job, with file sync id: {$fileSyncId} size: {$fileSize}");
     return kJobsManager::addJob($batchJob, $fileSyncImportData, BatchJobType::FILESYNC_IMPORT);
 }
開發者ID:AdiTal,項目名稱:server,代碼行數:42,代碼來源:kMultiCentersManager.php

示例2: 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 ); Not supported anymore
     $dbBatchJob->setObjectId($entry_id);
     $dbBatchJob->setObjectType(BatchJobObjectType::ENTRY);
     $dbBatchJob->setJobType(BatchJobType::CONVERT_PROFILE);
     $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:DBezemer,項目名稱:server,代碼行數:46,代碼來源:reconvertAction.class.php

示例3: addFileSyncImportJob

 /**
  * @param string $entryId
  * @param FileSync $object
  * @param int $fileSyncId
  * @param string $sourceFileUrl
  * @return BatchJob
  */
 public static function addFileSyncImportJob($entryId, FileSync $fileSync, $sourceFileUrl, BatchJob $parentJob = null, $fileSize = null)
 {
     $partnerId = $fileSync->getPartnerId();
     $fileSyncId = $fileSync->getId();
     $dc = $fileSync->getDc();
     KalturaLog::log(__METHOD__ . " entryId[{$entryId}], partnerId[{$partnerId}], fileSyncId[{$fileSyncId}], sourceFileUrl[{$sourceFileUrl}]");
     $fileSyncImportData = new kFileSyncImportJobData();
     $fileSyncImportData->setSourceUrl($sourceFileUrl);
     $fileSyncImportData->setFilesyncId($fileSyncId);
     // tmpFilePath and destFilePath will be set later during get exlusive call on the target data center
     $batchJob = null;
     if ($parentJob) {
         $batchJob = $parentJob->createChild(true, $dc);
     } else {
         $batchJob = new BatchJob();
         $batchJob->setDc($dc);
         $batchJob->setEntryId($entryId);
         $batchJob->setPartnerId($partnerId);
     }
     $batchJob->setFileSize($fileSize);
     KalturaLog::log("Creating Filesync Import job, with file sync id: {$fileSyncId} size: {$fileSize}");
     return kJobsManager::addJob($batchJob, $fileSyncImportData, BatchJobType::FILESYNC_IMPORT);
 }
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:30,代碼來源:kMultiCentersManager.php

示例4: createChild

 /**
  * The type and the sub-type are constant in the batch job, therefore they must be proveided
  * when a new batch job is generated.
  * @return BatchJob
  */
 public function createChild($type, $subType = null, $same_root = true, $dc = null)
 {
     $child = new BatchJob();
     $child->setJobType($type);
     if ($subType !== null) {
         $child->setJobSubType($subType);
     }
     $child->setParentJobId($this->id);
     $child->setPartnerId($this->partner_id);
     $child->setEntryId($this->entry_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);
     }
     return $child;
 }
開發者ID:DBezemer,項目名稱:server,代碼行數:25,代碼來源:BatchJob.php

示例5: addSubmitUpdateJob

 /**
  * @param EntryDistribution $entryDistribution
  * @param DistributionProfile $distributionProfile
  * @return BatchJob
  */
 protected static function addSubmitUpdateJob(EntryDistribution $entryDistribution, DistributionProfile $distributionProfile)
 {
     if ($entryDistribution->getStatus() == EntryDistributionStatus::UPDATING) {
         return null;
     }
     $entryDistribution->setStatus(EntryDistributionStatus::UPDATING);
     $entryDistribution->setDirtyStatus(null);
     if (!$entryDistribution->save()) {
         KalturaLog::err("Unable to save entry distribution [" . $entryDistribution->getId() . "] status");
         return null;
     }
     $dc = $distributionProfile->getRecommendedDcForExecute();
     if (is_null($dc)) {
         $dc = kDataCenterMgr::getCurrentDcId();
     }
     $jobType = ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE);
     if ($distributionProfile->getProvider()->isLocalFileRequired($jobType)) {
         $readyForSubmit = self::prepareDistributionJob($entryDistribution, $distributionProfile, $dc);
         if (!$readyForSubmit) {
             $entryDistribution->setStatus(EntryDistributionStatus::IMPORT_UPDATING);
             $entryDistribution->save();
             return null;
         }
     }
     $jobData = new kDistributionUpdateJobData();
     $jobData->setDistributionProfileId($entryDistribution->getDistributionProfileId());
     $jobData->setEntryDistributionId($entryDistribution->getId());
     $jobData->setProviderType($distributionProfile->getProviderType());
     $jobData->setRemoteId($entryDistribution->getRemoteId());
     $jobData->setMediaFiles($entryDistribution->getMediaFiles());
     $batchJob = new BatchJob();
     $batchJob->setDc($dc);
     $batchJob->setEntryId($entryDistribution->getEntryId());
     $batchJob->setPartnerId($entryDistribution->getPartnerId());
     $jobSubType = $distributionProfile->getProviderType();
     return kJobsManager::addJob($batchJob, $jobData, $jobType, $jobSubType);
 }
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:42,代碼來源:kContentDistributionManager.php

示例6: addDeleteFileJob

 public static function addDeleteFileJob(BatchJob $parentJob = null, $entryId = null, $partnerId, $syncKey, $localFileSyncPath, $dc)
 {
     $deleteFileData = new kDeleteFileJobData();
     $deleteFileData->setLocalFileSyncPath($localFileSyncPath);
     $deleteFileData->setSyncKey($syncKey);
     if ($parentJob) {
         $batchJob = $parentJob->createChild(BatchJobType::DELETE_FILE, null, false);
     } else {
         $batchJob = new BatchJob();
         $batchJob->setEntryId($entryId);
         $batchJob->setPartnerId($partnerId);
     }
     $batchJob->setDc($dc);
     KalturaLog::log("Creating File Delete job, from data center id: " . $dc . " with source file: " . $deleteFileData->getLocalFileSyncPath());
     return self::addJob($batchJob, $deleteFileData, BatchJobType::DELETE_FILE);
 }
開發者ID:ace3535,項目名稱:server,代碼行數:16,代碼來源:kJobsManager.php

示例7: 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

示例8: 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

示例9: addFutureDeletionJob

 public static function addFutureDeletionJob(BatchJob $parentJob = null, $entryId = null, Partner $partner, $syncKey, $localFileSyncPath, $dc)
 {
     $deleteFileData = new kDeleteFileJobData();
     $deleteFileData->setLocalFileSyncPath($localFileSyncPath);
     $deleteFileData->setSyncKey($syncKey);
     if ($parentJob) {
         $batchJob = $parentJob->createChild(false);
     } else {
         $batchJob = new BatchJob();
         $batchJob->setEntryId($entryId);
         $batchJob->setPartnerId($partner->getId());
     }
     $batchJob->setStatus(BatchJob::BATCHJOB_STATUS_RETRY);
     $batchJob->setCheckAgainTimeout(12 * 60 * 60);
     $batchJob->setDc($dc);
     KalturaLog::log("Creating File Delete job, from data center id: " . $deleteFileData->getDC() . " with source file: " . $deleteFileData->getLocalFileSyncPath());
     return self::addJob($batchJob, $deleteFileData, BatchJobType::DELETE_FILE);
 }
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:18,代碼來源:kJobsManager.php


注:本文中的BatchJob::setDc方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。