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


Python cotyledon.ServiceManager方法代码示例

本文整理汇总了Python中cotyledon.ServiceManager方法的典型用法代码示例。如果您正苦于以下问题:Python cotyledon.ServiceManager方法的具体用法?Python cotyledon.ServiceManager怎么用?Python cotyledon.ServiceManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cotyledon的用法示例。


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

示例1: test_invalid_service

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def test_invalid_service(self):
        sm = cotyledon.ServiceManager()

        self.assertRaisesMsg(
            ValueError,
            "'service' must be a callable",
            sm.add, u"foo")
        self.assertRaisesMsg(
            ValueError,
            "'workers' must be an int >= 1, not: None (NoneType)",
            sm.add, FakeService, workers=None)
        self.assertRaisesMsg(
            ValueError,
            "'workers' must be an int >= 1, not: -2 (int)",
            sm.add, FakeService, workers=-2)

        oid = sm.add(FakeService, workers=3)
        self.assertRaisesMsg(
            ValueError,
            "'workers' must be an int >= -2, not: -5 (int)",
            sm.reconfigure, oid, workers=-5)
        self.assertRaisesMsg(
            ValueError,
            "notexists service id doesn't exists",
            sm.reconfigure, "notexists", workers=-1) 
开发者ID:sileht,项目名称:cotyledon,代码行数:27,代码来源:test_unit.py

示例2: main

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def main():
    try:
        config.parse_args(args=common.get_properly_ordered_parameters())
        common.print_server_info("engine")
        logging.setup(CONF, 'qinling')
        # Initialize RPC configuration.
        rpc.get_transport()

        sm = cotyledon.ServiceManager()
        sm.add(
            eng_service.EngineService,
            workers=1,
        )
        oslo_config_glue.setup(sm, CONF, reload_method="mutate")
        sm.run()
    except RuntimeError as excp:
        sys.stderr.write("ERROR: %s\n" % excp)
        sys.exit(1) 
开发者ID:openstack,项目名称:qinling,代码行数:20,代码来源:engine.py

示例3: main

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def main():
    octavia_service.prepare_service(sys.argv)

    gmr.TextGuruMeditation.setup_autorun(version)

    sm = cotyledon.ServiceManager()
    sm.add(consumer_v1.ConsumerService, workers=CONF.controller_worker.workers,
           args=(CONF,))
    sm.add(consumer_v2.ConsumerService,
           workers=CONF.controller_worker.workers, args=(CONF,))
    oslo_config_glue.setup(sm, CONF, reload_method="mutate")
    sm.run() 
开发者ID:openstack,项目名称:octavia,代码行数:14,代码来源:octavia_worker.py

示例4: example_app

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def example_app():
    p = cotyledon.ServiceManager()
    p.add(FullService, 2)
    service_id = p.add(LigthService, 5)
    p.reconfigure(service_id, 1)
    p.register_hooks(on_terminate, on_reload)
    p.register_hooks(on_terminate2)
    p.run() 
开发者ID:sileht,项目名称:cotyledon,代码行数:10,代码来源:examples.py

示例5: buggy_app

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def buggy_app():
    p = cotyledon.ServiceManager()
    p.add(BuggyService)
    p.run() 
开发者ID:sileht,项目名称:cotyledon,代码行数:6,代码来源:examples.py

示例6: oslo_app

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def oslo_app():
    conf = cfg.ConfigOpts()
    conf([], project='openstack-app', validate_default_values=True,
         version="0.1")

    p = cotyledon.ServiceManager()
    oslo_config_glue.setup(p, conf)
    p.add(OsloService)
    p.run() 
开发者ID:sileht,项目名称:cotyledon,代码行数:11,代码来源:examples.py

示例7: window_sanity_check

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def window_sanity_check():
    p = cotyledon.ServiceManager()
    p.add(LigthService)
    t = _utils.spawn(p.run)
    time.sleep(10)
    os.kill(os.getpid(), signal.SIGTERM)
    t.join() 
开发者ID:sileht,项目名称:cotyledon,代码行数:9,代码来源:examples.py

示例8: badly_coded_app

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def badly_coded_app():
    p = cotyledon.ServiceManager()
    p.add(BadlyCodedService)
    p.run() 
开发者ID:sileht,项目名称:cotyledon,代码行数:6,代码来源:examples.py

示例9: sigterm_during_init

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def sigterm_during_init():

    def kill():
        os.kill(os.getpid(), signal.SIGTERM)

    # Kill in 0.01 sec
    threading.Timer(0.01, kill).start()
    p = cotyledon.ServiceManager()
    p.add(LigthService, 10)
    p.run() 
开发者ID:sileht,项目名称:cotyledon,代码行数:12,代码来源:examples.py

示例10: setUp

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def setUp(self):
        super(SomeTest, self).setUp()
        cotyledon.ServiceManager._process_runner_already_created = False 
开发者ID:sileht,项目名称:cotyledon,代码行数:5,代码来源:test_unit.py

示例11: test_forking_slowdown

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def test_forking_slowdown(self):
        sm = cotyledon.ServiceManager()
        sm.add(FakeService, workers=3)
        with mock.patch('time.sleep') as sleep:
            sm._slowdown_respawn_if_needed()
            sm._slowdown_respawn_if_needed()
            sm._slowdown_respawn_if_needed()
            # We simulatge 3 more spawn
            sm._slowdown_respawn_if_needed()
            sm._slowdown_respawn_if_needed()
            sm._slowdown_respawn_if_needed()
            self.assertEqual(6, len(sleep.mock_calls)) 
开发者ID:sileht,项目名称:cotyledon,代码行数:14,代码来源:test_unit.py

示例12: start

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def start(is_service):
    """main method"""
    df_config.init(sys.argv)
    df_utils.config_parse()
    nb_api = api_nb.NbApi.get_instance()
    if is_service:
        df_service.register_service('df-skydive-service', nb_api)
    service_manager = cotyledon.ServiceManager()
    service_manager.add(SkydiveClient, workers=1, args=(nb_api,))
    service_manager.run() 
开发者ID:openstack,项目名称:dragonflow,代码行数:12,代码来源:df_skydive_service.py

示例13: main

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def main():
    config.parse_config(sys.argv)
    sm = cotyledon.ServiceManager()
    sm.add(StressNotificationsService)
    sm.run() 
开发者ID:openstack,项目名称:vitrage,代码行数:7,代码来源:load_generator.py

示例14: main

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def main():
    print(VITRAGE_TITLE)
    config.parse_config(sys.argv)
    sm = cotyledon.ServiceManager()
    sm.add(VitrageNotifierService)
    sm.run() 
开发者ID:openstack,项目名称:vitrage,代码行数:8,代码来源:notifier.py

示例15: main

# 需要导入模块: import cotyledon [as 别名]
# 或者: from cotyledon import ServiceManager [as 别名]
def main():
    print(VITRAGE_TITLE)
    config.parse_config(sys.argv)
    db_connection = storage.get_connection_from_config()
    sm = cotyledon.ServiceManager()
    sm.add(PersistorService, args=(db_connection,))
    sm.run() 
开发者ID:openstack,项目名称:vitrage,代码行数:9,代码来源:persistor.py


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