当前位置: 首页>>代码示例>>Python>>正文


Python twistd.run函数代码示例

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


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

示例1: start

def start(opts, out=sys.stdout, err=sys.stderr):
    basedir = opts['basedir']
    print >>out, "STARTING", quote_output(basedir)
    if not os.path.isdir(basedir):
        print >>err, "%s does not look like a directory at all" % quote_output(basedir)
        return 1
    for fn in listdir_unicode(basedir):
        if fn.endswith(u".tac"):
            tac = str(fn)
            break
    else:
        print >>err, "%s does not look like a node directory (no .tac file)" % quote_output(basedir)
        return 1
    if "client" in tac:
        nodetype = "client"
    elif "introducer" in tac:
        nodetype = "introducer"
    else:
        nodetype = "unknown (%s)" % tac

    args = ["twistd", "-y", tac]
    if opts["syslog"]:
        args.append("--syslog")
    elif nodetype in ("client", "introducer"):
        fileutil.make_dirs(os.path.join(basedir, "logs"))
        args.extend(["--logfile", os.path.join("logs", "twistd.log")])
    if opts["profile"]:
        args.extend(["--profile=profiling_results.prof", "--savestats",])
    # now we're committed
    os.chdir(basedir)
    from twisted.scripts import twistd
    sys.argv = args
    twistd.run()
开发者ID:drewp,项目名称:tahoe-lafs,代码行数:33,代码来源:startstop_node.py

示例2: start

def start(path, _test=False):
    """Start the readerd instance.
    """
    tac_file = os.path.join(path, "readerd.tac")
    if not os.path.exists(tac_file):
        if not _test:
            sys.stderr.write("unable to locate {}, exiting\n".format(tac_file))
        return 1
    os.chdir(path)
    sys.path.insert(0, os.path.abspath(os.getcwd()))

    argv = [
        "twistd",
        "--no_save",
        "--logfile=twistd.log",
        "--python=readerd.tac"
    ]
    sys.argv = argv

    if _test:
        # Do not try to start twistd during unittesting
        return 0

    # Starting twistd
    from twisted.scripts import twistd
    sys.stdout.write("readerd process is starting\n")
    twistd.run()
开发者ID:tonylazarew,项目名称:reader,代码行数:27,代码来源:launcher.py

示例3: debug

def debug(options):
    '''Run the buildslave without forking in background.'''

    # Set buildslave name to be used in buildbot.tac.
    sys.buildslave_name = pave.getOption(
        options, 'debug', 'name', default_value=pave.getHostname())

    argv = [
        'twistd',
        '--no_save',
        '--nodaemon',
        '--logfile=-',
        '--python=buildbot.tac',
        ]
    sys.argv = argv

    try:
        from setproctitle import setproctitle
        setproctitle  # Shut up the linter.
    except ImportError:
        setproctitle = lambda t: None

    setproctitle('buildbot-slave')

    from twisted.scripts import twistd
    with pushd(pave.fs.join([pave.path.build, 'slave'])):
        twistd.run()
开发者ID:chevah,项目名称:buildslave-deployment,代码行数:27,代码来源:pavement.py

示例4: entrypoint

 def entrypoint():
     import sys
     from os import path
     app = path.join(path.dirname(__file__),name)
     sys.argv.insert(1, app)
     sys.argv.insert(1, '-y')
     from twisted.scripts.twistd import run
     run()
开发者ID:UndeRus,项目名称:bnw,代码行数:8,代码来源:entry.py

示例5: main

def main(args):
    cmdLine = run.calcCommandline()
    places = run.mkconfig('boredbot-config')
    ctllib.add(places, 'boredbot', cmd=cmdLine[0], args=cmdLine[1:] + ['loop'],
               env=['SECRET_KEY='+os.environ['SECRET_KEY']])
    ctllib.add(places, 'boredweb', cmd=cmdLine[0], args=cmdLine[1:] + ['gunicorn', '--bind', '0.0.0.0:8000', '-w', '4', 'boredbot_deploy.wsgi:app'],
               env=['SECRET_KEY='+os.environ['SECRET_KEY']])
    sys.argv = ['twistd', '--nodaemon', 'ncolony', '--messages', places.messages, '--config', places.config]
    twistd.run()
开发者ID:moshez,项目名称:boredbot,代码行数:9,代码来源:start.py

示例6: run_twistd

def run_twistd(args1=None, args2=None):
  args = [sys.argv[0]]
  if args1 is not None:
    args.extend(args1)
  args.append("qwebirc")
  if args2 is not None:
    args.extend(args2)
  sys.argv = args
  run()
开发者ID:550,项目名称:brouhaha,代码行数:9,代码来源:run.py

示例7: spawn

def spawn(opts, conf):
    """ Acts like twistd """
    if opts.config is not None:
        os.environ["CALLSIGN_CONFIG_FILE"] = opts.config
    sys.argv[1:] = [
        "-noy", sibpath(__file__, "callsign.tac"),
        "--pidfile", conf['pidfile'],
        "--logfile", conf['logfile'],
    ]
    twistd.run()
开发者ID:yaybu,项目名称:callsign,代码行数:10,代码来源:daemon.py

示例8: run_with_twistd

def run_with_twistd(options, application_name=''):
	from twisted.scripts.twistd import run
	opts = ['-l', '/dev/null']
	if options:
		opts.extend(options)
	sys.argv[1:] = opts

	application = service.Application(application_name)
	service.loadApplication = lambda f, k, p=None: application
	run()
开发者ID:reith,项目名称:ashttp,代码行数:10,代码来源:runner.py

示例9: run_twistd

def run_twistd(args1=None, args2=None):
  from twisted.scripts.twistd import run
  args = [sys.argv[0]]
  if args1 is not None:
    args.extend(args1)
  args.append("qwebirc")
  if args2 is not None:
    args.extend(args2)
  sys.argv = args
  run()
开发者ID:Stanford-Online,项目名称:edx_irc_chat,代码行数:10,代码来源:run.py

示例10: handle

 def handle(self, *args, **kwargs): # pylint: disable=W0613
     argv = [
         '-y', os.path.join(os.path.dirname(application.__file__),
                            "application.py"),
     ]
     if settings.COMMANDER_PID_FILE is None:
         argv.append('--nodaemon')
     else:
         argv.extend(['--pidfile', settings.COMMANDER_PID_FILE])
     sys.argv[1:] = argv
     run()
开发者ID:IL2HorusTeam,项目名称:il2ds-events-commander,代码行数:11,代码来源:run_commander.py

示例11: execute

def execute(argv, options):
    args = [ sys.argv[0] ]
    if argv is not None:
        args.extend(argv)
    args.append('thor')
    if options is not None:
        args.extend(options)
    sys.argv = args 

    # TODO Debug log message of application arguments
    from twisted.scripts.twistd import run; run() 
    # End of application execution. The main thread will exit after the reactor dies
    # in the execute method we will fall through to this point
    __logAndShutdown() 
开发者ID:Arconiaprime,项目名称:thor,代码行数:14,代码来源:run.py

示例12: run_bitmaskd

def run_bitmaskd():
    # TODO --- configure where to put the logs... (get --logfile, --logdir
    # from the bitmask_cli
    argv[1:] = [
        "-y",
        join(dirname(bitmask_core.__file__), "bitmaskd.tac"),
        "--pidfile",
        "/tmp/bitmaskd.pid",
        "--logfile",
        "/tmp/bitmaskd.log",
        "--umask=0022",
    ]
    print "[+] launching bitmaskd..."
    run()
开发者ID:kalikaneko,项目名称:bitmask_core,代码行数:14,代码来源:launcher.py

示例13: run

    def run(self, options):
        basedir = options.basedir
        stderr = options.stderr
        for fn in os.listdir(basedir):
            if fn.endswith(".tac"):
                tac = fn
                break
        else:
            print >>stderr, "%s does not look like a node directory (no .tac file)" % basedir
            return 1

        os.chdir(options.basedir)
        twistd_args = list(options.twistd_args)
        sys.argv[1:] = ["--no_save", "--python", tac] + twistd_args
        print >>stderr, "Launching Server..."
        twistd.run()
开发者ID:ducki2p,项目名称:foolscap,代码行数:16,代码来源:cli.py

示例14: launchNoDaemon

def launchNoDaemon(config):
    os.chdir(config['basedir'])
    sys.path.insert(0, os.path.abspath(config['basedir']))

    argv = ["twistd",
            "--no_save",
            '--nodaemon',
            "--logfile=twistd.log",  # windows doesn't use the same default
            "--python=buildbot.tac"]
    sys.argv = argv

    # this is copied from bin/twistd. twisted-2.0.0 through 2.4.0 use
    # _twistw.run . Twisted-2.5.0 and later use twistd.run, even for
    # windows.
    from twisted.scripts import twistd
    twistd.run()
开发者ID:dinatale2,项目名称:buildbot,代码行数:16,代码来源:start.py

示例15: launch

def launch(config):
    sys.path.insert(0, os.path.abspath(os.getcwd()))

    # see if we can launch the application without actually having to
    # spawn twistd, since spawning processes correctly is a real hassle
    # on windows.
    argv = ["twistd",
            "--no_save",
            "--logfile=twistd.log", # windows doesn't use the same default
            "--python=buildbot.tac"]
    sys.argv = argv

    # this is copied from bin/twistd. twisted-2.0.0 through 2.4.0 use
    # _twistw.run . Twisted-2.5.0 and later use twistd.run, even for
    # windows.
    from twisted.scripts import twistd
    twistd.run()
开发者ID:Callek,项目名称:buildbot,代码行数:17,代码来源:startup.py


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