示例#1
0
 def dump_stacktrace(self, signum, frame):
     stackdumps = self._thread_stacks()
     enginestatus = format_engine_status(self.crawler.engine)
     liverefs = format_live_refs()
     msg = "Dumping stack trace and engine status" \
         "\n{0}\n{1}\n{2}".format(enginestatus, liverefs, stackdumps)
     log.msg(msg)
示例#2
0
文件: debug.py 项目: pyarnold/scrapy
 def dump_stacktrace(self, signum, frame):
     stackdumps = self._thread_stacks()
     enginestatus = format_engine_status(self.crawler.engine)
     liverefs = format_live_refs()
     msg = "Dumping stack trace and engine status" \
         "\n{0}\n{1}\n{2}".format(enginestatus, liverefs, stackdumps)
     log.msg(msg)
示例#3
0
    def test_format_live_refs(self):
        o1 = Foo()  # NOQA
        o2 = Bar()  # NOQA
        o3 = Foo()  # NOQA
        self.assertEqual(
            trackref.format_live_refs(), '''\
Live References

Bar                                 1   oldest: 0s ago
Foo                                 2   oldest: 0s ago
''')

        self.assertEqual(
            trackref.format_live_refs(ignore=Foo), '''\
Live References

Bar                                 1   oldest: 0s ago
''')
示例#4
0
文件: debug.py 项目: 01-/scrapy
 def dump_stacktrace(self, signum, frame):
     log_args = {
         'stackdumps': self._thread_stacks(),
         'enginestatus': format_engine_status(self.crawler.engine),
         'liverefs': format_live_refs(),
     }
     logger.info("Dumping stack trace and engine status\n"
                 "%(enginestatus)s\n%(liverefs)s\n%(stackdumps)s",
                 log_args, extra={'crawler': self.crawler})
示例#5
0
 def create_report(self, figures):
     s = ""
     s += "SCRAPY MEMORY DEBUGGER RESULTS\n\n"
     for f in figures:
         s += "%-30s : %d %s\n" % f
     if settings.getbool('TRACK_REFS'):
         s += os.linesep
         s += format_live_refs()
     return s
示例#6
0
 def dump_stacktrace(self, signum, frame):
     log_args = {
         'stackdumps': self._thread_stacks(),
         'enginestatus': format_engine_status(self.crawler.engine),
         'liverefs': format_live_refs(),
     }
     logger.info("Dumping stack trace and engine status\n"
                 "%(enginestatus)s\n%(liverefs)s\n%(stackdumps)s",
                 log_args, extra={'crawler': self.crawler})
示例#7
0
    def test_format_live_refs(self):
        o1 = Foo()  # NOQA
        o2 = Bar()  # NOQA
        o3 = Foo()  # NOQA
        self.assertEqual(
            trackref.format_live_refs(),
            '''\
Live References

Bar                                 1   oldest: 0s ago
Foo                                 2   oldest: 0s ago
''')

        self.assertEqual(
            trackref.format_live_refs(ignore=Foo),
            '''\
Live References

Bar                                 1   oldest: 0s ago
''')