예제 #1
0
def test_equal():
    # get the parallel mapper
    from pyina.ez_map import ez_map
    from pyina.ez_map import ez_map2

    # launch the parallel map of the target function
    results = ez_map(host, range(10), nodes=4)
    results2 = ez_map2(host, range(10), nodes=4)
    assert "\n".join(results) == "\n".join(results2)
예제 #2
0
def test_equal():
    # get the parallel mapper
    from pyina.ez_map import ez_map
    from pyina.ez_map import ez_map2

    # launch the parallel map of the target function
    results = ez_map(host, range(10), nodes=4)
    results2 = ez_map2(host, range(10), nodes=4)
    assert "\n".join(results) == "\n".join(results2)
예제 #3
0
def runshell(input):
    """
    This function just calls popen on the input string, and the stdout is printed.
    """
    import socket
    from subprocess import Popen, PIPE
    print "%s executing: %s" % (socket.gethostname(), input)
    pipe = Popen(input, shell=True, stdout=PIPE).stdout
    pipe.readlines()
    return 0


if __name__ == "__main__":

    import sys
    if len(sys.argv) > 2: nnodes = int(sys.argv[2])
    else: nnodes = 1

    try:
        from pyina.ez_map import ez_map

        batchfile = sys.argv[1]
        inputlist = []
        inputlist = open(batchfile).readlines()
        out = ez_map(runshell, inputlist, nodes=nnodes)
    except:
        print __doc__

# End of file
예제 #4
0
def runshell(input):
    """
    This function just calls popen on the input string, and the stdout is printed.
    """
    import socket
    from subprocess import Popen, PIPE
    print "%s executing: %s" % (socket.gethostname(), input)
    pipe = Popen(input, shell=True, stdout=PIPE).stdout
    pipe.readlines()
    return 0

    
if __name__ == "__main__":

    import sys
    if len(sys.argv) > 2: nnodes = int(sys.argv[2])
    else: nnodes = 1

    try:
        from pyina.ez_map import ez_map

        batchfile = sys.argv[1]
        inputlist = []
        inputlist = open(batchfile).readlines()
        out = ez_map(runshell, inputlist, nodes=nnodes)
    except:
        print __doc__


# End of file