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; }
/** * The function fills the batch job log to contain all the information the * current batch job contains in it. */ public function copyIntoBatchLog(BatchJobLog $copyObj) { // Batch Job Fields $copyObj->setJobType($this->job_type); $copyObj->setJobSubType($this->job_sub_type); $copyObj->setData($this->data); $copyObj->setStatus($this->status); $copyObj->setAbort($this->execution_status == BatchJobExecutionStatus::ABORTED); $copyObj->setMessage($this->message); $copyObj->setDescription($this->description); $copyObj->setCreatedAt($this->created_at); $copyObj->setUpdatedAt($this->updated_at); $copyObj->setPriority($this->priority); $copyObj->setQueueTime($this->queue_time); $copyObj->setFinishTime($this->finish_time); $copyObj->setEntryId($this->entry_id); $copyObj->setPartnerId($this->partner_id); $copyObj->setLastSchedulerId($this->last_scheduler_id); $copyObj->setLastWorkerId($this->last_worker_id); $copyObj->setBulkJobId($this->bulk_job_id); $copyObj->setRootJobId($this->root_job_id); $copyObj->setParentJobId($this->parent_job_id); $copyObj->setDc($this->dc); $copyObj->setErrType($this->err_type); $copyObj->setErrNumber($this->err_number); // Batch job lock info if ($this->getLockInfo() != null) { $copyObj->setFileSize($this->getLockInfo()->getEstimatedEffort()); $copyObj->setLockVersion($this->getLockInfo()->getLockVersion()); } // Batch job lock fields $dbBatchJobLock = $this->getBatchJobLock(); if ($dbBatchJobLock !== null) { $copyObj->setProcessorExpiration($dbBatchJobLock->getExpiration()); $copyObj->setExecutionAttempts($dbBatchJobLock->getExecutionAttempts()); $copyObj->setCheckAgainTimeout($dbBatchJobLock->getStartAt()); $copyObj->setSchedulerId($dbBatchJobLock->getSchedulerId()); $copyObj->setWorkerId($dbBatchJobLock->getWorkerId()); $copyObj->setBatchIndex($dbBatchJobLock->getBatchIndex()); } $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value }