本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}