• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python failure.startDebugMode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中twisted.python.failure.startDebugMode函数的典型用法代码示例。如果您正苦于以下问题:Python startDebugMode函数的具体用法?Python startDebugMode怎么用?Python startDebugMode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了startDebugMode函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: main

def main():
    import random

    from twisted.internet import reactor
    from twisted.python.log import addObserver

    from twisted.python.failure import startDebugMode
    startDebugMode()

    report = ReportStatistics()
    addObserver(SimpleStatistics().observe)
    addObserver(report.observe)
    addObserver(RequestLogger().observe)

    r = random.Random()
    r.seed(100)
    populator = Populator(r)
    parameters = PopulationParameters()
    parameters.addClient(
        1, ClientType(OS_X_10_6, [Eventer, Inviter, Accepter]))
    simulator = CalendarClientSimulator(
        populator, parameters, reactor, '127.0.0.1', 8008)

    arrivalPolicy = SmoothRampUp(groups=10, groupSize=1, interval=3)
    arrivalPolicy.run(reactor, simulator)

    reactor.run()
    report.report()
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:28,代码来源:population.py


示例2: main

def main():
    from twisted.python.failure import startDebugMode
    startDebugMode()
    d = collect(sys.argv[1])
    d.addErrback(err, "Problem collecting SQL")
    d.addBoth(lambda ign: reactor.stop())
    reactor.run(installSignalHandlers=False)
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:7,代码来源:sqlwatch.py


示例3: opt_debug

 def opt_debug(self):
     """
     Run the application in the Python Debugger (implies nodaemon),
     sending SIGUSR2 will drop into debugger
     """
     defer.setDebugging(True)
     failure.startDebugMode()
     self['debug'] = True
开发者ID:antong,项目名称:twisted,代码行数:8,代码来源:app.py


示例4: opt_debug

 def opt_debug(self):
     """
     run the application in the Python Debugger (implies nodaemon),
     sending SIGUSR2 will drop into debugger
     """
     from twisted.internet import defer
     defer.setDebugging(True)
     failure.startDebugMode()
     self['debug'] = True
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:9,代码来源:app.py


示例5: cli

def cli(ctx, loglevel, config, pdb):
    """
    feeds creates feeds for pages that don't have feeds.
    """
    if pdb:
        failure.startDebugMode()
    os.chdir(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))

    settings = load_feeds_settings(config)
    settings.set("LOG_LEVEL", loglevel.upper())
    ctx.obj["settings"] = settings
开发者ID:Lukas0907,项目名称:feeds,代码行数:11,代码来源:cli.py


示例6: setUp

    def setUp(self):
        """
        Override pdb.post_mortem so we can make sure it's called.
        """
        # Make sure any changes we make are reversed:
        post_mortem = pdb.post_mortem
        origInit = failure.Failure.__dict__['__init__']
        def restore():
            pdb.post_mortem = post_mortem
            failure.Failure.__dict__['__init__'] = origInit
        self.addCleanup(restore)

        self.result = []
        pdb.post_mortem = self.result.append
        failure.startDebugMode()
开发者ID:svpcom,项目名称:twisted-cdeferred,代码行数:15,代码来源:test_failure.py


示例7: main

def main():
    credChecker = CredChecker()
    credChecker.addUser('foo', 'bar')

    print 'Defined Users:', credChecker.users

    realm = DummyRealm()

    f = Factory()
    f.protocol = POP3
    f.portal = Portal(realm, (credChecker,))
    f.protocol.portal = f.portal

    print 'Portal Credential Interfaces', f.portal.listCredentialsInterfaces()

    PORT = 2110
    print 'PORT', PORT

    tpf.startDebugMode()

    reactor.listenTCP(PORT, f)
    reactor.run()
开发者ID:asutherland,项目名称:tb-test-help,代码行数:22,代码来源:dumb-pop-server.py


示例8: process_options

    def process_options(self, args, opts):
        try:
            self.settings.overrides.update(arglist_to_dict(opts.set))
        except ValueError:
            raise UsageError("Invalid -s value, use -s NAME=VALUE", print_help=False)

        if opts.logfile:
            self.settings.overrides['LOG_ENABLED'] = True
            self.settings.overrides['LOG_FILE'] = opts.logfile

        if opts.loglevel:
            self.settings.overrides['LOG_ENABLED'] = True
            self.settings.overrides['LOG_LEVEL'] = opts.loglevel

        if opts.nolog:
            self.settings.overrides['LOG_ENABLED'] = False

        if opts.pidfile:
            with open(opts.pidfile, "w") as f:
                f.write(str(os.getpid()) + os.linesep)

        if opts.pdb:
            failure.startDebugMode()
开发者ID:0xfab,项目名称:scrapy,代码行数:23,代码来源:command.py


示例9: process_options

    def process_options(self, args, opts):
        try:
            self.settings.setdict(arglist_to_dict(opts.set),
                                  priority='cmdline')
        except ValueError:
            raise UsageError("Invalid -s value, use -s NAME=VALUE", print_help=False)

        if opts.logfile:
            self.settings.set('LOG_ENABLED', True, priority='cmdline')
            self.settings.set('LOG_FILE', opts.logfile, priority='cmdline')

        if opts.loglevel:
            self.settings.set('LOG_ENABLED', True, priority='cmdline')
            self.settings.set('LOG_LEVEL', opts.loglevel, priority='cmdline')

        if opts.nolog:
            self.settings.set('LOG_ENABLED', False, priority='cmdline')

        if opts.pidfile:
            with open(opts.pidfile, "w") as f:
                f.write(str(os.getpid()) + os.linesep)

        if opts.pdb:
            failure.startDebugMode()
开发者ID:0326,项目名称:scrapy,代码行数:24,代码来源:command.py


示例10: _initialDebugSetup

def _initialDebugSetup(config):
    # do this part of debug setup first for easy debugging of import failures
    if config['debug']:
        from twisted.internet import defer
        defer.setDebugging(True)
        failure.startDebugMode()
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:6,代码来源:trial.py


示例11: _initialDebugSetup

def _initialDebugSetup(config):
    # do this part of debug setup first for easy debugging of import failures
    if config['debug']:
        failure.startDebugMode()
    if config['debug'] or config['debug-stacktraces']:
        defer.setDebugging(True)
开发者ID:GunioRobot,项目名称:twisted,代码行数:6,代码来源:trial.py


示例12: ValueError

    raise ValueError("Unknown benchmark: %r" % (name,))


def main():
    from twisted.python.log import startLogging, err

    options = BenchmarkOptions()
    try:
        options.parseOptions(sys.argv[1:])
    except UsageError, e:
        print(e)
        return 1

    if options['debug']:
        from twisted.python.failure import startDebugMode
        startDebugMode()

    if options['source-directory']:
        source = options['source-directory']
        conf = source.child('conf').child('caldavd-dev.plist')
        pids = whichPIDs(source, plistlib.PlistParser().parse(conf.open()))
    else:
        pids = []
    msg("Using dtrace to monitor pids %r" % (pids,))

    startLogging(file('benchmark.log', 'a'), False)

    d = benchmark(
        options['host'], options['port'], pids, options['label'],
        options['parameters'],
        [(arg, resolveBenchmark(arg).measure) for arg in options['benchmarks']])
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:31,代码来源:benchmark.py


示例13: configure_logging

# -*- coding:utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import uniout
import json
from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
from scrapy.utils.log import configure_logging
from twisted.python import failure

from school_info_spider import spiders, models

configure_logging()
failure.startDebugMode()

process = CrawlerProcess(get_project_settings())
process.crawl(spiders.SchoolSpider)
process.crawl(spiders.MajorSpider)
process.crawl(spiders.RetrialAcceptingLineSpider)
process.crawl(spiders.AcceptanceRateSpider)
process.start()  # the script will block here until all crawling jobs are finished

# session = models.DBSession()
# with open(os.path.join('JsonLinesExport', spiders.SchoolSpider.name), 'rb') as fp:
#     for l in fp:
#         d = json.loads(l)
#         s = models.School(**d)
#         session.add(s)
# session.commit()
# with open(os.path.join('JsonLinesExport', spiders.MajorSpider.name), 'rb') as fp:
#     for l in fp:
开发者ID:er1iang,项目名称:scrapy-nest,代码行数:31,代码来源:run.py



注:本文中的twisted.python.failure.startDebugMode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python failure.trap函数代码示例发布时间:2022-05-27
下一篇:
Python failure.check函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap