當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。