當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BatchJobPeer::retrieveByPKs方法代碼示例

本文整理匯總了PHP中BatchJobPeer::retrieveByPKs方法的典型用法代碼示例。如果您正苦於以下問題:PHP BatchJobPeer::retrieveByPKs方法的具體用法?PHP BatchJobPeer::retrieveByPKs怎麽用?PHP BatchJobPeer::retrieveByPKs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BatchJobPeer的用法示例。


在下文中一共展示了BatchJobPeer::retrieveByPKs方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getExpiredJobs

 public static function getExpiredJobs()
 {
     $jobTypes = kPluginableEnumsManager::coreValues('BatchJobType');
     $executionAttempts2jobTypes = array();
     // Map between max execution attempts and job types
     foreach ($jobTypes as $jobType) {
         $executionAttempts = BatchJobLockPeer::getMaxExecutionAttempts($jobType);
         if (array_key_exists($executionAttempts, $executionAttempts2jobTypes)) {
             $executionAttempts2jobTypes[$executionAttempts][] = $jobType;
         } else {
             $executionAttempts2jobTypes[$executionAttempts] = array($jobType);
         }
     }
     // create query
     $c = new Criteria();
     $c->add(BatchJobLockPeer::STATUS, BatchJob::BATCHJOB_STATUS_FATAL, Criteria::NOT_EQUAL);
     $c->add(BatchJobLockPeer::DC, kDataCenterMgr::getCurrentDcId());
     // each DC should clean its own jobs
     // Query for each job type
     $batchJobLocks = array();
     foreach ($executionAttempts2jobTypes as $execAttempts => $jobTypes) {
         $typedCrit = clone $c;
         $typedCrit->add(BatchJobLockPeer::EXECUTION_ATTEMPTS, $execAttempts, Criteria::GREATER_THAN);
         $typedCrit->add(BatchJobLockPeer::JOB_TYPE, $jobTypes, Criteria::IN);
         $typedJobs = BatchJobLockPeer::doSelect($typedCrit, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
         foreach ($typedJobs as $typedJob) {
             $batchJobLocks[$typedJob->getId()] = $typedJob;
         }
     }
     // get matching batch jobs
     return BatchJobPeer::retrieveByPKs(array_keys($batchJobLocks));
 }
開發者ID:DBezemer,項目名稱:server,代碼行數:32,代碼來源:kBatchExclusiveLock.class.php

示例2: postLockUpdate

 public static function postLockUpdate(kExclusiveLockKey $lockKey, array $exclusive_objects_ids, $con)
 {
     $batchJobs = BatchJobPeer::retrieveByPKs($exclusive_objects_ids);
     foreach ($batchJobs as $batchJob) {
         /* @var $batchJob BatchJob */
         // Set history
         $uniqueId = new UniqueId();
         $historyRecord = new kBatchHistoryData();
         $historyRecord->setWorkerId($lockKey->getWorkerId());
         $historyRecord->setSchedulerId($lockKey->getSchedulerId());
         $historyRecord->setBatchIndex($lockKey->getBatchIndex());
         $historyRecord->setHostName(isset($_SERVER["HOSTNAME"]) ? $_SERVER["HOSTNAME"] : gethostname());
         $historyRecord->setSessionId((string) $uniqueId);
         $batchJob->addHistoryRecord($historyRecord);
         // Set fields
         $batchJob->setLastWorkerId($lockKey->getWorkerId());
         $batchJob->setLastSchedulerId($lockKey->getSchedulerId());
         // Set fields from batch job lock
         $lockInfo = $batchJob->getLockInfo();
         $lockInfo->setLockVersion($lockInfo->getLockVersion() + 1);
         $batchJob->setLockInfo($lockInfo);
         $batchJob->save($con);
     }
     return $batchJobs;
 }
開發者ID:DBezemer,項目名稱:server,代碼行數:25,代碼來源:BatchJobPeer.php


注:本文中的BatchJobPeer::retrieveByPKs方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。