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


PHP BatchJob::setDescription方法代码示例

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


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

示例1: addJob

 /**
  * @param string $puser_id
  * @param string $entry
  * @param string $version
  * @param string $file_format
  * @return BatchJob
  */
 public static function addJob($puser_id, $entry, $version, $file_format)
 {
     $entryId = $entry->getId();
     $entryIntId = $entry->getIntId();
     $entryVersion = $version ? $version : $entry->getVersion();
     if ($entry) {
         $partner = $entry->getPartner();
         $email = $partner->getAdminEmail();
     }
     $data = json_encode(array('puserId' => $puser_id, 'entryId' => $entryId, 'entryIntId' => $entryIntId, 'entryVersion' => $entryVersion, 'fileFormat' => $file_format, 'email' => $email));
     $job = new BatchJob();
     $job->setJobType(BatchJobType::FLATTEN);
     $job->setData($data, true);
     $job->setStatus(BatchJob::BATCHJOB_STATUS_PENDING);
     $job->setCheckAgainTimeout(time() + 10);
     $job->setProgress(0);
     $job->setMessage('Queued');
     $job->setDescription('Queued, waiting to run');
     $job->setUpdatesCount(0);
     $job->setEntryId($entryId);
     $job->setPartnerId($entry->getPartnerId());
     $job->setSubpId($entry->getSubpId());
     $job->save();
     return $job;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:32,代码来源:myBatchFlattenVideo.class.php

示例2: failBatchJob

 public static function failBatchJob(BatchJob $batchJob, $errDescription)
 {
     $batchJob->setMessage($errDescription);
     $description = $batchJob->getDescription() . "\n{$errDescription}";
     $batchJob->setDescription($description);
     return self::updateBatchJob($batchJob, BatchJob::BATCHJOB_STATUS_FAILED);
 }
开发者ID:ace3535,项目名称:server,代码行数:7,代码来源:kJobsManager.php

示例3: finishJobWithError

 /**
  * @param BatchJob $job
  * @param $errorDescription
  * @return BatchJob
  */
 protected function finishJobWithError(BatchJob $job, $errorDescription)
 {
     $job->setStatus(BatchJob::BATCHJOB_STATUS_FAILED);
     $job->setDescription($job->getDescription() . '\\n' . $errorDescription);
     $job->save();
     return $job;
 }
开发者ID:DBezemer,项目名称:server,代码行数:12,代码来源:kScheduledTaskBatchJobFlowManager.php

示例4: handleImportFinished

 /**
  * @param BatchJob $dbBatchJob
  * @param kImportJobData $data
  * @return BatchJob
  */
 public static function handleImportFinished(BatchJob $dbBatchJob, kImportJobData $data)
 {
     if ($dbBatchJob->getExecutionStatus() == BatchJobExecutionStatus::ABORTED) {
         return $dbBatchJob;
     }
     if (!file_exists($data->getDestFileLocalPath())) {
         throw new APIException(APIErrors::INVALID_FILE_NAME, $data->getDestFileLocalPath());
     }
     // get entry
     $entryId = $dbBatchJob->getEntryId();
     $dbEntry = entryPeer::retrieveByPKNoFilter($entryId);
     // IMAGE media entries
     if ($dbEntry->getType() == entryType::MEDIA_CLIP && $dbEntry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
         //setting the entry's data so it can be used for creating file-syncs' file-path version & extension - in kFileSyncUtils::moveFromFile
         //without saving - the updated entry object exists in the instance pool
         $dbEntry->setData(".jpg");
         $syncKey = $dbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
         try {
             kFileSyncUtils::moveFromFile($data->getDestFileLocalPath(), $syncKey, true, false, $data->getCacheOnly());
         } catch (Exception $e) {
             if ($dbEntry->getStatus() == entryStatus::NO_CONTENT) {
                 $dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
                 $dbEntry->save();
             }
             throw $e;
         }
         $dbEntry->setStatus(entryStatus::READY);
         $dbEntry->save();
         return $dbBatchJob;
     }
     $flavorAsset = null;
     if ($data->getFlavorAssetId()) {
         $flavorAsset = assetPeer::retrieveById($data->getFlavorAssetId());
     }
     $isNewFlavor = false;
     if (!$flavorAsset) {
         $msg = null;
         $flavorAsset = kFlowHelper::createOriginalFlavorAsset($dbBatchJob->getPartnerId(), $dbBatchJob->getEntryId(), $msg);
         if (!$flavorAsset) {
             KalturaLog::err("Flavor asset not created for entry [" . $dbBatchJob->getEntryId() . "]");
             kBatchManager::updateEntry($dbBatchJob->getEntryId(), entryStatus::ERROR_CONVERTING);
             $dbBatchJob->setMessage($msg);
             $dbBatchJob->setDescription($dbBatchJob->getDescription() . "\n" . $msg);
             return $dbBatchJob;
         }
         $isNewFlavor = true;
     }
     $isNewContent = true;
     $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     if (kFileSyncUtils::fileSync_exists($syncKey)) {
         $isNewContent = false;
     }
     $ext = pathinfo($data->getDestFileLocalPath(), PATHINFO_EXTENSION);
     KalturaLog::info("Imported file extension: {$ext}");
     if (!$flavorAsset->getVersion()) {
         $flavorAsset->incrementVersion();
     }
     if ($ext) {
         $flavorAsset->setFileExt($ext);
     }
     if ($flavorAsset instanceof thumbAsset) {
         list($width, $height, $type, $attr) = getimagesize($data->getDestFileLocalPath());
         $flavorAsset->setWidth($width);
         $flavorAsset->setHeight($height);
         $flavorAsset->setSize(filesize($data->getDestFileLocalPath()));
     }
     $flavorAsset->save();
     $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     kFileSyncUtils::moveFromFile($data->getDestFileLocalPath(), $syncKey, true, false, $data->getCacheOnly());
     // set the path in the job data
     $localFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
     $data->setDestFileLocalPath($localFilePath);
     $data->setFlavorAssetId($flavorAsset->getId());
     $dbBatchJob->setData($data);
     $dbBatchJob->save();
     $convertProfileExist = self::activateConvertProfileJob($dbBatchJob->getEntryId(), $localFilePath);
     if (($isNewContent || $dbEntry->getStatus() == entryStatus::IMPORT) && !$convertProfileExist) {
         // check if status == import for importing file of type url (filesync exists, and we want to raise event for conversion profile to start)
         kEventsManager::raiseEvent(new kObjectAddedEvent($flavorAsset, $dbBatchJob));
     }
     if (!$isNewFlavor) {
         $entryFlavors = assetPeer::retrieveByEntryIdAndStatus($flavorAsset->getEntryId(), flavorAsset::FLAVOR_ASSET_STATUS_WAIT_FOR_CONVERT);
         $originalFlavorAsset = assetPeer::retrieveOriginalByEntryId($flavorAsset->getEntryId());
         foreach ($entryFlavors as $entryFlavor) {
             /* @var $entryFlavor flavorAsset */
             if ($entryFlavor->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_WAIT_FOR_CONVERT && $entryFlavor->getFlavorParamsId()) {
                 $flavor = assetParamsOutputPeer::retrieveByAsset($entryFlavor);
                 kBusinessPreConvertDL::decideFlavorConvert($entryFlavor, $flavor, $originalFlavorAsset, null, null, $dbBatchJob);
             }
         }
         $entryThumbnails = assetPeer::retrieveThumbnailsByEntryId($flavorAsset->getEntryId());
         foreach ($entryThumbnails as $entryThumbnail) {
             /* @var $entryThumbnail thumbAsset */
             if ($entryThumbnail->getStatus() != asset::ASSET_STATUS_WAIT_FOR_CONVERT || !$entryThumbnail->getFlavorParamsId()) {
                 continue;
//.........这里部分代码省略.........
开发者ID:GElkayam,项目名称:server,代码行数:101,代码来源:kFlowHelper.php

示例5: handleImportFinished

 /**
  * @param BatchJob $dbBatchJob
  * @param kImportJobData $data
  * @param BatchJob $twinJob
  * @return BatchJob
  */
 public static function handleImportFinished(BatchJob $dbBatchJob, kImportJobData $data, BatchJob $twinJob = null)
 {
     KalturaLog::debug("Import finished, with file: " . $data->getDestFileLocalPath());
     if ($dbBatchJob->getAbort()) {
         return $dbBatchJob;
     }
     if (!$twinJob) {
         if (!file_exists($data->getDestFileLocalPath())) {
             throw new APIException(APIErrors::INVALID_FILE_NAME, $data->getDestFileLocalPath());
         }
     }
     // get entry
     $entryId = $dbBatchJob->getEntryId();
     $dbEntry = entryPeer::retrieveByPKNoFilter($entryId);
     // IMAGE media entries
     if ($dbEntry->getType() == entryType::MEDIA_CLIP && $dbEntry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
         $syncKey = $dbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
         try {
             kFileSyncUtils::moveFromFile($data->getDestFileLocalPath(), $syncKey, true, false, $data->getCacheOnly());
         } catch (Exception $e) {
             if ($dbEntry->getStatus() == entryStatus::NO_CONTENT) {
                 $dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
                 $dbEntry->save();
             }
             throw $e;
         }
         $dbEntry->setStatus(entryStatus::READY);
         $dbEntry->save();
         return $dbBatchJob;
     }
     $flavorAsset = null;
     if ($data->getFlavorAssetId()) {
         $flavorAsset = assetPeer::retrieveById($data->getFlavorAssetId());
     }
     $isNewFlavor = false;
     if (!$flavorAsset) {
         $msg = null;
         $flavorAsset = kFlowHelper::createOriginalFlavorAsset($dbBatchJob->getPartnerId(), $dbBatchJob->getEntryId(), $msg);
         if (!$flavorAsset) {
             KalturaLog::err("Flavor asset not created for entry [" . $dbBatchJob->getEntryId() . "]");
             kBatchManager::updateEntry($dbBatchJob->getEntryId(), entryStatus::ERROR_CONVERTING);
             $dbBatchJob->setMessage($msg);
             $dbBatchJob->setDescription($dbBatchJob->getDescription() . "\n" . $msg);
             return $dbBatchJob;
         }
         $isNewFlavor = true;
     }
     $isNewContent = true;
     $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     if (kFileSyncUtils::fileSync_exists($syncKey)) {
         $isNewContent = false;
     }
     if ($twinJob) {
         $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
         // copy file sync
         $twinData = $twinJob->getData();
         if ($twinData instanceof kImportJobData) {
             $twinFlavorAsset = assetPeer::retrieveById($twinData->getFlavorAssetId());
             if ($twinFlavorAsset) {
                 $twinSyncKey = $twinFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                 if ($twinSyncKey && kFileSyncUtils::file_exists($twinSyncKey)) {
                     kFileSyncUtils::softCopy($twinSyncKey, $syncKey);
                 }
             }
         }
     } else {
         $ext = pathinfo($data->getDestFileLocalPath(), PATHINFO_EXTENSION);
         KalturaLog::info("Imported file extension: {$ext}");
         if (!$flavorAsset->getVersion()) {
             $flavorAsset->incrementVersion();
         }
         $flavorAsset->setFileExt($ext);
         $flavorAsset->save();
         $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
         kFileSyncUtils::moveFromFile($data->getDestFileLocalPath(), $syncKey, true, false, $data->getCacheOnly());
     }
     // set the path in the job data
     $localFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
     $data->setDestFileLocalPath($localFilePath);
     $data->setFlavorAssetId($flavorAsset->getId());
     $dbBatchJob->setData($data);
     $dbBatchJob->save();
     if ($isNewContent || $dbEntry->getStatus() == entryStatus::IMPORT) {
         // check if status == import for importing file of type url (filesync exists, and we want to raise event for conversion profile to start)
         kEventsManager::raiseEvent(new kObjectAddedEvent($flavorAsset, $dbBatchJob));
     }
     if (!$isNewFlavor && $flavorAsset->getIsOriginal()) {
         $entryFlavors = assetPeer::retrieveFlavorsByEntryId($flavorAsset->getEntryId());
         foreach ($entryFlavors as $entryFlavor) {
             /* @var $entryFlavor flavorAsset */
             if ($entryFlavor->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_WAIT_FOR_CONVERT && $entryFlavor->getFlavorParamsId()) {
                 kBusinessPreConvertDL::decideAddEntryFlavor($dbBatchJob, $flavorAsset->getEntryId(), $entryFlavor->getFlavorParamsId());
             }
         }
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:kFlowHelper.php


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