示例#1
0
    def _recall(self):
        try:
            t = self.gen.next()
        except StopIteration:
            self.deferred.callback(None)
            self.cleanup()
        except Exception, e:

            exc_type, value, tb = sys.exc_info()

            ## Magic Traceback Hacking
            if debug:
                # interpreter shutdown
                if not sys:
                    return
                stream = sys.stderr
                # HERE.  This should really be logged or else bittorrent-
                # curses will never be able to properly output. --Dave
                _print_traceback(
                    stream, self.stack, "generator %s" % self.gen.gi_frame.f_code.co_name, 0, exc_type, value, tb
                )
            else:
                # if (tb.tb_lineno != self.gen.gi_frame.f_lineno or
                #    tb.f_code.co_filename != self.gen.gi_frame.f_code.co_filename):
                #    tb = FakeTb(self.gen.gi_frame, tb)
                pass
            ## Magic Traceback Hacking

            self.deferred.errback(Failure(value, exc_type, tb))
            del tb
            self.cleanup()
示例#2
0
    def _recall(self):
        try:
            t = self.gen.next()
        except StopIteration:
            self.deferred.callback(None)
            self.cleanup()
        except Exception, e:

            exc_type, value, tb = sys.exc_info()

            ## Magic Traceback Hacking
            if debug:
                # interpreter shutdown
                if not sys:
                    return
                stream = sys.stderr
                # HERE.  This should really be logged or else bittorrent-
                # curses will never be able to properly output. --Dave
                _print_traceback(
                    stream, self.stack,
                    "generator %s" % self.gen.gi_frame.f_code.co_name, 0,
                    exc_type, value, tb)
            else:
                #if (tb.tb_lineno != self.gen.gi_frame.f_lineno or
                #    tb.f_code.co_filename != self.gen.gi_frame.f_code.co_filename):
                #    tb = FakeTb(self.gen.gi_frame, tb)
                pass
            ## Magic Traceback Hacking

            self.deferred.errback(Failure(value, exc_type, tb))
            del tb
            self.cleanup()
示例#3
0
    def run(self):

        while not self.killswitch.isSet():
            func, args, kwargs = self.queue.get(True)

            try:
                v = func(*args, **kwargs)
            except:
                # interpreter shutdown
                if not sys:
                    return
                exc_type, value, tb = sys.exc_info()
                threading._print_traceback(sys.stderr, self.stack,
                                           "thread %s" % self.getName(), 1,
                                           exc_type, value, tb)
                del tb
示例#4
0
    def run(self):

        while not self.killswitch.isSet():
            func, args, kwargs = self.queue.get(True)

            try:
                v = func(*args, **kwargs)
            except:
                # interpreter shutdown
                if not sys:
                    return
                exc_type, value, tb = sys.exc_info()
                threading._print_traceback(sys.stderr, self.stack,
                                           "thread %s" % self.thread.getName(),
                                           1,
                                           exc_type, value, tb)
                del tb
示例#5
0
    def run(self):

        while not self.killswitch.isSet():
            event_df = self.queue.get()
            yield event_df
            (df,) = event_df.getResult()
            
            yield df
            try:
                r = df.getResult()
            except:
                # interpreter shutdown
                if not sys:
                    return
                exc_type, value, tb = sys.exc_info()
                threading._print_traceback(sys.stderr, self.stack,
                                           "thread %s" % self.getName(), 1,
                                           exc_type, value, tb)
                del tb
示例#6
0
    def run(self):

        while not self.killswitch.isSet():
            event_df = self.queue.get()
            yield event_df
            (df,) = event_df.getResult()
            
            yield df
            try:
                r = df.getResult()
            except:
                # interpreter shutdown
                if not sys:
                    return
                exc_type, value, tb = sys.exc_info()
                # no base_stack, unless we wan't to keep stack from the add_task
                threading._print_traceback(sys.stderr, [],
                                           "RoutineLoop", 1,
                                           exc_type, value, tb)
                del tb