コード例 #1
0
ファイル: test_simple.py プロジェクト: kashenfelter/pyina
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
ファイル: test_simple.py プロジェクト: hpparvi/pyina
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