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


Python Manager.ttin方法代码示例

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


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

示例1: test_ttin

# 需要导入模块: from gaffer.manager import Manager [as 别名]
# 或者: from gaffer.manager.Manager import ttin [as 别名]
def test_ttin():
    m = Manager()
    m.start()
    testfile, cmd, args, wdir = dummy_cmd()
    m.add_process("dummy", cmd, args=args, cwd=wdir, numprocesses=1)
    state = m.get_process_state("dummy")

    assert len(state.running) == 1
    ret = m.ttin("dummy", 1)
    assert ret == 2

    time.sleep(0.2)
    assert len(state.running) == 2

    ret = m.ttin("dummy", 1)
    assert ret == 3

    time.sleep(0.2)
    assert len(state.running) == 3


    ret = m.ttin("dummy", 3)
    assert ret == 6

    time.sleep(0.2)
    assert len(state.running) == 6

    m.stop()
    m.run()
开发者ID:tilgovi,项目名称:gaffer,代码行数:31,代码来源:test_manager.py

示例2: test_events

# 需要导入模块: from gaffer.manager import Manager [as 别名]
# 或者: from gaffer.manager.Manager import ttin [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
开发者ID:tilgovi,项目名称:gaffer,代码行数:28,代码来源:test_manager.py

示例3: test_manager_hooks

# 需要导入模块: from gaffer.manager import Manager [as 别名]
# 或者: from gaffer.manager.Manager import ttin [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
开发者ID:metawake,项目名称:gaffer,代码行数:32,代码来源:test_webhooks.py


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