public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     // TODO -  verify permissions for viewing lists
     $detailed = $this->getP("detailed", false);
     $limit = $this->getP("page_size", 10);
     $page = $this->getP("page", 1);
     //$order_by = int( $this->getP ( "order_by" , -1 ) );
     $offset = ($page - 1) * $limit;
     $c = new Criteria();
     $download_types = array(BatchJobType::FLATTEN, BatchJobType::DOWNLOAD);
     $c->add(BatchJobPeer::JOB_TYPE, $download_types, Criteria::IN);
     // filter
     $filter = new BatchJobFilter(true);
     $fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null);
     $filter->attachToCriteria($c);
     //if ($order_by != -1) kshowPeer::setOrder( $c , $order_by );
     $count = BatchJobPeer::doCount($c);
     $offset = ($page - 1) * $limit;
     $c->setLimit($limit);
     if ($offset > 0) {
         $c->setOffset($offset);
     }
     $list = BatchJobPeer::doSelect($c);
     $level = objectWrapperBase::DETAIL_LEVEL_REGULAR;
     $this->addMsg("count", $count);
     $this->addMsg("page_size", $limit);
     $this->addMsg("page", $page);
     $wrapper = objectWrapperBase::getWrapperClass($list, $level);
     $this->addMsg("downloads", $wrapper);
 }
 /**
  * will return BatchJob objects.
  *
  * @param kExclusiveLockKey $lockKey
  * @param int $max_execution_time
  * @param int $number_of_objects
  * @param int $jobType
  * @param BatchJobFilter $filter
  */
 public static function getExclusiveJobs(kExclusiveLockKey $lockKey, $max_execution_time, $number_of_objects, $jobType, BatchJobFilter $filter)
 {
     $priority = kBatchManager::getNextJobPriority($jobType);
     $c = new Criteria();
     // added to support nfs delay
     if ($jobType == BatchJobType::EXTRACT_MEDIA || $jobType == BatchJobType::POSTCONVERT || $jobType == BatchJobType::STORAGE_EXPORT) {
         $c->add(BatchJobPeer::CREATED_AT, time() - 30, Criteria::LESS_THAN);
     }
     $c->add(BatchJobPeer::JOB_TYPE, $jobType);
     $c->add(BatchJobPeer::PRIORITY, $priority, Criteria::GREATER_EQUAL);
     $filter->attachToCriteria($c);
     $c->addAscendingOrderByColumn(BatchJobPeer::PRIORITY);
     $max_exe_attempts = BatchJobPeer::getMaxExecutionAttempts($jobType);
     return self::getExclusive($c, $lockKey, $max_execution_time, $number_of_objects, $max_exe_attempts);
 }
 /**
  * will return BatchJob objects.
  *
  * @param kExclusiveLockKey $lockKey
  * @param int $max_execution_time
  * @param int $number_of_objects
  * @param int $jobType
  * @param BatchJobFilter $filter
  * @param int $maxOffset
  */
 public static function getExclusiveJobs(kExclusiveLockKey $lockKey, $max_execution_time, $number_of_objects, $jobType, BatchJobFilter $filter, $maxOffset = null)
 {
     $c = new Criteria();
     $filter->attachToCriteria($c);
     return self::getExclusive($c, $lockKey, $max_execution_time, $number_of_objects, $jobType, $maxOffset);
 }
Example #4
0
 public static function getExclusiveAlmostDoneJobs(kExclusiveLockKey $lockKey, $maxExecutionTime, $numberOfJobs, $jobType, BatchJobFilter $filter)
 {
     $c = new Criteria();
     $filter->attachToCriteria($c);
     return kBatchExclusiveLock::getExclusiveAlmostDone($c, $lockKey, $maxExecutionTime, $numberOfJobs, $jobType);
 }