当前位置: 首页>>代码示例>>PHP>>正文


PHP Resque::queues方法代码示例

本文整理汇总了PHP中Resque::queues方法的典型用法代码示例。如果您正苦于以下问题:PHP Resque::queues方法的具体用法?PHP Resque::queues怎么用?PHP Resque::queues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Resque的用法示例。


在下文中一共展示了Resque::queues方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: restIndexQueue

 public function restIndexQueue()
 {
     $config = Api::_()->getConfig();
     $defaultQueues = $config['queue']['default_queues'];
     $queues = array_merge($defaultQueues, \Resque::queues());
     $queues = array_unique($queues);
     foreach ($queues as $key => $queue) {
         $queues[$key] = array('name' => $queue, 'size' => \Resque::size($queue));
     }
     $pslist = $this->getSystemProcessList('ps ux | grep "php ' . realpath(EVA_ROOT_PATH . '/workers') . '" | grep -v grep');
     foreach ($queues as $key => $queue) {
         $workerCount = 0;
         foreach ($pslist as $psKey => $ps) {
             $offset = strlen($ps['COMMAND']) - strlen($queue['name']);
             if ($offset === strrpos($ps['COMMAND'], $queue['name'])) {
                 $workerCount++;
                 unset($pslist[$psKey]);
             }
         }
         $queues[$key]['workers'] = $workerCount;
     }
     $publicWorkerCount = count($pslist);
     $return = array('items' => $queues, 'publicWorkerCount' => $publicWorkerCount);
     if ($this->params()->fromQuery('format') == 'json') {
         $this->changeViewModel('json');
         return new JsonModel($return);
     }
     return $return;
 }
开发者ID:ahyswang,项目名称:eva-engine,代码行数:29,代码来源:QueueController.php

示例2: getQueues

 /**
  * @return ArrayList
  */
 protected function getQueues()
 {
     $queues = Resque::queues();
     $queueList = new ArrayList();
     foreach ($queues as $idx => $queue) {
         $queueList->push(new ResqueQueue(array('ID' => $idx + 1, 'Name' => $queue, 'Size' => Resque::size($queue))));
     }
     return $queueList;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-deploynaut,代码行数:12,代码来源:ResqueReport.php

示例3: getJobs

 /**
  * Get jobs for the given queue.
  * 
  * @param string $queue The name of the queue or "*" for all queues
  *
  * @return array|\Resque_Job[]
  */
 public function getJobs($queue = null)
 {
     if (!$queue || $queue === '*') {
         $queues = \Resque::queues();
         $jobs = array();
         foreach ($queues as $queue) {
             $jobs = array_merge($jobs, $this->getJobs($queue));
         }
         return $jobs;
     }
     return array_map(function ($job) use($queue) {
         return new \Resque_Job($queue, json_decode($job, true));
     }, \Resque::redis()->lrange('queue:' . $queue, 0, -1));
 }
开发者ID:Barbarrosa,项目名称:packages,代码行数:21,代码来源:ResqueHelper.php

示例4: jobs

 public function jobs(Request $request, Response $response, array $args)
 {
     $settings = loadsettings();
     $REDIS_BACKEND = $settings['resque']['REDIS_BACKEND'];
     if (!empty($REDIS_BACKEND)) {
         \Resque::setBackend($REDIS_BACKEND);
     }
     $queues = [];
     $queuenames = \Resque::queues();
     sort($queuenames);
     foreach ($queuenames as $queue) {
         $size = \Resque::size($queue);
         $queues[] = ['name' => $queue, 'size' => $size, 'jobs' => $this->peek($queue)];
     }
     $data['queues'] = $queues;
     $this->view->render($response, 'queues.twig', $data);
     return $response;
 }
开发者ID:neilmillard,项目名称:fxtrader,代码行数:18,代码来源:QueuesAction.php

示例5: actionQueues

 public function actionQueues()
 {
     $redisQueues = [];
     $queues = \Resque::queues();
     $redis = $this->getRedis();
     // $queues = $redis->lrange('queue:default', 0,-1);
     if ($queues) {
         foreach ($queues as $queue) {
             $key = 'queue:' . $queue;
             $redisQueues[$queue] = $redis->lrange($key, 0, -1);
         }
         foreach ($redisQueues as $queue => $redisQueue) {
             foreach ($redisQueue as $index => $que) {
                 $redisQueues[$queue][$index] = json_decode($que, true);
             }
         }
     }
     return $this->render('queues', ['queues' => $redisQueues]);
 }
开发者ID:songhongyu,项目名称:datecenter,代码行数:19,代码来源:QueueController.php

示例6: date_default_timezone_set

<?php

/**
 * Created by PhpStorm.
 * User: viniciusthiengo
 * Date: 7/23/15
 * Time: 10:50 AM
 */
require '../vendor/autoload.php';
require 'EchoData.php';
//include
date_default_timezone_set('GMT');
Resque::setBackend('127.0.0.1:6379');
$args = array('name' => 'Thiengo');
$jobId = Resque::enqueue('default', 'EchoData', $args, true);
echo "Queued job " . $jobId . "<br><br>";
$status = new Resque_Job_Status($jobId);
if (!$status->isTracking()) {
    die("Resque is not tracking the status of this job.\n");
}
echo $status . '<br><br>';
$jobId = Resque::enqueue('cms26', 'EchoData2', $args);
//exec('echo "create-file.php" | atnow');
//exec('php "create-file.php" | atnow');
echo 'file has being created <br><br>';
//Resque::pop('notification');
echo Resque::size('default');
print_r(Resque::queues());
开发者ID:viniciusthiengo,项目名称:modern-php-book,代码行数:28,代码来源:example_call_exec.php

示例7: RedisUnavailable

 /**
  * Returns an error message if redis is unavailable
  *
  * @return string
  */
 public static function RedisUnavailable()
 {
     try {
         Resque::queues();
     } catch (Exception $e) {
         return $e->getMessage();
     }
     return '';
 }
开发者ID:udomsak,项目名称:deploynaut,代码行数:14,代码来源:DNRoot.php

示例8: testJobWithNamespace

 public function testJobWithNamespace()
 {
     Resque::setBackend(REDIS_HOST, REDIS_DATABASE, 'php');
     $queue = 'jobs';
     $payload = array('another_value');
     Resque::enqueue($queue, 'Test_Job_With_TearDown', $payload);
     $this->assertEquals(Resque::queues(), array('jobs'));
     $this->assertEquals(Resque::size($queue), 1);
     Resque::setBackend(REDIS_HOST, REDIS_DATABASE, REDIS_NAMESPACE);
     $this->assertEquals(Resque::size($queue), 0);
 }
开发者ID:misterniall,项目名称:php-resque-ex,代码行数:11,代码来源:JobTest.php

示例9: queues

 /**
  * Return an array containing all of the queues that this worker should use
  * when searching for jobs.
  *
  * If * is found in the list of queues, every queue will be searched in
  * alphabetic order. (@see $fetch)
  *
  * @param boolean $fetch If true, and the queue is set to *, will fetch
  * all queue names from redis.
  * @return array Array of associated queues.
  */
 public function queues($fetch = true)
 {
     if (!in_array('*', $this->queues) || $fetch == false) {
         return $this->queues;
     }
     $queues = Resque::queues();
     sort($queues);
     return $queues;
 }
开发者ID:realestateconz,项目名称:php-resque,代码行数:20,代码来源:Worker.php

示例10: testJobWithNamespace

 public function testJobWithNamespace()
 {
     Resque_Redis::prefix('php');
     $queue = 'jobs';
     $payload = array('another_value');
     Resque::enqueue($queue, 'Test_Job_With_TearDown', $payload);
     $this->assertEquals(Resque::queues(), array('jobs'));
     $this->assertEquals(Resque::size($queue), 1);
     Resque_Redis::prefix('resque');
     $this->assertEquals(Resque::size($queue), 0);
 }
开发者ID:fahmiardi,项目名称:php-resque,代码行数:11,代码来源:JobTest.php

示例11: getQueues

 public function getQueues()
 {
     return \array_map(function ($queue) {
         return new Queue($queue);
     }, \Resque::queues());
 }
开发者ID:rosstuck,项目名称:BCCResqueBundle,代码行数:6,代码来源:Resque.php

示例12: getQueues

 /**
  * Get the queues's names.
  *
  * @return array Array containing the queues' names.
  * @see CakeResqueShell::clear()
  * @see CakeResqueShell::stats()
  * @codeCoverageIgnore
  */
 public static function getQueues()
 {
     return Resque::queues();
 }
开发者ID:rchavik,项目名称:Cake-Resque,代码行数:12,代码来源:CakeResque.php

示例13: queues

 /**
  * Return an array containing all of the queues that this worker should use
  * when searching for jobs.
  *
  * If * is found in the list of queues, every queue will be searched in
  * alphabetic order. (@see $fetch)
  *
  * @param boolean $fetch If true, and the queue is set to *, will fetch
  * all queue names from redis.
  * @return array Array of associated queues.
  */
 public function queues($fetch = true)
 {
     if ($fetch == false) {
         return $this->queues;
     }
     $user_queues = implode('|', $this->queues);
     if (strpos($user_queues, '*') === FALSE) {
         return $this->queues;
     }
     $queues = Resque::queues();
     sort($queues);
     if (in_array('*', $this->queues)) {
         return $queues;
     }
     $matching_queues = [];
     $user_queues_regexp = [];
     foreach ($this->queues as $queue) {
         if (strpos($queue, '*') === FALSE) {
             $matching_queues[] = $queue;
         } else {
             foreach ($queues as $rqueue) {
                 if (fnmatch($queue, $rqueue)) {
                     $matching_queues[] = $rqueue;
                 }
             }
         }
     }
     return $matching_queues;
 }
开发者ID:ahfeel,项目名称:php-resque,代码行数:40,代码来源:Worker.php


注:本文中的Resque::queues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。