List all SQS Queues.
340328
def list_sqs(region, filter_by_kwargs):
    """"""
    conn = boto.sqs.connect_to_region(region)
    queues = conn.get_all_queues()
    return lookup(queues, filter_by=filter_by_kwargs)
912985
def list_(prefix='', region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    def extract_name(queue_url):
        # Note: this logic taken from boto, so should be safe
        return _urlparse(queue_url).path.split('/')[2]

    try:
        r = conn.list_queues(QueueNamePrefix=prefix)
        # The 'QueueUrls' attribute is missing if there are no queues
        urls = r.get('QueueUrls', [])
        return {'result': [extract_name(url) for url in urls]}
    except botocore.exceptions.ClientError as e:
        return {'error': __utils__['boto3.get_error'](e)}
28224
def _view_dequeue(self, queue_type):
        """"""
        response = {
            'status': 'failure'
        }

        request_data = {
            'queue_type': queue_type
        }
        try:
            response = self.sq.dequeue(**request_data)
            if response['status'] == 'failure':
                return jsonify(**response), 404
        except Exception, e:
            response['message'] = e.message
            return jsonify(**response), 400

        return jsonify(**response)
1317157
def _all_queue_names(self):
        
        queues = set()
        endpoints = self.config.get('endpoints')
        for e in endpoints:
            for q in endpoints[e]['queues']:
                queues.add(q)
        return sorted(queues)
461784
public function index() {
		$this->loadModel('Queue.QueueProcesses');
		$status = $this->QueueProcesses->status();

		$current = $this->QueuedJobs->getLength();
		$pendingDetails = $this->QueuedJobs->getPendingStats();
		$new = 0;
		foreach ($pendingDetails as $pendingDetail) {
			if ($pendingDetail['fetched'] || $pendingDetail['failed']) {
				continue;
			}
			$new++;
		}

		$data = $this->QueuedJobs->getStats();

		$taskFinder = new TaskFinder();
		$tasks = $taskFinder->allAppAndPluginTasks();

		$servers = $this->QueueProcesses->find()->distinct(['server'])->find('list', ['keyField' => 'server', 'valueField' => 'server'])->toArray();
		$this->set(compact('new', 'current', 'data', 'pendingDetails', 'status', 'tasks', 'servers'));
		$this->helpers[] = 'Tools.Format';
		$this->helpers[] = 'Tools.Time';
		$this->helpers[] = 'Tools.Text';
	}
1095609
def _view_clear_queue(self, queue_type, queue_id):
        """"""
        response = {
            'status': 'failure'
        }
        try:
            request_data = json.loads(request.data)
        except Exception, e:
            response['message'] = e.message
            return jsonify(**response), 400
        
        request_data.update({
            'queue_type': queue_type,
            'queue_id': queue_id
        })
        try:
            response = self.sq.clear_queue(**request_data)
        except Exception, e:
            response['message'] = e.message
            return jsonify(**response), 400

        return jsonify(**response)
730517
def poll(self):
        """"""
        queue_empty = self.server.get_queue_empty_exception()
        try:
            packets = [self.queue.get(timeout=self.server.ping_timeout)]
            self.queue.task_done()
        except queue_empty:
            raise exceptions.QueueEmpty()
        if packets == [None]:
            return []
        while True:
            try:
                packets.append(self.queue.get(block=False))
                self.queue.task_done()
            except queue_empty:
                break
        return packets
101227
public function getQueues()
    {
        // Format the output to suit
        $queues = [];
        foreach ($this->queue->getQueues() as $queue) {
            $queues[] = $queue->name;
        }
        return $queues;
    }
1060887
def do_list_queue(self, line):
        

        def f(p, args):
            o = p.get()
            if o.resources.queue:
                for q in o.resources.queue:
                    print('%s %s' % (q.resource_id, q.port))

        self._request(line, f)
124356
def view_all_work_queues():
    """"""
    count_list = list(
        db.session.query(
            work_queue.WorkQueue.queue_name,
            work_queue.WorkQueue.status,
            func.count(work_queue.WorkQueue.task_id))
        .group_by(work_queue.WorkQueue.queue_name,
                  work_queue.WorkQueue.status))

    queue_dict = {}
    for name, status, count in count_list:
        queue_dict[(name, status)] = dict(
            name=name, status=status, count=count)

    max_created_list = list(
        db.session.query(
            work_queue.WorkQueue.queue_name,
            work_queue.WorkQueue.status,
            func.max(work_queue.WorkQueue.created))
        .group_by(work_queue.WorkQueue.queue_name,
                  work_queue.WorkQueue.status))

    for name, status, newest_created in max_created_list:
        queue_dict[(name, status)]['newest_created'] = newest_created

    min_eta_list = list(
        db.session.query(
            work_queue.WorkQueue.queue_name,
            work_queue.WorkQueue.status,
            func.min(work_queue.WorkQueue.eta))
        .group_by(work_queue.WorkQueue.queue_name,
                  work_queue.WorkQueue.status))

    for name, status, oldest_eta in min_eta_list:
        queue_dict[(name, status)]['oldest_eta'] = oldest_eta

    queue_list = list(queue_dict.values())
    queue_list.sort(key=lambda x: (x['name'], x['status']))

    context = dict(
        queue_list=queue_list,
    )
    return render_template('view_work_queue_index.html', **context)
1146073
def get_all_queues(self, prefix=''):
        
        params = {}
        if prefix:
            params['QueueNamePrefix'] = prefix
        return self.get_list('ListQueues', params, [('QueueUrl', Queue)])
785030
def pop_all_queues(self):
        
        output = []
        with self.lock:
            for q in self.queue:
                output.extend(list(q.queue))
                q.queue.clear()

        return output
221477
def queues():
    """"""
    conn = worker.connection
    failure_q = None

    def _repr(q):
        return "running:%d pending:%d finished:%d" % (
            StartedJobRegistry(q.name, conn).count,
            q.count,
            FinishedJobRegistry(q.name, conn).count)
    for q in Queue.all(conn):
        if q.name == 'failed':
            failure_q = q
            continue
        click.echo("%s %s" % (q.name, _repr(q)))
    if failure_q:
        click.echo(
            click.style(failure_q.name, fg='red') + ' %s' % _repr(failure_q))
383392
function listAllServers(next) {
        var limit = 1000;
        var offset = 0;
        var allServers = [];
        var firstReq;
        var firstRes;

        var listPageOfServers = function () {
            if (limit !== null) {
                reqOpts.query.limit = limit;
            }
            reqOpts.query.offset = offset;

            self.get(reqOpts, function (err, servers, req, res) {
                if (err) {
                    next(err, null, req, res);
                    return;
                }

                if (!firstReq) {
                    firstReq = req;
                    firstRes = res;
                }

                allServers = allServers.concat(servers);

                if (servers.length < limit) { // Done paging.
                    // For backwards compat, we return the *first* req/res.
                    next(null, allServers, firstReq, firstRes);
                } else {
                    // Need to fetch another page of servers.
                    offset += servers.length;
                    listPageOfServers();
                }
            });
        };

        listPageOfServers();
    }
1281911
def get_queue_url(queue_name):
    """"""
    client = boto3.client("sqs", CURRENT_REGION)
    queue = client.get_queue_url(QueueName=queue_name)

    return queue["QueueUrl"]
98602
def sqs(self):
        
        if self.__sqs is None:
            self.__sqs = self.__aws_connect(sqs)
        return self.__sqs
548721
def queue(self):
        """"""
        if not self.include_rq:
            return None
        ctx = stack.top
        if ctx is not None:
            if not hasattr(ctx, 'redislite_queue'):
                ctx.redislite_queue = {}

                for queue_name in self.queues:
                    ctx.redislite_queue[queue_name] = \
                        Queue(queue_name, connection=self.connection)

            return ctx.redislite_queue