本文整理汇总了PHP中BatchJob::setJobSubType方法的典型用法代码示例。如果您正苦于以下问题:PHP BatchJob::setJobSubType方法的具体用法?PHP BatchJob::setJobSubType怎么用?PHP BatchJob::setJobSubType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BatchJob
的用法示例。
在下文中一共展示了BatchJob::setJobSubType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createChild
/**
* The type and the sub-type are constant in the batch job, therefore they must be proveided
* when a new batch job is generated.
* @return BatchJob
*/
public function createChild($type, $subType = null, $same_root = true, $dc = null)
{
$child = new BatchJob();
$child->setJobType($type);
if ($subType !== null) {
$child->setJobSubType($subType);
}
$child->setParentJobId($this->id);
$child->setPartnerId($this->partner_id);
$child->setEntryId($this->entry_id);
$child->setBulkJobId($this->bulk_job_id);
// the condition is required in the special case of file_sync import jobs which are created on one dc but run from the other
$child->setDc($dc === null ? $this->dc : $dc);
if ($same_root && $this->root_job_id) {
$child->setRootJobId($this->root_job_id);
} else {
$child->setRootJobId($this->id);
}
return $child;
}
示例2: addBulkUploadJob
/**
* Function adds bulk upload job to the queue
* @param Partner $partner
* @param kBulkUploadJobData $jobData
* @param string $bulkUploadType
* @throws APIException
* @return BatchJob
*/
public static function addBulkUploadJob(Partner $partner, kBulkUploadJobData $jobData, $bulkUploadType = null)
{
$job = new BatchJob();
$job->setPartnerId($partner->getId());
$job->setJobType(BatchJobType::BULKUPLOAD);
$job->setJobSubType($bulkUploadType);
$job->save();
$syncKey = $job->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOAD);
// kFileSyncUtils::file_put_contents($syncKey, file_get_contents($csvFileData["tmp_name"]));
try {
kFileSyncUtils::moveFromFile($jobData->getFilePath(), $syncKey, true);
} catch (Exception $e) {
throw new APIException(APIErrors::BULK_UPLOAD_CREATE_CSV_FILE_SYNC_ERROR);
}
$filePath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
if (is_null($jobData)) {
throw new APIException(APIErrors::BULK_UPLOAD_BULK_UPLOAD_TYPE_NOT_VALID, $bulkUploadType);
}
if (!$jobData->getBulkUploadObjectType()) {
$jobData->setBulkUploadObjectType(BulkUploadObjectType::ENTRY);
}
$jobData->setFilePath($filePath);
if ($jobData->getBulkUploadObjectType() == BulkUploadObjectType::ENTRY && !$jobData->getObjectData()->getConversionProfileId()) {
$jobData->setConversionProfileId($partner->getDefaultConversionProfileId());
$kmcVersion = $partner->getKmcVersion();
$check = null;
if ($kmcVersion < 2) {
$check = ConversionProfilePeer::retrieveByPK($jobData->getConversionProfileId());
} else {
$check = conversionProfile2Peer::retrieveByPK($jobData->getConversionProfileId());
}
if (!$check) {
throw new APIException(APIErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $jobData->getConversionProfileId());
}
}
return kJobsManager::addJob($job, $jobData, BatchJobType::BULKUPLOAD, kPluginableEnumsManager::apiToCore("BulkUploadType", $bulkUploadType));
}
示例3: addExportLiveReportJob
public static function addExportLiveReportJob($reportType, KalturaLiveReportExportParams $params)
{
KalturaLog::debug("adding Export Live Report job");
// Calculate time offset from server time to UTC
$dateTimeZoneServer = new DateTimeZone(kConf::get('date_default_timezone'));
$dateTimeZoneUTC = new DateTimeZone("UTC");
$dateTimeUTC = new DateTime("now", $dateTimeZoneUTC);
$timeOffsetSeconds = -1 * $dateTimeZoneServer->getOffset($dateTimeUTC);
// Create job data
$jobData = new kLiveReportExportJobData();
$jobData->entryIds = $params->entryIds;
$jobData->recipientEmail = $params->recpientEmail;
$jobData->timeZoneOffset = $timeOffsetSeconds - $params->timeZoneOffset * 60;
// Convert minutes to seconds
$jobData->timeReference = time();
$jobData->applicationUrlTemplate = $params->applicationUrlTemplate;
$job = new BatchJob();
$job->setPartnerId(kCurrentContext::getCurrentPartnerId());
$job->setJobType(BatchJobType::LIVE_REPORT_EXPORT);
$job->setJobSubType($reportType);
$job->setData($jobData);
return self::addJob($job, $jobData, BatchJobType::LIVE_REPORT_EXPORT, $reportType);
}
示例4: addJob
/**
* @param BatchJob $batchJob
* @param $data
* @param int $type
* @param int $subType
* @return BatchJob
*/
public static function addJob(BatchJob $batchJob, $data, $type, $subType = null)
{
$batchJob->setJobType($type);
$batchJob->setJobSubType($subType);
$batchJob->setData($data);
if (!$batchJob->getParentJobId() && $batchJob->getEntryId()) {
$entry = entryPeer::retrieveByPKNoFilter($batchJob->getEntryId());
// some jobs could be on deleted entry
$batchJob->setRootJobId($entry->getBulkUploadId());
$batchJob->setBulkJobId($entry->getBulkUploadId());
}
// validate partner id
$partnerId = $batchJob->getPartnerId();
// if(!$partnerId)
// throw new APIException(APIErrors::PARTNER_NOT_SET);
// validate that partner exists
$partner = PartnerPeer::retrieveByPK($partnerId);
if (!$partner) {
KalturaLog::err("Invalid partner id [{$partnerId}]");
throw new APIException(APIErrors::INVALID_PARTNER_ID, $partnerId);
}
// set the priority and work group
$batchJob->setPriority($partner->getPriority($batchJob->getBulkJobId()));
$batchJob = self::updateBatchJob($batchJob, BatchJob::BATCHJOB_STATUS_PENDING);
// look for identical jobs
$twinJobs = BatchJobPeer::retrieveDuplicated($type, $data);
$twinJob = null;
if (count($twinJobs)) {
foreach ($twinJobs as $currentTwinJob) {
if ($currentTwinJob->getId() != $batchJob->getId()) {
$twinJob = reset($twinJobs);
}
}
}
if (!is_null($twinJob)) {
$batchJob->setTwinJobId($twinJob->getId());
if (!kConf::get("batch_ignore_duplication")) {
$batchJob = self::updateBatchJob($batchJob, $twinJob->getStatus(), $twinJob);
} else {
$batchJob->save();
}
}
return $batchJob;
}