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

Python options.ClientOptions类代码示例

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

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



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

示例1: main

def main(args=None, options=None):
    if options is None:
        options = ClientOptions()
    options.realize(args, doc=__doc__)
    c = Controller(options)
    if options.args:
        c.onecmd(" ".join(options.args))
    if options.interactive:
        try:
            import readline
            if options.history_file:
                try:
                    readline.read_history_file(options.history_file)
                except IOError:
                    pass
                def save():
                    try:
                        readline.write_history_file(options.history_file)
                    except IOError:
                        pass
                import atexit
                atexit.register(save)
        except ImportError:
            pass
        try:
            c.cmdqueue.append('status')
            c.cmdloop()
        except KeyboardInterrupt:
            c.output('')
            pass
开发者ID:atupal,项目名称:supervisor,代码行数:30,代码来源:supervisorctl.py


示例2: test_real_controller_initialization

    def test_real_controller_initialization(self):
        from supervisor.options import ClientOptions
        args = [] # simulating starting without parameters
        options = ClientOptions()

        # No default config file search in case they would exist
        self.assertTrue(len(options.searchpaths) > 0)
        options.searchpaths = []

        options.realize(args, doc=__doc__)
        c = self._makeOne(options)
开发者ID:duliangang,项目名称:supervisor,代码行数:11,代码来源:test_supervisorctl.py


示例3: main

def main(args=None, options=None):
    if options is None:
        options = ClientOptions()

    options.realize(args, doc=__doc__)
    c = Controller(options)

    if options.args:
        c.onecmd(" ".join(options.args))

    if options.interactive:
        c.exec_cmdloop(args, options)
开发者ID:maoshuyu,项目名称:supervisor,代码行数:12,代码来源:supervisorctl.py


示例4: shutdown

def shutdown(**kwargs):
    supervisor_args = get_supervisor_args(kwargs)
    options = ClientOptions()
    options.realize(args=supervisor_args)
    try:
        rpc = get_rpc(options)
        rpc.supervisor.shutdown()
        print >> sys.stderr, "Shutting down supervisor"
    except socket.error:
        print >> sys.stderr, "Supervisor already shut down"
    except xmlrpclib.Fault as e:
        if e.faultString == 'SHUTDOWN_STATE':
            print >> sys.stderr, "Supervisor already shutting down"
开发者ID:witsch,项目名称:mr.laforge,代码行数:13,代码来源:__init__.py


示例5: up

def up(*args, **kwargs):
    if not args:
        args = sys.argv[1:]
    supervisor_args = get_supervisor_args(kwargs)
    options = ClientOptions()
    options.realize(args=supervisor_args)
    status = "init"
    while 1:
        try:
            rpc = get_rpc(options)
            rpc.supervisor.getPID()
            if status == 'shutdown':
                sys.stderr.write("\n")
            break
        except socket.error:
            if status == 'shutdown':
                sys.stderr.write("\n")
            sys.stderr.write("Starting supervisord\n")
            supervisord = find_supervisord()
            cmd = [supervisord] + supervisor_args
            retcode = subprocess.call(cmd)
            if retcode != 0:
                sys.exit(retcode)
            status = 'starting'
        except xmlrpclib.Fault as e:
            if e.faultString == 'SHUTDOWN_STATE':
                if status == 'init':
                    sys.stderr.write("Supervisor currently shutting down ")
                    sys.stderr.flush()
                    status = 'shutdown'
                else:
                    sys.stderr.write(".")
                    sys.stderr.flush()
                time.sleep(1)
    if len(args):
        for name in args:
            info = rpc.supervisor.getProcessInfo(name)
            if info['statename'] != 'RUNNING':
                print "Starting %s" % name
                try:
                    rpc.supervisor.startProcess(name)
                except xmlrpclib.Fault as e:
                    if e.faultCode == 60:  # already started
                        continue
                    print >> sys.stderr, e.faultCode, e.faultString
                    sys.exit(1)
            else:
                print >> sys.stderr, "%s is already running" % name
开发者ID:witsch,项目名称:mr.laforge,代码行数:48,代码来源:__init__.py


示例6: main

def main(args=None,options=None):
  if options is None:
    options = ClientOptions()
  options.realize(args,doc=__doc__)
  ctl = Controller(options)
  if len(options.args) != 1:
    ctl.output_error('Invalid number of arguments (expected 1, got %d)' % len(options.args))
    sys.exit(5)
  ctl.upcheck()

  group = options.args[0].strip()
  restarter = ctl.get_restarter()
  result = None

  while 1:
    try:
      result = send_restart(group,options=options,ctl=ctl,restarter=restarter)
    except xmlrpclib.ProtocolError,e:
      if e.errcode == 401:
        if options.interactive:
          from getpass import getpass
          ctl.output('Server requires authentication')
          username = raw_input('Username:')
          password = getpass(prompt='Password:')
          ctl.output('')
          options.username = username
          options.password = password
          continue
        else:
          options.usage('Server requires authentication')
      else:
        ctl.output_error('%s: protocol error (%s)' % (group,e))
        sys.exit(10)
    break
开发者ID:jsipprell,项目名称:supervisor-restarter,代码行数:34,代码来源:supervisorctl_restart_group.py


示例7: main

def main(args=None, options=None):
    if options is None:
        options = ClientOptions()
    options.realize(args, doc=__doc__)
    c = Controller(options)
    if options.args:
        c.onecmd(" ".join(options.args))
    if options.interactive:
        try:
            import readline

            delims = readline.get_completer_delims()
            delims = delims.replace(":", "")  # "group:process" as one word
            delims = delims.replace("*", "")  # "group:*" as one word
            delims = delims.replace("-", "")  # names with "-" as one word
            readline.set_completer_delims(delims)

            if options.history_file:
                try:
                    readline.read_history_file(options.history_file)
                except IOError:
                    pass

                def save():
                    try:
                        readline.write_history_file(options.history_file)
                    except IOError:
                        pass

                import atexit

                atexit.register(save)
        except ImportError:
            pass
        try:
            c.cmdqueue.append("status")
            c.cmdloop()
        except KeyboardInterrupt:
            c.output("")
            pass
开发者ID:JeancarloBarrios,项目名称:adtp,代码行数:40,代码来源:supervisorctl.py


示例8: __init__

 def __init__(self, context):
     options = ClientOptions()
     options.realize([])
     self.supervisor = options.getServerProxy().supervisor
开发者ID:Dolphi2,项目名称:ajenti,代码行数:4,代码来源:api.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python states.getProcessStateDescription函数代码示例发布时间:2022-05-27
下一篇:
Python options.split_namespec函数代码示例发布时间: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