本文整理汇总了PHP中BatchJob::getParentJob方法的典型用法代码示例。如果您正苦于以下问题:PHP BatchJob::getParentJob方法的具体用法?PHP BatchJob::getParentJob怎么用?PHP BatchJob::getParentJob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BatchJob
的用法示例。
在下文中一共展示了BatchJob::getParentJob方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: calculatePriority
/**
* This function calculates the priority of the job.
* @param BatchJob $batchJob
* @return integer the calculated priority
*/
public function calculatePriority(BatchJob $batchJob)
{
$parentJob = $batchJob->getParentJob();
if (!is_null($parentJob) && !is_null($parentJob->getLockInfo())) {
return $parentJob->getLockInfo()->getPriority();
}
return self::BATCH_JOB_DEFAULT_PRIORITY;
}
示例2: shouldConsumeJobStatusEvent
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob)
{
$jobType = $dbBatchJob->getJobType();
$data = $dbBatchJob->getData();
// copy cue points only if it's the first file and this is the primary server
if ($jobType == BatchJobType::CONVERT_LIVE_SEGMENT && $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FINISHED && $data->getFileIndex() == 0 && $data->getMediaServerIndex() == MediaServerIndex::PRIMARY) {
$asset = assetPeer::retrieveByIdNoFilter($data->getAssetId());
if ($asset->hasTag(assetParams::TAG_RECORDING_ANCHOR)) {
return true;
}
} elseif ($jobType == BatchJobType::CONCAT && $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FINISHED) {
$convertLiveSegmentJobData = $dbBatchJob->getParentJob()->getData();
$asset = assetPeer::retrieveByIdNoFilter($convertLiveSegmentJobData->getAssetId());
if ($asset->hasTag(assetParams::TAG_RECORDING_ANCHOR)) {
return true;
}
}
return false;
}
示例3: handlePostConvertFailed
/**
* @param BatchJob $dbBatchJob
* @param kPostConvertJobData $data
* @param BatchJob $twinJob
* @return BatchJob
*/
public static function handlePostConvertFailed(BatchJob $dbBatchJob, kPostConvertJobData $data, BatchJob $twinJob = null)
{
KalturaLog::debug("Post Convert failed for flavor params output: " . $data->getFlavorParamsOutputId());
// get additional info from the parent job
$engineType = null;
$mediaInfoId = null;
$parentJob = $dbBatchJob->getParentJob();
if ($parentJob) {
$engineType = $parentJob->getJobSubType();
$convertJobData = $parentJob->getData();
if ($convertJobData instanceof kConvertJobData) {
$mediaInfoId = $convertJobData->getMediaInfoId();
}
}
kBusinessPostConvertDL::handleConvertFailed($dbBatchJob, $engineType, $data->getFlavorAssetId(), $data->getFlavorParamsOutputId(), $mediaInfoId);
return $dbBatchJob;
}
示例4: handleFlavorReady
public static function handleFlavorReady(BatchJob $dbBatchJob, $flavorAssetId)
{
// verifies that flavor asset created
if (!$flavorAssetId) {
throw new APIException(APIErrors::INVALID_FLAVOR_ASSET_ID, $flavorAssetId);
}
$currentFlavorAsset = assetPeer::retrieveById($flavorAssetId);
// verifies that flavor asset exists
if (!$currentFlavorAsset) {
throw new APIException(APIErrors::INVALID_FLAVOR_ASSET_ID, $flavorAssetId);
}
// if the flavor deleted then it shouldn't be taken into ready calculations
if ($currentFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_DELETED) {
return $currentFlavorAsset;
}
// Remarked because we want the original flavor ready behavior to work the same as other flavors
//
// $rootBatchJob = $dbBatchJob->getRootJob();
//
// // happens in case of post convert on the original (in case of bypass)
// if($rootBatchJob && $currentFlavorAsset->getIsOriginal())
// {
// kJobsManager::updateBatchJob($rootBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED);
// return $dbBatchJob;
// }
$sourceMediaInfo = mediaInfoPeer::retrieveOriginalByEntryId($dbBatchJob->getEntryId());
/*
* For intermediate source generation, both the source and the asset have the same asset id.
* In this case sourceMediaInfo should be retrieved as the first version of source asset mediaInfo
*/
if (isset($sourceMediaInfo) && $sourceMediaInfo->getFlavorAssetId() == $flavorAssetId) {
$productMediaInfo = $sourceMediaInfo;
$entry = $dbBatchJob->getEntry();
$operationAttributes = $entry->getOperationAttributes();
// if in clipping operation - take the latest created mediainfo object
$ascending = empty($operationAttributes) ? 1 : 0;
$sourceMediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($flavorAssetId, $ascending);
KalturaLog::log("Intermediate source generation - assetId(" . $flavorAssetId . "),src MdInf id(" . $sourceMediaInfo->getId() . "),product MdInf id(" . $productMediaInfo->getId()) . ")";
} else {
$productMediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($currentFlavorAsset->getId());
}
$targetFlavor = assetParamsOutputPeer::retrieveByAssetId($currentFlavorAsset->getId());
//Retrieve convert job executing engien
$convertEngineType = null;
if ($dbBatchJob->getParentJob()) {
$dbParentBatchJob = $dbBatchJob->getParentJob();
if ($dbParentBatchJob->getJobType() == BatchJobType::CONVERT) {
$convertEngineType = $dbParentBatchJob->getJobSubType();
}
}
$postConvertData = $dbBatchJob->getData();
$postConvertAssetType = BatchJob::POSTCONVERT_ASSET_TYPE_FLAVOR;
if ($postConvertData instanceof kPostConvertJobData) {
$postConvertAssetType = $postConvertData->getPostConvertAssetType();
}
// don't validate in case of bypass, in case target flavor or media info are null
// or ISM/ISMC manifest assets
if ($postConvertAssetType != BatchJob::POSTCONVERT_ASSET_TYPE_BYPASS && $targetFlavor && $productMediaInfo && !$targetFlavor->hasTag(assetParams::TAG_ISM_MANIFEST)) {
try {
$productFlavor = KDLWrap::CDLValidateProduct($sourceMediaInfo, $targetFlavor, $productMediaInfo, $convertEngineType);
} catch (Exception $e) {
KalturaLog::err('KDL Error: ' . print_r($e, true));
}
$err = kBusinessConvertDL::parseFlavorDescription($productFlavor);
KalturaLog::debug("BCDL: job id [" . $dbBatchJob->getId() . "] flavor params output id [" . $targetFlavor->getId() . "] flavor asset id [" . $currentFlavorAsset->getId() . "] desc: {$err}");
if (!$productFlavor->IsValid()) {
$description = $currentFlavorAsset->getDescription() . "\n{$err}";
// mark the asset as ready
$currentFlavorAsset->setDescription($description);
$currentFlavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
$currentFlavorAsset->save();
if (!kConf::get('ignore_cdl_failure')) {
kJobsManager::failBatchJob($dbBatchJob, $err);
return null;
}
}
}
// mark the asset as ready
$currentFlavorAsset->setStatusLocalReady();
$currentFlavorAsset->save();
$waitingFlavorAssets = assetPeer::retrieveByEntryIdAndStatus($currentFlavorAsset->getEntryId(), flavorAsset::FLAVOR_ASSET_STATUS_WAIT_FOR_CONVERT);
$originalFlavorAsset = assetPeer::retrieveOriginalByEntryId($currentFlavorAsset->getEntryId());
foreach ($waitingFlavorAssets as $waitingFlavorAsset) {
$flavor = assetParamsOutputPeer::retrieveByAsset($waitingFlavorAsset);
KalturaLog::debug('Check waiting flavor asset [' . $waitingFlavorAsset->getId() . ']');
if ($dbBatchJob->getParentJob()) {
$parentJob = $dbBatchJob->getParentJob();
} else {
$parentJob = $dbBatchJob;
}
kBusinessPreConvertDL::decideFlavorConvert($waitingFlavorAsset, $flavor, $originalFlavorAsset, null, null, $parentJob);
}
kFlowHelper::generateThumbnailsFromFlavor($dbBatchJob->getEntryId(), $dbBatchJob, $currentFlavorAsset->getFlavorParamsId());
if ($currentFlavorAsset->getIsOriginal()) {
$entry = $currentFlavorAsset->getentry();
if ($entry) {
kBusinessConvertDL::checkForPendingLiveClips($entry);
}
}
return $currentFlavorAsset;
//.........这里部分代码省略.........