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


PHP BatchJob::setOnStressDivertTo方法代码示例

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


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

示例1: addFlavorConvertJob


//.........这里部分代码省略.........
         KalturaLog::log("Last Engine Type is null, engine version [" . $flavor->getEngineVersion() . "]");
         if ($flavor->getEngineVersion()) {
             $operatorSet = new kOperatorSets();
             $operatorSet->setSerialized($flavor->getOperators());
             $nextOperator = $operatorSet->getOperator();
             if (!$nextOperator) {
                 KalturaLog::err("First operator is invalid");
                 return null;
             }
             KalturaLog::log("Set first operator in first set");
             $currentConversionEngine = $nextOperator->id;
         }
     } else {
         if ($parentJob && $flavor->getEngineVersion() && ($parentJob->getJobType() == BatchJobType::CONVERT || $parentJob->getJobType() == BatchJobType::POSTCONVERT)) {
             // using next oprator
             KalturaLog::log("Adding next conversion operator");
             $parentData = $parentJob->getData();
             if (!$parentData || !$parentData instanceof kConvartableJobData) {
                 KalturaLog::err("Parent job data is invalid");
                 return null;
             }
             $operatorSet = new kOperatorSets();
             $operatorSet->setSerialized($flavor->getOperators());
             $nextOperatorSet = $parentData->getCurrentOperationSet();
             $nextOperatorIndex = $parentData->getCurrentOperationIndex() + 1;
             $nextOperator = $operatorSet->getOperator($nextOperatorSet, $nextOperatorIndex);
             if (!$nextOperator) {
                 KalturaLog::err("Next operator is invalid");
                 return null;
             }
             KalturaLog::log("Moving to next operator [{$nextOperatorIndex}] in set [{$nextOperatorSet}]");
             $convertData->setCurrentOperationSet($nextOperatorSet);
             $convertData->setCurrentOperationIndex($nextOperatorIndex);
             $currentConversionEngine = $nextOperator->id;
         } else {
             // TODO remove after all old version flavors migrated
             KalturaLog::log("Last used conversion engine is [{$lastEngineType}]");
             // searching for $lastEngineType in the list
             while ($lastEngineType != $currentConversionEngine && next($conversionEngines)) {
                 $currentConversionEngine = current($conversionEngines);
             }
             // takes the next engine
             $currentConversionEngine = next($conversionEngines);
             if (!$currentConversionEngine) {
                 KalturaLog::err("There is no other conversion engine to use");
                 return null;
             }
         }
     }
     if (!is_null($fileSync->getWamsAssetId())) {
         $currentConversionEngine = conversionEngineType::WAMS;
     }
     KalturaLog::log("Using conversion engine [{$currentConversionEngine}]");
     // creats a child convert job
     if (is_null($dbConvertFlavorJob)) {
         if ($parentJob) {
             $dbConvertFlavorJob = $parentJob->createChild();
             KalturaLog::log("Created from parent convert job with entry id [" . $dbConvertFlavorJob->getEntryId() . "]");
         } else {
             $dbConvertFlavorJob = new BatchJob();
             $dbConvertFlavorJob->setEntryId($flavor->getEntryId());
             $dbConvertFlavorJob->setPartnerId($flavor->getPartnerId());
             $dbConvertFlavorJob->save();
             KalturaLog::log("Created from flavor convert job with entry id [" . $dbConvertFlavorJob->getEntryId() . "]");
         }
     }
     if (!is_null($fileSync->getWamsAssetId())) {
         $srcFileSize = kWAMS::getInstance($flavor->getPartnerId())->getFileSizeForAssetId($fileSync->getWamsAssetId());
     } else {
         $srcFileSize = kFile::fileSize($convertData->getSrcFileSyncLocalPath());
     }
     $dbConvertFlavorJob->setFileSize($srcFileSize);
     // TODO remove after all old version flavors migrated
     if (in_array(conversionEngineType::ENCODING_COM, $conversionEngines)) {
         $dbConvertFlavorJob->setOnStressDivertTo(conversionEngineType::ENCODING_COM);
     }
     // remove until here
     /*
     	// Remarked by Dor until Tantan's return.
     	// Code is supposed to get a configuration file from the engine and attach it to the batch job.
     	// Was added for document conversion and is not used for now because of a bug of PDFCreator.
     
     KalturaLog::log("Calling CDLProceessFlavor with flavor params output[" . $flavor->getId() . "]");
     $config = KDLWrap::CDLProceessFlavor($flavor);
     if($config)
     {
     	$syncKey = $dbConvertFlavorJob->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_CONFIG);
     	kFileSyncUtils::file_put_contents($syncKey, $config);
     	
     	$fileSync = kFileSyncUtils::getLocalFileSyncForKey($syncKey);
     	$remoteUrl = $fileSync->getExternalUrl($flavor->getEntryId());
     	$localPath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
     	
     	$convertData->setConfigLocalPath($localPath);
     	$convertData->setConfigRemoteUrl($remoteUrl);
     }
     */
     $dbCurrentConversionEngine = kPluginableEnumsManager::apiToCore('conversionEngineType', $currentConversionEngine);
     return kJobsManager::addJob($dbConvertFlavorJob, $convertData, BatchJobType::CONVERT, $dbCurrentConversionEngine);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:kJobsManager.php

示例2: addFlavorConvertJob


//.........这里部分代码省略.........
     if (!$flavor->getEngineVersion()) {
         $conversionEngines = explode(',', $flavor->getConversionEngines());
         KalturaLog::log(count($conversionEngines) . " conversion engines found for the flavor");
         $currentConversionEngine = reset($conversionEngines);
         // gets the first engine type
     }
     // remove until here
     if (is_null($lastEngineType)) {
         KalturaLog::log("Last Engine Type is null, engine version [" . $flavor->getEngineVersion() . "]");
         if ($flavor->getEngineVersion()) {
             $operatorSet = new kOperatorSets();
             $operatorSet->setSerialized($flavor->getOperators());
             $nextOperator = $operatorSet->getOperator();
             if (!$nextOperator) {
                 KalturaLog::log("First operator is invalid");
                 return null;
             }
             KalturaLog::log("Set first operator in first set");
             $currentConversionEngine = $nextOperator->id;
         }
     } else {
         if ($parentJob && $flavor->getEngineVersion() && ($parentJob->getJobType() == BatchJobType::CONVERT || $parentJob->getJobType() == BatchJobType::POSTCONVERT)) {
             // using next oprator
             KalturaLog::log("Adding next conversion operator");
             $parentData = $parentJob->getData();
             if (!$parentData || !$parentData instanceof kConvartableJobData) {
                 KalturaLog::log("Parent job data is invalid");
                 return null;
             }
             $operatorSet = new kOperatorSets();
             $operatorSet->setSerialized($flavor->getOperators());
             $nextOperatorSet = $parentData->getCurrentOperationSet();
             $nextOperatorIndex = $parentData->getCurrentOperationIndex() + 1;
             $nextOperator = $operatorSet->getOperator($nextOperatorSet, $nextOperatorIndex);
             if (!$nextOperator) {
                 KalturaLog::log("Next operator is invalid");
                 return null;
             }
             KalturaLog::log("Moving to next operator [{$nextOperatorIndex}] in set [{$nextOperatorSet}]");
             $convertData->setCurrentOperationSet($nextOperatorSet);
             $convertData->setCurrentOperationIndex($nextOperatorIndex);
             $currentConversionEngine = $nextOperator->id;
         } else {
             // TODO remove after all old version flavors migrated
             KalturaLog::log("Last used conversion engine is [{$lastEngineType}]");
             // searching for $lastEngineType in the list
             while ($lastEngineType != $currentConversionEngine && next($conversionEngines)) {
                 $currentConversionEngine = current($conversionEngines);
             }
             // takes the next engine
             $currentConversionEngine = next($conversionEngines);
             if (!$currentConversionEngine) {
                 KalturaLog::log("There is no other conversion engine to use");
                 return null;
             }
         }
     }
     KalturaLog::log("Using conversion engine [{$currentConversionEngine}]");
     // creats a child convert job
     if (is_null($dbConvertFlavorJob)) {
         if ($parentJob) {
             $dbConvertFlavorJob = $parentJob->createChild();
             KalturaLog::log("Created from parent convert job with entry id [" . $dbConvertFlavorJob->getEntryId() . "]");
         } else {
             $dbConvertFlavorJob = new BatchJob();
             $dbConvertFlavorJob->setEntryId($flavor->getEntryId());
             $dbConvertFlavorJob->setPartnerId($flavor->getPartnerId());
             $dbConvertFlavorJob->save();
             KalturaLog::log("Created from flavor convert job with entry id [" . $dbConvertFlavorJob->getEntryId() . "]");
         }
     }
     $dbConvertFlavorJob->setFileSize(filesize($convertData->getSrcFileSyncLocalPath()));
     // TODO remove after all old version flavors migrated
     if (in_array(conversionEngineType::ENCODING_COM, $conversionEngines)) {
         $dbConvertFlavorJob->setOnStressDivertTo(conversionEngineType::ENCODING_COM);
     }
     // remove until here
     /*
     	// Remarked by Dor until Tantan's return.
     	// Code is supposed to get a configuration file from the engine and attach it to the batch job.
     	// Was added for document conversion and is not used for now because of a bug of PDFCreator.
     
     KalturaLog::log("Calling CDLProceessFlavor with flavor params output[" . $flavor->getId() . "]");
     $config = KDLWrap::CDLProceessFlavor($flavor);
     if($config)
     {
     	$syncKey = $dbConvertFlavorJob->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_CONFIG);
     	kFileSyncUtils::file_put_contents($syncKey, $config);
     	
     	$fileSync = kFileSyncUtils::getLocalFileSyncForKey($syncKey);
     	$remoteUrl = $fileSync->getExternalUrl();
     	$localPath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
     	
     	$convertData->setConfigLocalPath($localPath);
     	$convertData->setConfigRemoteUrl($remoteUrl);
     }
     */
     $dbCurrentConversionEngine = kPluginableEnumsManager::apiToCore('conversionEngineType', $currentConversionEngine);
     return kJobsManager::addJob($dbConvertFlavorJob, $convertData, BatchJobType::CONVERT, $dbCurrentConversionEngine);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:101,代码来源:kJobsManager.php


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