本文整理汇总了Python中supervisor.tests.base.DummyOptions.process_group_configs方法的典型用法代码示例。如果您正苦于以下问题:Python DummyOptions.process_group_configs方法的具体用法?Python DummyOptions.process_group_configs怎么用?Python DummyOptions.process_group_configs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类supervisor.tests.base.DummyOptions
的用法示例。
在下文中一共展示了DummyOptions.process_group_configs方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_main_first
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import process_group_configs [as 别名]
def test_main_first(self):
options = DummyOptions()
pconfig = DummyPConfig(options, 'foo', 'foo', '/bin/foo')
gconfigs = [DummyPGroupConfig(options,'foo', pconfigs=[pconfig])]
options.process_group_configs = gconfigs
options.test = True
options.first = True
supervisord = self._makeOne(options)
supervisord.main()
self.assertEqual(options.environment_processed, True)
self.assertEqual(options.fds_cleaned_up, False)
self.assertEqual(options.rlimits_set, True)
self.assertEqual(options.parse_criticals, ['setuid_called'])
self.assertEqual(options.parse_warnings, [])
self.assertEqual(options.parse_infos, ['rlimits_set'])
self.assertEqual(options.autochildlogdir_cleared, True)
self.assertEqual(len(supervisord.process_groups), 1)
self.assertEqual(supervisord.process_groups['foo'].config.options,
options)
self.assertEqual(options.environment_processed, True)
self.assertEqual(options.httpservers_opened, True)
self.assertEqual(options.signals_set, True)
self.assertEqual(options.daemonized, True)
self.assertEqual(options.pidfile_written, True)
self.assertEqual(options.cleaned_up, True)
示例2: test_add_process_group_event
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import process_group_configs [as 别名]
def test_add_process_group_event(self):
from supervisor import events
L = []
def callback(event):
L.append(1)
events.subscribe(events.ProcessGroupAddedEvent, callback)
options = DummyOptions()
pconfig = DummyPConfig(options, 'foo', 'foo', '/bin/foo')
gconfig = DummyPGroupConfig(options,'foo', pconfigs=[pconfig])
options.process_group_configs = [gconfig]
supervisord = self._makeOne(options)
supervisord.add_process_group(gconfig)
options.test = True
supervisord.runforever()
self.assertEqual(L, [1])
示例3: test_add_process_group
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import process_group_configs [as 别名]
def test_add_process_group(self):
options = DummyOptions()
pconfig = DummyPConfig(options, 'foo', 'foo', '/bin/foo')
gconfig = DummyPGroupConfig(options,'foo', pconfigs=[pconfig])
options.process_group_configs = [gconfig]
supervisord = self._makeOne(options)
self.assertEqual(supervisord.process_groups, {})
result = supervisord.add_process_group(gconfig)
self.assertEqual(list(supervisord.process_groups.keys()), ['foo'])
self.assertTrue(result)
group = supervisord.process_groups['foo']
result = supervisord.add_process_group(gconfig)
self.assertEqual(group, supervisord.process_groups['foo'])
self.assertTrue(not result)
示例4: test_handle_sigusr2
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import process_group_configs [as 别名]
def test_handle_sigusr2(self):
options = DummyOptions()
options._signal = signal.SIGUSR2
pconfig1 = DummyPConfig(options, 'process1', 'process1','/bin/process1')
from supervisor.process import ProcessStates
process1 = DummyProcess(pconfig1, state=ProcessStates.STOPPING)
process1.delay = time.time() - 1
supervisord = self._makeOne(options)
pconfigs = [DummyPConfig(options, 'foo', 'foo', '/bin/foo')]
options.process_group_configs = DummyPGroupConfig(
options, 'foo',
pconfigs=pconfigs)
supervisord.handle_signal()
self.assertEqual(supervisord.options.mood, 1)
self.assertEqual(options.logs_reopened, True)
self.assertEqual(options.logger.data[0],
'received SIGUSR2 indicating log reopen request')
示例5: test_main_notfirst
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import process_group_configs [as 别名]
def test_main_notfirst(self):
options = DummyOptions()
pconfig = DummyPConfig(options, 'foo', 'foo', '/bin/foo')
gconfigs = [DummyPGroupConfig(options,'foo', pconfigs=[pconfig])]
options.process_group_configs = gconfigs
options.test = True
options.first = False
supervisord = self._makeOne(options)
supervisord.main()
self.assertEqual(options.environment_processed, True)
self.assertEqual(options.fds_cleaned_up, True)
self.assertFalse(hasattr(options, 'rlimits_set'))
self.assertEqual(options.make_logger_messages,
(['setuid_called'], [], []))
self.assertEqual(options.autochildlogdir_cleared, True)
self.assertEqual(len(supervisord.process_groups), 1)
self.assertEqual(supervisord.process_groups['foo'].config.options,
options)
self.assertEqual(options.environment_processed, True)
self.assertEqual(options.httpservers_opened, True)
self.assertEqual(options.signals_set, True)
self.assertEqual(options.daemonized, False)
self.assertEqual(options.pidfile_written, True)
self.assertEqual(options.cleaned_up, True)