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


Python Service.is_service_alive方法代码示例

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


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

示例1: Daemon

# 需要导入模块: from tests.util.services import Service [as 别名]
# 或者: from tests.util.services.Service import is_service_alive [as 别名]
class Daemon(object):
    """Starts a daemon."""

    def __init__(self, alternate_path=None, conf_file_name=None,
                 extra_cmds=None, service_path_root=None, service_path=None):
        # The path to the daemon bin if the other one doesn't work.
        self.alternate_path = alternate_path
        self.extra_cmds = extra_cmds or []
        # The name of a test config value which points to a conf file.
        self.conf_file_name = conf_file_name
        # The name of a test config value, which is inserted into the service_path.
        self.service_path_root = service_path_root
        # The first path to the daemon bin we try.
        self.service_path = service_path or "%s"

    def run(self):
        # Print out everything to make it
        print("Looking for config value %s..." % self.service_path_root)
        print(CONFIG.values[self.service_path_root])
        path = self.service_path % CONFIG.values[self.service_path_root]
        print("Path = %s" % path)
        if not os.path.exists(path):
            path = self.alternate_path
        if path is None:
            fail("Could not find path to %s" % self.service_path_root)
        conf_path = str(CONFIG.values[self.conf_file_name])
        cmds = CONFIG.python_cmd_list() + [path] + self.extra_cmds + \
               [conf_path]
        print("Running cmds: %s" % cmds)
        self.service = Service(cmds)
        if not self.service.is_service_alive():
            self.service.start()
开发者ID:Simplit-openapps,项目名称:trove-integration,代码行数:34,代码来源:initialize.py

示例2: KeystoneAll

# 需要导入模块: from tests.util.services import Service [as 别名]
# 或者: from tests.util.services.Service import is_service_alive [as 别名]
class KeystoneAll(unittest.TestCase):
    """Starts the Keystone combined daemon."""

    def setUp(self):
        path = keystone_bin("keystone-all")
        self.service = Service(python_cmd_list() + [path, "-c %s" % keystone_conf()])

    def test_start(self):
        if not self.service.is_service_alive():
            self.service.start()
开发者ID:rnirmal,项目名称:reddwarf_lite-integration,代码行数:12,代码来源:initialize.py

示例3: Reaper

# 需要导入模块: from tests.util.services import Service [as 别名]
# 或者: from tests.util.services.Service import is_service_alive [as 别名]
class Reaper(unittest.TestCase):
    """Starts the Reaper."""

    def setUp(self):
        self.service = Service(
            python_cmd_list() + ["%s/bin/nova-reaper" % nova_code_root(), "--flagfile=%s" % nova_conf()]
        )

    def test_start(self):
        if not self.service.is_service_alive():
            self.service.start()
开发者ID:rnirmal,项目名称:reddwarf_lite-integration,代码行数:13,代码来源:initialize.py


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