本文整理汇总了Python中amplify.agent.managers.nginx.NginxManager._find_all方法的典型用法代码示例。如果您正苦于以下问题:Python NginxManager._find_all方法的具体用法?Python NginxManager._find_all怎么用?Python NginxManager._find_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类amplify.agent.managers.nginx.NginxManager
的用法示例。
在下文中一共展示了NginxManager._find_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_find_all
# 需要导入模块: from amplify.agent.managers.nginx import NginxManager [as 别名]
# 或者: from amplify.agent.managers.nginx.NginxManager import _find_all [as 别名]
def test_find_all(self):
out = subp.call('ps xao pid,ppid,command | grep "supervisor[d]" | tr -s " "')[0]
supervisors = [map(int, line.strip().split()[:2]) for line in out if 'supervisord' in line]
assert_that(supervisors, has_length(1))
supervisor_pid, supervisor_ppid = supervisors[0]
assert_that(supervisor_ppid, equal_to(1))
time.sleep(2)
out = subp.call('ps xao pid,ppid,command | grep "nginx[:]" | tr -s " "')[0]
masters = [map(int, line.strip().split()[:2]) for line in out if 'nginx: master process' in line]
assert_that(masters, has_length(1))
master_pid, master_ppid = masters[0]
assert_that(master_ppid, equal_to(supervisor_pid))
worker_pids = []
workers = [map(int, line.strip().split()[:2]) for line in out if 'nginx: worker process' in line]
for worker_pid, worker_ppid in workers:
worker_pids.append(worker_pid)
assert_that(worker_ppid, equal_to(master_pid))
container = NginxManager()
nginxes = container._find_all()
assert_that(nginxes, has_length(1))
definition, data = nginxes.pop(0)
assert_that(data, has_key('pid'))
assert_that(data, has_key('workers'))
assert_that(master_pid, equal_to(data['pid']))
assert_that(worker_pids, equal_to(data['workers']))
示例2: test_find_all
# 需要导入模块: from amplify.agent.managers.nginx import NginxManager [as 别名]
# 或者: from amplify.agent.managers.nginx.NginxManager import _find_all [as 别名]
def test_find_all(self):
container = NginxManager()
nginxes = container._find_all()
assert_that(nginxes, has_length(1))
definition, data = nginxes.pop(0)
assert_that(data, has_key('pid'))
assert_that(data, has_key('workers'))
# get ps info
master, workers = self.get_master_workers()
assert_that(master, equal_to(data['pid']))
assert_that(workers, equal_to(data['workers']))
示例3: test_find_none
# 需要导入模块: from amplify.agent.managers.nginx import NginxManager [as 别名]
# 或者: from amplify.agent.managers.nginx.NginxManager import _find_all [as 别名]
def test_find_none(self):
# Kill running NGINX so that it finds None
subp.call('pgrep nginx |sudo xargs kill -SIGKILL', check=False)
self.running = False
# Setup dummy object
context.objects.register(DummyRootObject())
container = NginxManager()
nginxes = container._find_all()
assert_that(nginxes, has_length(0))
root_object = context.objects.root_object
assert_that(root_object.eventd.current, has_length(1))
# Reset objects...
context.objects = None
context._setup_object_tank()