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


PHP kJobsManager::failBatchJob方法代码示例

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


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

示例1: decideProfileFlavorsConvert

 public static function decideProfileFlavorsConvert(BatchJob $parentJob, BatchJob $convertProfileJob, array $flavors, array $conversionProfileFlavorParams, mediaInfo $mediaInfo = null)
 {
     $entryId = $convertProfileJob->getEntryId();
     $originalFlavorAsset = flavorAssetPeer::retrieveOriginalByEntryId($entryId);
     if (is_null($originalFlavorAsset)) {
         $errDescription = 'Original flavor asset not found';
         KalturaLog::err($errDescription);
         $convertProfileJob = kJobsManager::failBatchJob($convertProfileJob, $errDescription, BatchJobType::CONVERT_PROFILE);
         kBatchManager::updateEntry($convertProfileJob, entryStatus::ERROR_CONVERTING);
         return false;
     }
     $errDescription = null;
     $finalFlavors = self::validateConversionProfile($convertProfileJob->getPartnerId(), $entryId, $mediaInfo, $flavors, $conversionProfileFlavorParams, $errDescription);
     KalturaLog::log(count($finalFlavors) . " flavors returned from the decision layer");
     if (is_null($finalFlavors)) {
         $convertProfileJob = kJobsManager::failBatchJob($convertProfileJob, $errDescription);
         KalturaLog::log("No flavors created");
         throw new Exception($errDescription);
     }
     if (strlen($errDescription)) {
         $err = $convertProfileJob->getDescription() . $errDescription;
         $convertProfileJob->setDescription($err);
         $convertProfileJob->save();
     }
     $srcSyncKey = $originalFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $conversionsCreated = 0;
     $entry = $convertProfileJob->getEntry();
     if (!$entry) {
         throw new APIException(APIErrors::INVALID_ENTRY, $convertProfileJob, $entryId);
     }
     $flavorsCollections = array();
     // create a convert job per each flavor
     foreach ($finalFlavors as $flavor) {
         $flavorAsset = kBatchManager::createFlavorAsset($flavor, $entry->getPartnerId(), $entry->getId());
         if (!$flavorAsset) {
             KalturaLog::log("Flavor asset could not be created, flavor conversion won't be created");
             continue;
         }
         $collectionTag = $flavor->getCollectionTag();
         if ($collectionTag) {
             $flavorsCollections[$collectionTag][] = $flavor;
             continue;
         }
         KalturaLog::log("Adding flavor conversion with flavor params output id [" . $flavor->getId() . "] and flavor params asset id [" . $flavorAsset->getId() . "]");
         $madiaInfoId = $mediaInfo ? $mediaInfo->getId() : null;
         $createdJob = kJobsManager::addFlavorConvertJob($srcSyncKey, $flavor, $flavorAsset->getId(), $madiaInfoId, $parentJob);
         if ($createdJob) {
             $conversionsCreated++;
         }
     }
     foreach ($flavorsCollections as $tag => $flavors) {
         switch ($tag) {
             case flavorParams::TAG_ISM:
                 $createdJob = kJobsManager::addConvertIsmCollectionJob($tag, $srcSyncKey, $entry, $parentJob, $flavors);
                 if ($createdJob) {
                     $conversionsCreated++;
                 }
                 break;
             default:
                 KalturaLog::log("Error: Invalid collection tag [{$tag}]");
                 break;
         }
     }
     if (!$conversionsCreated) {
         $convertProfileJob = kJobsManager::failBatchJob($convertProfileJob, $errDescription);
         KalturaLog::log("No flavors created: {$errDescription}");
         return false;
     }
     return true;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:70,代码来源:kBusinessPreConvertDL.php

示例2: handlePullFailed

 /**
  * @param BatchJob $dbBatchJob
  * @param kPullJobData $data
  * @param BatchJob $twinJob
  * @return BatchJob
  */
 public static function handlePullFailed(BatchJob $dbBatchJob, kPullJobData $data, BatchJob $twinJob = null)
 {
     $rootBatchJob = $dbBatchJob->getRootJob();
     if ($rootBatchJob) {
         $rootBatchJob = kJobsManager::failBatchJob($rootBatchJob, "Pull job " . $dbBatchJob->getId() . " failed");
     }
     return $dbBatchJob;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:14,代码来源:kFlowHelper.php

示例3: setError

 private static function setError($errDescription, BatchJob $batchJob, $batchJobType, $entryId)
 {
     $batchJob = kJobsManager::failBatchJob($batchJob, $errDescription, $batchJobType);
     kBatchManager::updateEntry($entryId, entryStatus::ERROR_CONVERTING);
     KalturaLog::err($errDescription);
 }
开发者ID:DBezemer,项目名称:server,代码行数:6,代码来源:kBusinessPreConvertDL.php

示例4: handleConvertFailed

 public static function handleConvertFailed(BatchJob $dbBatchJob, $engineType, $flavorAssetId, $flavorParamsOutputId, $mediaInfoId)
 {
     $flavorAsset = assetPeer::retrieveById($flavorAssetId);
     // verifies that flavor asset exists
     if (!$flavorAsset) {
         throw new APIException(APIErrors::INVALID_FLAVOR_ASSET_ID, $flavorAssetId);
     }
     $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
     $flavorAsset->save();
     // try to create a convert job with the next engine
     if (!is_null($engineType)) {
         $data = $dbBatchJob->getData();
         if ($data instanceof kConvartableJobData) {
             $data->incrementOperationSet();
             $dbBatchJob->setData($data);
             $dbBatchJob->save();
         }
         $newDbBatchJob = kBusinessPreConvertDL::redecideFlavorConvert($flavorAssetId, $flavorParamsOutputId, $mediaInfoId, $dbBatchJob, $engineType);
         if ($newDbBatchJob) {
             return true;
         }
     }
     // find the root job
     $rootBatchJob = $dbBatchJob->getRootJob();
     if (!$rootBatchJob) {
         return false;
     }
     // the root is already failed
     if ($rootBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FAILED || $rootBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FATAL) {
         return false;
     }
     // bulk download root job no need to handle
     if ($rootBatchJob->getJobType() == BatchJobType::BULKDOWNLOAD) {
         kJobsManager::failBatchJob($rootBatchJob, "Convert job " . $dbBatchJob->getId() . " failed");
         return false;
     }
     if (is_null($flavorParamsOutputId)) {
         kJobsManager::failBatchJob($rootBatchJob, "Job " . $dbBatchJob->getId() . " failed");
         kBatchManager::updateEntry($dbBatchJob->getEntryId(), entryStatus::ERROR_CONVERTING);
         return false;
     }
     $readyBehavior = $dbBatchJob->getData()->getReadyBehavior();
     if ($readyBehavior == flavorParamsConversionProfile::READY_BEHAVIOR_REQUIRED) {
         kJobsManager::failBatchJob($rootBatchJob, "Job " . $dbBatchJob->getId() . " failed");
         kBatchManager::updateEntry($dbBatchJob->getEntryId(), entryStatus::ERROR_CONVERTING);
         return false;
     }
     // failing the root profile job if all child jobs failed
     if ($rootBatchJob->getJobType() != BatchJobType::CONVERT_PROFILE) {
         return false;
     }
     $siblingJobs = $rootBatchJob->getChildJobs();
     foreach ($siblingJobs as $siblingJob) {
         /* @var $siblingJob BatchJob */
         // not conversion job and should be ignored
         if ($siblingJob->getJobType() != BatchJobType::CONVERT && $siblingJob->getJobType() != BatchJobType::POSTCONVERT) {
             continue;
         }
         $jobData = $siblingJob->getData();
         if (!$jobData || !$jobData instanceof kConvertJobData && !$jobData instanceof kPostConvertJobData) {
             KalturaLog::err("Job id [" . $siblingJob->getId() . "] has no valid job data");
             continue;
         }
         // found child flavor asset that hasn't failed, no need to fail the root job
         $siblingFlavorAssetId = $jobData->getFlavorAssetId();
         $siblingFlavorAsset = assetPeer::retrieveById($siblingFlavorAssetId);
         if ($siblingFlavorAsset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_ERROR && $siblingFlavorAsset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_NOT_APPLICABLE && $siblingFlavorAsset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_DELETED) {
             return false;
         }
     }
     // all conversions failed, should fail the root job
     kJobsManager::failBatchJob($rootBatchJob, "All conversions failed");
     kBatchManager::updateEntry($dbBatchJob->getEntryId(), entryStatus::ERROR_CONVERTING);
     return false;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:75,代码来源:kBusinessPostConvertDL.php

示例5: handleConvertFailed

 public static function handleConvertFailed(BatchJob $dbBatchJob, $engineType, $flavorAssetId, $flavorParamsOutputId, $mediaInfoId)
 {
     $flavorAsset = assetPeer::retrieveById($flavorAssetId);
     // verifies that flavor asset exists
     if (!$flavorAsset) {
         throw new APIException(APIErrors::INVALID_FLAVOR_ASSET_ID, $flavorAssetId);
     }
     /*
      * On Webex error, roll back the inter-src asset version in order to allow the retry to get ARF as a source, 
      * rather than the invlaid WMV file (product of bad nbrplayer session)
      */
     if ($dbBatchJob->getErrNumber() == BatchJobAppErrors::BLACK_OR_SILENT_CONTENT) {
         $prevVer = $flavorAsset->getPreviousVersion();
         $currVer = $flavorAsset->getVersion();
         KalturaLog::log("Webex conversion - Garbled Audio or Black frame or Silence. Rolling back asset/file-sync version - curr({$currVer}), prev({$prevVer})");
         if (isset($prevVer)) {
             $syncKey = $flavorAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET, $currVer);
             if (isset($syncKey)) {
                 kFileSyncUtils::deleteSyncFileForKey($syncKey, false, true);
                 $flavorAsset->setVersion($prevVer);
                 $flavorAsset->setPreviousVersion(null);
                 KalturaLog::log("Webex conversion - Rolled back");
             }
         }
     }
     $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
     $flavorAsset->save();
     // try to create a convert job with the next engine
     if (!is_null($engineType)) {
         $data = $dbBatchJob->getData();
         if ($data instanceof kConvartableJobData) {
             $data->incrementOperationSet();
             $dbBatchJob->setData($data);
             $dbBatchJob->save();
         }
         $newDbBatchJob = kBusinessPreConvertDL::redecideFlavorConvert($flavorAssetId, $flavorParamsOutputId, $mediaInfoId, $dbBatchJob, $engineType);
         if ($newDbBatchJob) {
             return true;
         }
     }
     // find the root job
     $rootBatchJob = $dbBatchJob->getRootJob();
     if (!$rootBatchJob) {
         return false;
     }
     // the root is already failed
     if ($rootBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FAILED || $rootBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FATAL) {
         return false;
     }
     // bulk download root job no need to handle
     if ($rootBatchJob->getJobType() == BatchJobType::BULKDOWNLOAD) {
         kJobsManager::failBatchJob($rootBatchJob, "Convert job " . $dbBatchJob->getId() . " failed");
         return false;
     }
     if (is_null($flavorParamsOutputId)) {
         kJobsManager::failBatchJob($rootBatchJob, "Job " . $dbBatchJob->getId() . " failed");
         kBatchManager::updateEntry($dbBatchJob->getEntryId(), entryStatus::ERROR_CONVERTING);
         return false;
     }
     $readyBehavior = $dbBatchJob->getData()->getReadyBehavior();
     if ($readyBehavior == flavorParamsConversionProfile::READY_BEHAVIOR_REQUIRED) {
         kJobsManager::failBatchJob($rootBatchJob, "Job " . $dbBatchJob->getId() . " failed");
         kBatchManager::updateEntry($dbBatchJob->getEntryId(), entryStatus::ERROR_CONVERTING);
         return false;
     }
     // failing the root profile job if all child jobs failed
     if ($rootBatchJob->getJobType() != BatchJobType::CONVERT_PROFILE) {
         return false;
     }
     $siblingJobs = $rootBatchJob->getChildJobs();
     foreach ($siblingJobs as $siblingJob) {
         /* @var $siblingJob BatchJob */
         // not conversion job and should be ignored
         if ($siblingJob->getJobType() != BatchJobType::CONVERT && $siblingJob->getJobType() != BatchJobType::POSTCONVERT) {
             continue;
         }
         $jobData = $siblingJob->getData();
         if (!$jobData || !$jobData instanceof kConvertJobData && !$jobData instanceof kPostConvertJobData) {
             KalturaLog::err("Job id [" . $siblingJob->getId() . "] has no valid job data");
             continue;
         }
         // found child flavor asset that hasn't failed, no need to fail the root job
         $siblingFlavorAssetId = $jobData->getFlavorAssetId();
         $siblingFlavorAsset = assetPeer::retrieveById($siblingFlavorAssetId);
         if ($siblingFlavorAsset && $siblingFlavorAsset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_ERROR && $siblingFlavorAsset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_NOT_APPLICABLE && $siblingFlavorAsset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_DELETED) {
             return false;
         }
     }
     // all conversions failed, should fail the root job
     kJobsManager::failBatchJob($rootBatchJob, "All conversions failed");
     kBatchManager::updateEntry($dbBatchJob->getEntryId(), entryStatus::ERROR_CONVERTING);
     return false;
 }
开发者ID:AdiTal,项目名称:server,代码行数:93,代码来源:kBusinessPostConvertDL.php


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