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