本文整理匯總了PHP中BatchJob類的典型用法代碼示例。如果您正苦於以下問題:PHP BatchJob類的具體用法?PHP BatchJob怎麽用?PHP BatchJob使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了BatchJob類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: shouldConsumeJobStatusEvent
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob)
{
if ($dbBatchJob->getJobType() == IntegrationPlugin::getBatchJobTypeCoreValue(IntegrationBatchJobType::INTEGRATION) && $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_DONT_PROCESS && $dbBatchJob->getData()->getTriggerType() == BpmEventNotificationIntegrationPlugin::getIntegrationTriggerCoreValue(BpmEventNotificationIntegrationTrigger::BPM_EVENT_NOTIFICATION)) {
return true;
}
return false;
}
示例2: execute
/**
* Will investigate a single entry
*/
public function execute()
{
$mode = $this->getP("mode", "get");
$c = new Criteria();
// $c->add ( BatchJobPeer::JOB_TYPE , BatchJobType::DELETE );
$peer = new BatchJobPeer();
$location_id = "loc1";
$server_id = "ser1";
$execution_time = 400;
$number_of_objects = 1;
if ($mode == "free") {
$id = $this->getP("id");
$this->res = kBatchExclusiveLock::freeExclusive($id, $peer, $location_id, $server_id);
} elseif ($mode == "update") {
$id = $this->getP("id");
$obj = new BatchJob();
$obj->setProgress(77);
$this->res = kBatchExclusiveLock::updateExclusive($id, $peer, $location_id, $server_id, $obj);
} else {
$partner_group = new myPartnerGroups("+1;0;-3,4");
$this->res = null;
$cloned_c = clone $c;
while ($partner_group->applyPartnerGroupToCriteria($cloned_c, $peer)) {
$this->res = kBatchExclusiveLock::getExclusive($cloned_c, $peer, $location_id, $server_id, $execution_time, $number_of_objects);
if ($this->res) {
break;
}
$cloned_c = clone $c;
}
}
}
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:34,代碼來源:testExclusiveAction.class.php
示例3: copyModifiedColumns
protected function copyModifiedColumns(BatchJobLog $batchJobLog, BatchJob $batchJob, array $modifiedColumns)
{
$shouldSkipInTranslation = array(BatchJobPeer::LOCK_INFO, BatchJobPeer::HISTORY, BatchJobPeer::BATCH_JOB_LOCK_ID, BatchJobPeer::EXECUTION_STATUS);
foreach ($modifiedColumns as $modifiedColumn) {
$fieldPosLog = -1;
try {
if (in_array($modifiedColumn, $shouldSkipInTranslation)) {
if ($modifiedColumn == BatchJobPeer::EXECUTION_STATUS) {
$batchJobLog->setAbort($batchJob->getExecutionStatus() == BatchJobExecutionStatus::ABORTED);
}
continue;
}
$fieldName = BatchJobPeer::translateFieldName($modifiedColumn, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME);
$fieldPosJob = BatchJobPeer::translateFieldName($modifiedColumn, BasePeer::TYPE_COLNAME, BasePeer::TYPE_NUM);
$fieldPosLog = BatchJobLogPeer::translateFieldName($fieldName, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM);
} catch (PropelException $e) {
KalturaLog::err("Could not set value for BatchJobLog field {$fieldName}, exception thrown: " . $e->getMessage());
}
if ($fieldPosLog != -1) {
$batchJobLog->setByPosition($fieldPosLog, $batchJob->getByPosition($fieldPosJob));
}
if ($modifiedColumn == BatchJobPeer::DATA) {
//set param_1 for the $batchJobLog
$batchJobData = $batchJob->getData();
/* @var $batchJobData kBulkUploadJobData */
$batchJobLog->setParam1($batchJobData->getBulkUploadObjectType());
}
}
return $batchJobLog;
}
示例4: getScope
public function getScope()
{
$scope = parent::getScope();
$scope->setPartnerId($this->dbBatchJob->getPartnerId());
$scope->setParentRaisedJob($this->dbBatchJob);
return $scope;
}
示例5: addParseCaptionAssetJob
/**
* @param CaptionAsset $captionAsset
* @param BatchJob $parentJob
* @throws kCoreException FILE_NOT_FOUND
* @return BatchJob
*/
public function addParseCaptionAssetJob(CaptionAsset $captionAsset, BatchJob $parentJob = null)
{
$syncKey = $captionAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
if (!$fileSync) {
if (!PermissionPeer::isValidForPartner(CaptionPermissionName::IMPORT_REMOTE_CAPTION_FOR_INDEXING, $captionAsset->getPartnerId())) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if (!$fileSync) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
$fullPath = myContentStorage::getFSUploadsPath() . '/' . $captionAsset->getId() . '.tmp';
if (!kFile::downloadUrlToFile($fileSync->getExternalUrl($captionAsset->getEntryId()), $fullPath)) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
kFileSyncUtils::moveFromFile($fullPath, $syncKey, true, false, true);
}
$jobData = new kParseCaptionAssetJobData();
$jobData->setCaptionAssetId($captionAsset->getId());
$batchJob = null;
if ($parentJob) {
$batchJob = $parentJob->createChild();
} else {
$batchJob = new BatchJob();
$batchJob->setEntryId($captionAsset->getEntryId());
$batchJob->setPartnerId($captionAsset->getPartnerId());
}
return kJobsManager::addJob($batchJob, $jobData, CaptionSearchPlugin::getBatchJobTypeCoreValue(CaptionSearchBatchJobType::PARSE_CAPTION_ASSET));
}
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:36,代碼來源:kCaptionSearchFlowManager.php
示例6: addFileSyncImportJob
/**
* @param string $entryId
* @param FileSync $object
* @param int $fileSyncId
* @param string $sourceFileUrl
* @return BatchJob
*/
public static function addFileSyncImportJob($entryId, FileSync $fileSync, $sourceFileUrl, BatchJob $parentJob = null, $fileSize = null)
{
$partnerId = $fileSync->getPartnerId();
$fileSyncId = $fileSync->getId();
$dc = $fileSync->getDc();
KalturaLog::log(__METHOD__ . " entryId[{$entryId}], partnerId[{$partnerId}], fileSyncId[{$fileSyncId}], sourceFileUrl[{$sourceFileUrl}]");
$fileSyncImportData = new kFileSyncImportJobData();
$fileSyncImportData->setSourceUrl($sourceFileUrl);
$fileSyncImportData->setFilesyncId($fileSyncId);
$fileSyncImportData->setFileSize($fileSize);
// tmpFilePath and destFilePath will be set later during get exlusive call on the target data center
$batchJob = null;
if ($parentJob) {
$batchJob = $parentJob->createChild(BatchJobType::FILESYNC_IMPORT, null, true, $dc);
} else {
$batchJob = new BatchJob();
$batchJob->setDc($dc);
$batchJob->setEntryId($entryId);
$batchJob->setPartnerId($partnerId);
}
$batchJob->setObjectId($fileSyncId);
$batchJob->setObjectType(BatchJobObjectType::FILE_SYNC);
//In case file sync is of type data and holds flavor asset than we need to check if its the source asset that is being synced and raise it sync priority
if ($fileSync->getObjectType() == FileSyncObjectType::FLAVOR_ASSET && $fileSync->getObjectSubType() == entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA && $fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_FILE) {
$assetdb = assetPeer::retrieveById($fileSync->getObjectId());
if ($assetdb) {
$isSourceAsset = $assetdb->getIsOriginal();
if ($isSourceAsset) {
$fileSyncImportData->setIsSourceAsset(true);
}
}
}
KalturaLog::log("Creating Filesync Import job, with file sync id: {$fileSyncId} size: {$fileSize}");
return kJobsManager::addJob($batchJob, $fileSyncImportData, BatchJobType::FILESYNC_IMPORT);
}
示例7: 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;
}
示例8: onDistributionJobUpdated
/**
* @param BatchJob $dbBatchJob
* @param kDistributionJobData $data
* @param BatchJob $twinJob
* @return BatchJob
*/
public static function onDistributionJobUpdated(BatchJob $dbBatchJob, kDistributionJobData $data, BatchJob $twinJob = null)
{
switch ($dbBatchJob->getStatus()) {
case BatchJob::BATCHJOB_STATUS_ALMOST_DONE:
return self::onDistributionJobUpdatedAlmostDone($dbBatchJob, $data, $twinJob);
default:
return $dbBatchJob;
}
}
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:15,代碼來源:kYouTubeDistributionEventConsumer.php
示例9: updatedJob
public function updatedJob(BatchJob $dbBatchJob)
{
$data = $dbBatchJob->getData();
$providerData = $data->getProviderData();
$entryId = $providerData->getEntryId();
$partnerId = $dbBatchJob->getPartnerId();
$spokenLanguage = $providerData->getSpokenLanguage();
if ($dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_DONT_PROCESS) {
$transcript = $this->getAssetsByLanguage($entryId, array(TranscriptPlugin::getAssetTypeCoreValue(TranscriptAssetType::TRANSCRIPT)), $spokenLanguage, true);
if (!$transcript) {
$transcript = new TranscriptAsset();
$transcript->setType(TranscriptPlugin::getAssetTypeCoreValue(TranscriptAssetType::TRANSCRIPT));
$transcript->setEntryId($entryId);
$transcript->setPartnerId($partnerId);
$transcript->setLanguage($spokenLanguage);
$transcript->setContainerFormat(AttachmentType::TEXT);
$transcript->setAccuracy(self::DEFAULT_ACCURACY);
}
$transcript->setStatus(AttachmentAsset::ASSET_STATUS_QUEUED);
$transcript->save();
return true;
}
$formatsString = $providerData->getCaptionAssetFormats();
if ($dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FINISHED) {
$clientHelper = VoicebasePlugin::getClientHelper($providerData->getApiKey(), $providerData->getApiPassword());
$externalEntryExists = $clientHelper->checkExistingExternalContent($entryId);
if (!$externalEntryExists) {
KalturaLog::err('remote content does not exist');
return true;
}
$formatsArray = explode(',', $formatsString);
$formatsArray[] = "TXT";
$contentsArray = $clientHelper->getRemoteTranscripts($entryId, $formatsArray);
KalturaLog::debug('contents are - ' . print_r($contentsArray, true));
$transcript = $this->getAssetsByLanguage($entryId, array(TranscriptPlugin::getAssetTypeCoreValue(TranscriptAssetType::TRANSCRIPT)), $spokenLanguage, true);
$captions = $this->getAssetsByLanguage($entryId, array(CaptionPlugin::getAssetTypeCoreValue(CaptionAssetType::CAPTION)), $spokenLanguage);
$this->setObjectContent($transcript, $contentsArray["TXT"], null, true);
unset($contentsArray["TXT"]);
foreach ($contentsArray as $format => $content) {
$captionFormatConst = constant("KalturaCaptionType::" . $format);
if (isset($captions[$captionFormatConst])) {
$caption = $captions[$captionFormatConst];
} else {
$caption = new CaptionAsset();
$caption->setEntryId($entryId);
$caption->setPartnerId($partnerId);
$caption->setLanguage($spokenLanguage);
$caption->setContainerFormat($captionFormatConst);
$caption->setAccuracy(self::DEFAULT_ACCURACY);
$caption->setStatus(CaptionAsset::ASSET_STATUS_QUEUED);
$caption->save();
}
$this->setObjectContent($caption, $content, $format);
}
}
return true;
}
示例10: onDistributionJobUpdated
/**
* @param BatchJob $dbBatchJob
* @param kDistributionJobData $data
* @return BatchJob
*/
public static function onDistributionJobUpdated(BatchJob $dbBatchJob, kDistributionJobData $data)
{
switch ($dbBatchJob->getStatus()) {
case BatchJob::BATCHJOB_STATUS_FINISHED:
return self::onDistributionJobFinished($dbBatchJob, $data);
default:
return $dbBatchJob;
}
}
示例11: shouldConsumeJobStatusEvent
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob)
{
if ($dbBatchJob->getJobType() == BatchJobType::STORAGE_EXPORT && $dbBatchJob->getJobSubType() == KontikiPlugin::getStorageProfileProtocolCoreValue(KontikiStorageProfileProtocol::KONTIKI)) {
if (KontikiPlugin::isAllowedPartner($dbBatchJob->getPartnerId())) {
return true;
}
}
return false;
}
示例12: shouldConsumeJobStatusEvent
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob)
{
if ($dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FAILED) {
$parseMultiBatchJobType = CaptionPlugin::getBatchJobTypeCoreValue(ParseMultiLanguageCaptionAssetBatchType::PARSE_MULTI_LANGUAGE_CAPTION_ASSET);
if ($dbBatchJob->getJobType() == $parseMultiBatchJobType) {
return true;
}
}
return false;
}
示例13: updatedImport
protected function updatedImport(BatchJob $dbBatchJob, kDropFolderImportJobData $data, BatchJob $twinJob = null)
{
switch ($dbBatchJob->getStatus()) {
case BatchJob::BATCHJOB_STATUS_FINISHED:
return $this->updatedImportFinished($dbBatchJob, $data, $twinJob);
case BatchJob::BATCHJOB_STATUS_FAILED:
case BatchJob::BATCHJOB_STATUS_FATAL:
return $this->updatedImportFailed($dbBatchJob, $data, $twinJob);
default:
return $dbBatchJob;
}
}
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:12,代碼來源:kDropFolderEventsConsumer.php
示例14: shouldConsumeJobStatusEvent
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob)
{
if ($dbBatchJob->getJobType() != EventNotificationPlugin::getBatchJobTypeCoreValue(EventNotificationBatchType::EVENT_NOTIFICATION_HANDLER)) {
return false;
}
if ($dbBatchJob->getJobSubType() != BusinessProcessNotificationPlugin::getBusinessProcessNotificationTemplateTypeCoreValue(BusinessProcessNotificationTemplateType::BPM_START)) {
return false;
}
if ($dbBatchJob->getStatus() != BatchJob::BATCHJOB_STATUS_FINISHED) {
return false;
}
return true;
}
示例15: addFileSyncImportJob
/**
* @param string $entryId
* @param int $partnerId
* @param int $fileSyncId
* @param string $sourceFileUrl
* @return BatchJob
*/
public static function addFileSyncImportJob($entryId, $partnerId, $fileSyncId, $sourceFileUrl)
{
KalturaLog::log(__METHOD__ . " entryId[{$entryId}], partnerId[{$partnerId}], fileSyncId[{$fileSyncId}], sourceFileUrl[{$sourceFileUrl}]");
$fileSyncImportData = new kFileSyncImportJobData();
$fileSyncImportData->setSourceUrl($sourceFileUrl);
$fileSyncImportData->setFilesyncId($fileSyncId);
// tmpFilePath and destFilePath will be set later during get exlusive call on the target data center
$batchJob = new BatchJob();
$batchJob->setEntryId($entryId);
$batchJob->setPartnerId($partnerId);
KalturaLog::log("Creating Filesync Import job, with file sync id: {$fileSyncId}");
return kJobsManager::addJob($batchJob, $fileSyncImportData, BatchJobType::FILESYNC_IMPORT);
}