本文整理汇总了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()
示例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()
示例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()