Fetches information of a certain queue.
15525
def show_qos_queue(self, queue, **_params):
        """"""
        return self.get(self.qos_queue_path % (queue),
                        params=_params)
1233516
def get_queue_attributes(queue_url, attributes = ["All"])
      attributes = attributes.map(&:to_s)

      query = Hash[*attributes.each_with_index.map do |attribute, index|
        ["AttributeName.#{index+1}", attribute]
      end.flatten]

      action("GetQueueAttributes", queue_url, query)
    end
1154932
def get_jobs_from_queue(self, queue: str, max_jobs: int) -> List[Job]:
        """"""
        rv = list()
        while len(rv) < max_jobs:
            try:
                job_json_string = self._get_queue(queue).get(block=False)
            except Empty:
                break

            job = Job.deserialize(job_json_string)
            job.status = JobStatus.RUNNING
            rv.append(job)

        return rv
584349
def _get (self, timeout):
        """"""
        if timeout is None:
            while self._empty():
                self.not_empty.wait()
        else:
            if timeout < 0:
                raise ValueError("'timeout' must be a positive number")
            endtime = _time() + timeout
            while self._empty():
                remaining = endtime - _time()
                if remaining <= 0.0:
                    raise Empty()
                self.not_empty.wait(remaining)
        self.in_progress += 1
        return self.queue.popleft()
1254500
def requeue(self, queue=None, retry_count=0):
        

        if not queue:
            if not self.data or not self.data.get("queue"):
                self.fetch(full_data={"_id": 0, "queue": 1, "path": 1})
            queue = self.data["queue"]

        self._save_status("queued", updates={
            "queue": queue,
            "datequeued": datetime.datetime.utcnow(),
            "retry_count": retry_count
        })
54314
def get(self, queue_get):
        
        for (c, cs) in izip(self.consumers, queue_get):
            c.get(cs)
        self.result = [c.result for c in self.consumers]
523389
def fetch(self):
        """"""
        start = datetime.now()
        r = requests.get(self._url(), auth=(self.key, ""))
        self._delay_for_ratelimits(start)

        if r.status_code not in self.TRUTHY_CODES:
            return self._handle_request_exception(r)

        response = r.json()
        if self.ENVELOPE:
            self.data = response.get(self.ENVELOPE, {})
        else:
            self.data = response

        # Move to separate function so it can be overrridden
        self._process_meta(response)
384785
def get_data(self, **kwargs):
        '''
        
        '''
        if self.queue:
            new = self.apply_queued()
            return new.get_data()
        else:
            return self._get_attr_from_file('data', **kwargs)
147332
def inspect_queue(queue, state, limit, bucket):
    """"""
    if not HAVE_BIN_LIBS:
        click.echo("missing required binary libs (lz4, msgpack)")
        return

    conn = worker.connection

    def job_row(j):
        if isinstance(j.args[0], basestring):
            account, bucket = j.args[0].split(':', 1)
        elif isinstance(j.args[0], dict):
            account, bucket = j.args[0]['name'], "set %d" % len(j.args[1])

        row = {
            'account': account,
            'bucket': bucket,
            # 'region': j.args[1]['region'],
            # 'size': j.args[1]['keycount'],
            'ttl': j.ttl,
            'enqueued': j.enqueued_at,
            'rtt': j.result_ttl,
            'timeout': j.timeout}

        if queue != "bucket-keyset-scan":
            row['args'] = j.args[2:]
        if state in ('running', 'failed', 'finished'):
            row['started'] = j.started_at
        if state in ('finished', 'failed'):
            row['ended'] = j.ended_at
        return row

    if state == 'running':
        registry_class = StartedJobRegistry
    elif state == 'pending':
        registry_class = Queue
    elif state == 'failed':
        registry_class = FailedQueue
    elif state == 'finished':
        registry_class = FinishedJobRegistry
    else:
        raise ValueError("invalid state: %s" % state)

    registry = registry_class(queue, connection=conn)
    records = []
    for jid in registry.get_job_ids():
        j = Job.fetch(jid, conn)
        if bucket:
            if j.args[1]['name'] != bucket:
                continue
        records.append(job_row(j))
        if len(records) == limit:
            break
    if records:
        click.echo(
            tabulate.tabulate(
                records,
                "keys",
                tablefmt='simple'))
    else:
        click.echo("no queue items found")
897558
def get_queue_func(request):
    """"""
    def cleanup(request):
        conn.close()

    def queue_func(**kwargs):
        return conn.channel().basic_publish(
            exchange='', body=json.dumps(kwargs), routing_key=queue,
            properties=pika.BasicProperties(delivery_mode=2))
    server = request.registry.settings['queue_server']
    queue = request.registry.settings['queue_verification']
    conn = pika.BlockingConnection(pika.ConnectionParameters(host=server))
    request.add_finished_callback(cleanup)
    return queue_func
250521
def get_stats(self, queue):
        
        uri = "/%s/%s/stats" % (self.uri_base, utils.get_id(queue))
        resp, resp_body = self.api.method_get(uri)
        return resp_body.get("messages")
1258203
def getResult(self, queue, uid, suid=None):
        

        if suid:
            r = yield self.client.get('rhumba.dq.%s.%s.%s' % (suid, queue, uid))
        else:
            r = yield self.client.get('rhumba.q.%s.%s' % (queue, uid))

        if r:
            defer.returnValue(json.loads(r))
        else:
            defer.returnValue(None)
749532
def _queue(self, kwargs):
    """"""
    if not 'hard resource_list' in kwargs: return 'all.q'
    d = dict([k.split('=') for k in kwargs['hard resource_list'].split(',')])
    for k in d:
      if k[0] == 'q' and d[k] == 'TRUE': return k
    return 'all.q'
855742
def peek(self):
        
        try:
            self._fetch()
            pkt = self.pkt_queue[0]
            return pkt
        except IndexError:
            raise StopIteration()
1286921
ServerRequest peek() {
        ServerRequest req = null;
        synchronized (reqQueueLockObject) {
            try {
                req = queue.get(0);
            } catch (IndexOutOfBoundsException | NoSuchElementException ignored) {
            }
        }
        return req;
    }
456702
async def read(self):
        
        result = await self._queue.get()

        self._can_write.set()

        if self._queue.empty():
            self._can_read.clear()

        return result
832544
def get(self, block=1, delay=None):
        """"""
        if _debug: IOQueue._debug("get block=%r delay=%r", block, delay)

        # if the queue is empty and we do not block return None
        if not block and not self.notempty.isSet():
            if _debug: IOQueue._debug("    - not blocking and empty")
            return None

        # wait for something to be in the queue
        if delay:
            self.notempty.wait(delay)
            if not self.notempty.isSet():
                return None
        else:
            self.notempty.wait()

        # extract the first element
        priority, iocb = self.queue[0]
        del self.queue[0]
        iocb.ioQueue = None

        # if the queue is empty, clear the event
        qlen = len(self.queue)
        if not qlen:
            self.notempty.clear()

        # return the request
        return iocb