

@spin_first
def db_query(self, query, keys=None):
    "Query the Hub's TaskRecord database\n        \n        This will return a list of task record dicts that match `query`\n        \n        Parameters\n        ----------\n        \n        query : mongodb query dict\n            The search dict. See mongodb query docs for details.\n        keys : list of strs [optional]\n            The subset of keys to be returned.  The default is to fetch everything but buffers.\n            'msg_id' will *always* be included.\n        "
    if isinstance(keys, str):
        keys = [keys]
    content = dict(query=query, keys=keys)
    self.session.send(self._query_socket, 'db_request', content=content)
    (idents, msg) = self.session.recv(self._query_socket, 0)
    if has_rbufs.debug:
        pprint(msg)
    content = msg['content']
    if (content['status'] != 'ok'):
        raise self._unwrap_exception(content)
    records = content['records']
    buffer_lens = content['buffer_lens']
    result_buffer_lens = content['result_buffer_lens']
    buffers = msg['buffers']
    has_bufs = (buffer_lens is not None)
    has_rbufs = (result_buffer_lens is not None)
    for (i, rec) in enumerate(records):
        if has_bufs:
            blen = buffer_lens[i]
            (rec['buffers'], buffers) = (buffers[:blen], buffers[blen:])
        if has_rbufs:
            blen = result_buffer_lens[i]
            (rec['result_buffers'], buffers) = (buffers[:blen], buffers[blen:])
    return records

dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/client/client.py Client.db_query/VarMisuse@88/261 `self`->`has_rbufs`