本文整理汇总了Python中gaffer.manager.Manager.remove_process方法的典型用法代码示例。如果您正苦于以下问题:Python Manager.remove_process方法的具体用法?Python Manager.remove_process怎么用?Python Manager.remove_process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gaffer.manager.Manager
的用法示例。
在下文中一共展示了Manager.remove_process方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_events
# 需要导入模块: from gaffer.manager import Manager [as 别名]
# 或者: from gaffer.manager.Manager import remove_process [as 别名]
def test_events():
emitted = []
m = Manager()
m.start()
def cb(ev, msg):
emitted.append((ev, msg['name']))
# subscribe to all events
m.on('.', cb)
testfile, cmd, args, wdir = dummy_cmd()
m.add_process("dummy", cmd, args=args, cwd=wdir, numprocesses=4)
m.ttin("dummy", 1)
m.remove_process("dummy")
time.sleep(0.2)
m.stop()
m.run()
assert ('create', 'dummy') in emitted
assert ('start', 'dummy') in emitted
assert ('update', 'dummy') in emitted
assert ('stop', 'dummy') in emitted
assert ('delete', 'dummy') in emitted
示例2: test_manager_hooks
# 需要导入模块: from gaffer.manager import Manager [as 别名]
# 或者: from gaffer.manager.Manager import remove_process [as 别名]
def test_manager_hooks():
hooks = create_hooks(['create', 'start', 'update', 'stop',
'delete', 'proc.dummy.start', 'proc.dummy.spawn',
'proc.dummy.stop', 'proc.dummy.exit'])
emitted = []
loop = pyuv.Loop.default_loop()
s = get_server(loop, emitted)
s.start()
m = Manager(loop=loop)
m.start(apps=[WebHooks(hooks)])
testfile, cmd, args, wdir = dummy_cmd()
m.add_process("dummy", cmd, args=args, cwd=wdir, numprocesses=4)
m.ttin("dummy", 1)
m.remove_process("dummy")
time.sleep(0.2)
def on_stop(manager):
s.stop()
m.stop(on_stop)
m.run()
assert ('create', 'dummy') in emitted
assert ('start', 'dummy') in emitted
assert ('update', 'dummy') in emitted
assert ('stop', 'dummy') in emitted
assert ('delete', 'dummy') in emitted
assert ('proc.dummy.start', 'dummy') in emitted
assert ('proc.dummy.spawn', 'dummy') in emitted
assert ('proc.dummy.stop', 'dummy') in emitted
assert ('proc.dummy.exit', 'dummy') in emitted
示例3: test_simple_process
# 需要导入模块: from gaffer.manager import Manager [as 别名]
# 或者: from gaffer.manager.Manager import remove_process [as 别名]
def test_simple_process():
m = Manager()
m.start()
testfile, cmd, args, wdir = dummy_cmd()
m.add_process("dummy", cmd, args=args, cwd=wdir, start=False)
state = m.get_process_state("dummy")
assert state.numprocesses == 1
assert state.name == "dummy"
assert state.cmd == cmd
assert state.settings['args'] == args
assert state.settings['cwd'] == wdir
m.remove_process("dummy")
assert m.get_process_state("dummy") == None
m.stop()
m.run()
示例4: test_group
# 需要导入模块: from gaffer.manager import Manager [as 别名]
# 或者: from gaffer.manager.Manager import remove_process [as 别名]
def test_group():
m = Manager()
started = []
stopped = []
def cb(evtype, info):
if evtype == "start":
started.append(info['name'])
elif evtype == "stop":
stopped.append(info['name'])
m.start()
m.subscribe('start', cb)
m.subscribe('stop', cb)
testfile, cmd, args, wdir = dummy_cmd()
m.add_process("ga:a", cmd, args=args, cwd=wdir, start=False)
m.add_process("ga:b", cmd, args=args, cwd=wdir, start=False)
m.add_process("gb:a", cmd, args=args, cwd=wdir, start=False)
groups = sorted(m.get_groups())
ga1 = m.get_group('ga')
gb1 = m.get_group('gb')
m.start_group("ga")
m.stop_group("ga")
time.sleep(0.2)
m.remove_process("ga:a")
ga2 = m.get_group('ga')
m.stop_group("gb")
def stop(handle):
m.unsubscribe("start", cb)
m.unsubscribe("stop", cb)
m.stop()
t = pyuv.Timer(m.loop)
t.start(stop, 0.6, 0.0)
m.run()
assert groups == ['ga', 'gb']
assert ga1 == ['ga:a', 'ga:b']
assert gb1 == ['gb:a']
assert started == ['ga:a', 'ga:b']
assert stopped == ['ga:a', 'ga:b', 'gb:a']
assert ga2 == ['ga:b']