def purge_results(self, client_id, msg):
content = msg['<STR_LIT:content>']<EOL>self.log.info("<STR_LIT>", content)<EOL>msg_ids = content.get('<STR_LIT>', [])<EOL>reply = dict(status='<STR_LIT>')<EOL>if msg_ids == '<STR_LIT:all>':<EOL><INDENT>try:<EOL><INDENT>self.db.drop_matching_records(dict(completed={'<STR_LIT>':None}))<EOL><DEDENT>except Exception:<EOL><INDENT>reply = error.wrap_exception()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>pending = filter(lambda m: m in self.pending, msg_ids)<EOL>if pending:<EOL><INDENT>try:<EOL><INDENT>raise IndexError("<STR_LIT>" % pending[<NUM_LIT:0>])<EOL><DEDENT>except:<EOL><INDENT>reply = error.wrap_exception()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>self.db.drop_matching_records(dict(msg_id={'<STR_LIT>':msg_ids}))<EOL><DEDENT>except Exception:<EOL><INDENT>reply = error.wrap_exception()<EOL><DEDENT><DEDENT>if reply['<STR_LIT:status>'] == '<STR_LIT>':<EOL><INDENT>eids = content.get('<STR_LIT>', [])<EOL>for eid in eids:<EOL><INDENT>if eid not in self.engines:<EOL><INDENT>try:<EOL><INDENT>raise IndexError("<STR_LIT>" % eid)<EOL><DEDENT>except:<EOL><INDENT>reply = error.wrap_exception()<EOL><DEDENT>break<EOL><DEDENT>uid = self.engines[eid].queue<EOL>try:<EOL><INDENT>self.db.drop_matching_records(dict(engine_uuid=uid, completed={'<STR_LIT>':None}))<EOL><DEDENT>except Exception:<EOL><INDENT>reply = error.wrap_exception()<EOL>break<EOL><DEDENT><DEDENT><DEDENT><DEDENT>self.session.send(self.query, '<STR_LIT>', content=reply, ident=client_id)<EOL>
Purge results from memory. This method is more valuable before we move
        to a DB based message storage mechanism.