environment/lib/python2.7/site-packages/IPython/parallel/controller/hub.py
def purge_results(self, client_id, msg):
        """Purge results from memory. This method is more valuable before we move
        to a DB based message storage mechanism."""
        content = msg['content']
        self.log.info("Dropping records with %s", content)
        msg_ids = content.get('msg_ids', [])
        reply = dict(status='ok')
        if msg_ids == 'all':
            try:
                self.db.drop_matching_records(dict(completed={'$ne':None}))
            except Exception:
                reply = error.wrap_exception()
        else:
            pending = filter(lambda m: m in self.pending, msg_ids)
            if pending:
                try:
                    raise IndexError("msg pending: %r" % pending[0])
                except:
                    reply = error.wrap_exception()
            else:
                try:
                    self.db.drop_matching_records(dict(msg_id={'$in':msg_ids}))
                except Exception:
                    reply = error.wrap_exception()

            if reply['status'] == 'ok':
                eids = content.get('engine_ids', [])
                for eid in eids:
                    if eid not in self.engines:
                        try:
                            raise IndexError("No such engine: %i" % eid)
                        except:
                            reply = error.wrap_exception()
                        break
                    uid = self.engines[eid].queue
                    try:
                        self.db.drop_matching_records(dict(engine_uuid=uid, completed={'$ne':None}))
                    except Exception:
                        reply = error.wrap_exception()
                        break

        self.session.send(self.query, 'purge_reply', content=reply, ident=client_id)
def purge_results(self, client_id, msg):
        content = msg['content']
        self.log.info("Dropping records with %s", content)
        msg_ids = content.get('msg_ids', [])
        reply = dict(status='ok')
        if msg_ids == 'all':
            try:
                self.db.drop_matching_records(dict(completed={'$ne':None}))
            except Exception:
                reply = error.wrap_exception()
        else:
            pending = filter(lambda m: m in self.pending, msg_ids)
            if pending:
                try:
                    raise IndexError("msg pending: %r" % pending[0])
                except:
                    reply = error.wrap_exception()
            else:
                try:
                    self.db.drop_matching_records(dict(msg_id={'$in':msg_ids}))
                except Exception:
                    reply = error.wrap_exception()

            if reply['status'] == 'ok':
                eids = content.get('engine_ids', [])
                for eid in eids:
                    if eid not in self.engines:
                        try:
                            raise IndexError("No such engine: %i" % eid)
                        except:
                            reply = error.wrap_exception()
                        break
                    uid = self.engines[eid].queue
                    try:
                        self.db.drop_matching_records(dict(engine_uuid=uid, completed={'$ne':None}))
                    except Exception:
                        reply = error.wrap_exception()
                        break

        self.session.send(self.query, 'purge_reply', content=reply, ident=client_id)
def purge_results ( self , client_id , msg ) : content = msg [ 'content' ] self . log . info ( "Dropping records with %s" , content ) msg_ids = content . get ( 'msg_ids' , [ ] ) reply = dict ( status = 'ok' ) if msg_ids == 'all' : try : self . db . drop_matching_records ( dict ( completed = { '$ne' : None } ) ) except Exception : reply = error . wrap_exception ( ) else : pending = filter ( lambda m : m in self . pending , msg_ids ) if pending : try : raise IndexError ( "msg pending: %r" % pending [ 0 ] ) except : reply = error . wrap_exception ( ) else : try : self . db . drop_matching_records ( dict ( msg_id = { '$in' : msg_ids } ) ) except Exception : reply = error . wrap_exception ( ) if reply [ 'status' ] == 'ok' : eids = content . get ( 'engine_ids' , [ ] ) for eid in eids : if eid not in self . engines : try : raise IndexError ( "No such engine: %i" % eid ) except : reply = error . wrap_exception ( ) break uid = self . engines [ eid ] . queue try : self . db . drop_matching_records ( dict ( engine_uuid = uid , completed = { '$ne' : None } ) ) except Exception : reply = error . wrap_exception ( ) break self . session . send ( self . query , 'purge_reply' , content = reply , ident = client_id )
Purge results from memory. This method is more valuable before we move
        to a DB based message storage mechanism.
Purge results from memory . This method is more valuable before we move to a DB based message storage mechanism .