def run(self): """Repeatedly process the job queue until told to exit. """ while not self._dismissed.isSet(): # thread blocks here, if queue empty request = self.workRequestQueue.get() if self._dismissed.isSet(): # return the work request we just picked up self.workRequestQueue.put(request) break # and exit try: retVal = request.callable(*request.args, **request.kwds) except Exception, e: retVal = e nil, t, v, tbinfo = compact_traceback() logging.debug("Exception in thread: %s: %s -- %s", t, v, tbinfo) self.resultQueue.put((request, retVal)) # Wake up asyncore # see connection.LocalTriggerConnection.__doc__ if self.notifyFunc: self.notifyFunc()
def _execHandler(self, handler): """Run a handler in-process""" try: ret = handler.handle(self.tree, self, self._lastRetVal) # keep the lastRetVal if the handler didn't return anything if ret is not None: self._lastRetVal = ret self._gotException = False except Exception, e: nil, t, v, tbinfo = compact_traceback() logging.debug("Exception in in-process handler: %s: %s -- %s", t,v,tbinfo) self._gotException = True self._lastRetVal = e
def _execHandler(self, handler): """Run a handler in-process""" try: ret = handler.handle(self.tree, self, self._lastRetVal) # keep the lastRetVal if the handler didn't return anything if ret is not None: self._lastRetVal = ret self._gotException = False except Exception, e: nil, t, v, tbinfo = compact_traceback() logging.debug("Exception in in-process handler: %s: %s -- %s", t, v, tbinfo) self._gotException = True self._lastRetVal = e
def handle_error(self): nil, t, v, tbinfo = compact_traceback() # sometimes a user repr method will crash. try: self_repr = repr(self) except: self_repr = '<__repr__(self) failed for object at %0x>' % id(self) self.log_info( 'uncaptured python exception, closing channel %s (%s:%s %s)' % ( self_repr, t, v, tbinfo ), 'error' ) self.close()
def run(self): """Repeatedly process the job queue until told to exit. """ while not self._dismissed.isSet(): # thread blocks here, if queue empty request = self.workRequestQueue.get() if self._dismissed.isSet(): # return the work request we just picked up self.workRequestQueue.put(request) break # and exit try: retVal = request.callable(*request.args, **request.kwds) except Exception, e: retVal = e nil, t, v, tbinfo = compact_traceback() logging.debug("Exception in thread: %s: %s -- %s", t,v,tbinfo) self.resultQueue.put((request, retVal)) # Wake up asyncore # see connection.LocalTriggerConnection.__doc__ if self.notifyFunc: self.notifyFunc()