public function save(PropelPDO $con = null) { KalturaLog::log("BatchJob [{$this->getJobType()}][{$this->getJobSubType()}]: save()"); $is_new = $this->isNew(); if ($this->isNew()) { $this->setDc(kDataCenterMgr::getCurrentDcId()); // if the status not set upon creation if (is_null($this->status) || !$this->isColumnModified(BatchJobPeer::STATUS)) { //echo "sets the status to " . self::BATCHJOB_STATUS_PENDING . "\n"; $this->setStatus(self::BATCHJOB_STATUS_PENDING); } } $res = parent::save($con); if ($is_new && !$this->root_job_id && $this->id) { // set the root to point to itself $this->setRootJobId($this->id); $res = parent::save($con); } /* * remove - no need to use file indicators any more // when new object or status is pending - add the indicator for the batch job to start running if ( $is_new || ( $this->getStatus() == self::BATCHJOB_STATUS_PENDING ) ) { self::addIndicator( $this->getId() , $this->getJobType() ); KalturaLog::log ( "BatchJob: Added indicator for BatchJob [" . $this->getId() . "] of type [{$this->getJobType() }]" ); //debugUtils::st(); } else { KalturaLog::log ( "BatchJob: Didn't add an indicator for BatchJob [" . $this->getId() . "]" ); } */ return $res; }
public function postInsert(PropelPDO $con = null) { if (!$this->root_job_id && $this->id || $this->useNewRoot) { // set the root to point to itself $this->setRootJobId($this->id); $res = parent::save($con); } if (BatchJobLockPeer::shouldCreateLockObject($this, true, $con)) { BatchJobLockPeer::createLockObject($this); } return parent::postInsert($con); }
public function save(PropelPDO $con = null) { KalturaLog::log("BatchJob [{$this->getJobType()}][{$this->getJobSubType()}]: save()"); $is_new = $this->isNew(); if ($this->isNew()) { // set the dc ONLY if it wasnt initialized // this is required in the special case of file_sync import jobs which are created on one dc but run from the other // all other jobs run from the same datacenter they were created on. // setting the dc later results in a race condition were the job is picked up by the current datacenter before the dc value is changed if (is_null($this->dc) || !$this->isColumnModified(BatchJobPeer::DC)) { // by default set the dc to the current data center. However whenever a batch job is operating on an entry, we rather run it // in the DC where the file sync of the entry exists. Since the batch job doesnt refer to a flavor (we only have an entry id member) // we check the file sync of the source flavor asset (if one exists) $dc = kDataCenterMgr::getCurrentDcId(); kalturaLog::debug("setting the job's DC to [{$dc}]"); $this->setDc($dc); } // if the status not set upon creation if (is_null($this->status) || !$this->isColumnModified(BatchJobPeer::STATUS)) { //echo "sets the status to " . self::BATCHJOB_STATUS_PENDING . "\n"; $this->setStatus(self::BATCHJOB_STATUS_PENDING); } } $result = array_intersect(self::$LOCK_VERSION_AFFECTED_BY_COLUMNS_NAMES, $this->getModifiedColumns()); if (count($result) > 0) { $this->setLockVersion($this->getLockVersion() + 1); } $res = parent::save($con); if ($is_new && !$this->root_job_id && $this->id || $this->useNewRoot) { // set the root to point to itself $this->setRootJobId($this->id); $res = parent::save($con); } /* * remove - no need to use file indicators any more // when new object or status is pending - add the indicator for the batch job to start running if ( $is_new || ( $this->getStatus() == self::BATCHJOB_STATUS_PENDING ) ) { self::addIndicator( $this->getId() , $this->getJobType() ); KalturaLog::log ( "BatchJob: Added indicator for BatchJob [" . $this->getId() . "] of type [{$this->getJobType() }]" ); //debugUtils::st(); } else { KalturaLog::log ( "BatchJob: Didn't add an indicator for BatchJob [" . $this->getId() . "]" ); } */ return $res; }