예제 #1
0
def test_nodegroup0():
    proc, host = Host.spawn('host1')
    ng = host.create_nodegroup('nodegroup')
    n = 5
    nodes = [
        ng.create_node('_MyTestNode', name='mynode{}'.format(i))
        for i in range(n)
    ]

    for i in range(n):
        nodes[i].configure()

    for i in range(n):
        nodes[i].initialize()

    for i in range(n):
        nodes[i].start()

    with pytest.raises(RemoteCallException):
        # a running node cannot be delete
        ng.remove_node(nodes[0])

    for i in range(n):
        nodes[i].stop()

    # test qwidget display
    qt_node = ng.create_node('_MyTestNodeQWidget', name='myqtnode')
    qt_node.show()

    for i in range(n):
        ng.remove_node(nodes[i])

    ng.close()
예제 #2
0
def test_manager():
    #~ logger.level = logging.DEBUG
    mgr = create_manager('rpc', auto_close_at_exit=False)

    #~ print(type(mgr))
    #~ exit()
    # Create a local Host to communicate with
    host_proc, host = Host.spawn('test-host')
    host_addr = host_proc.client.address

    # test connection to host
    host = mgr.get_host(host_addr)
    assert mgr.list_hosts() == [host]

    # create nodegroup
    assert mgr.list_nodegroups() == []
    ng1 = mgr.create_nodegroup('nodegroup1', host)
    assert mgr.list_nodegroups() == [ng1]

    assert ng1.list_nodes() == []
    n1 = ng1.create_node('_MyTestNode')
    assert ng1.list_nodes() == [n1]
    n1.initialize()
    n1.configure()
    n1.start()
    n1.stop()
    ng1.remove_node(n1)
    assert ng1.list_nodes() == []

    # Need to close manager here because otherwise atexit hooks will kill the
    # host, which results in the manager complaining that it was unable to
    # kill the nodegroup. In real situations, we do not expect the host to
    # disappear before the manager does.
    mgr.close()
예제 #3
0
def test_nodegroup0():
    proc, host = Host.spawn('host1')
    ng = host.create_nodegroup('nodegroup')
    n = 5
    nodes = [ng.create_node('_MyTestNode', name='mynode{}'.format(i)) for i in range(n)]

    for i in range(n):
        nodes[i].configure()

    for i in range(n):
        nodes[i].initialize()

    for i in range(n):
        nodes[i].start()

    with pytest.raises(RemoteCallException):
        # a running node cannot be delete
        ng.remove_node(nodes[0])
        
    for i in range(n):
        nodes[i].stop()

    # test qwidget display
    qt_node = ng.create_node('_MyTestNodeQWidget', name='myqtnode')
    qt_node.show()
    
    for i in range(n):
        ng.remove_node(nodes[i])
    
    ng.close()
    proc.stop()
예제 #4
0
파일: test_manager.py 프로젝트: pyacq/pyacq
def test_manager():
    #~ logger.level = logging.DEBUG
    mgr = create_manager('rpc', auto_close_at_exit=False)
    
    #~ print(type(mgr))
    #~ exit()
    # Create a local Host to communicate with
    host_proc, host = Host.spawn('test-host')
    host_addr = host_proc.client.address
    
    # test connection to host
    host = mgr.get_host(host_addr)
    assert mgr.list_hosts() == [host]
    
    # create nodegroup 
    assert mgr.list_nodegroups() == []
    ng1 = mgr.create_nodegroup('nodegroup1', host)
    assert mgr.list_nodegroups() == [ng1]
    

    assert ng1.list_nodes() == []
    n1 = ng1.create_node('_MyTestNode')
    assert ng1.list_nodes() == [n1]
    n1.initialize()
    n1.configure()
    n1.start()
    n1.stop()
    ng1.remove_node(n1)
    assert ng1.list_nodes() == []

    # Need to close manager here because otherwise atexit hooks will kill the
    # host, which results in the manager complaining that it was unable to
    # kill the nodegroup. In real situations, we do not expect the host to
    # disappear before the manager does. 
    mgr.close()
예제 #5
0
파일: test_host.py 프로젝트: pyacq/pyacq
def test_host1():
    
    p1, host1 = Host.spawn('host1')
    p2, host2 = Host.spawn('host2')
    
    ng11 = host1.create_nodegroup('ng1')
    ng12 = host1.create_nodegroup('ng2')
    ng21 = host2.create_nodegroup('ng3')
    ng22 = host2.create_nodegroup('ng4')

    assert len(host1.spawners) == 2
    host1.close_all_nodegroups()
    assert len(host1.spawners) == 0
    host2.close_all_nodegroups()
    assert len(host2.spawners) == 0
    
    p1.stop()
    p2.stop()
예제 #6
0
def test_host1():

    p1, host1 = Host.spawn('host1')
    p2, host2 = Host.spawn('host2')

    ng11 = host1.create_nodegroup('ng1')
    ng12 = host1.create_nodegroup('ng2')
    ng21 = host2.create_nodegroup('ng3')
    ng22 = host2.create_nodegroup('ng4')

    assert len(host1.spawners) == 2
    host1.close_all_nodegroups()
    assert len(host1.spawners) == 0
    host2.close_all_nodegroups()
    assert len(host2.spawners) == 0

    p1.stop()
    p2.stop()