def test_external_mpi_worker_increment_task():
    # Override sys.argv to mimic runtime call
    sys_argv_backup = list(sys.argv)
    sys_path_backup = list(sys.path)
    job2_out = '/tmp/job2_NEW.out'
    job2_err = '/tmp/job2_NEW.err'
    job2_result = '/tmp/job2.IT'
    sys.argv = [
        "test_external_mpi.py", " ".join([
            'EXECUTE_TASK', '2', job2_out, job2_err, '0', '1', 'true', 'null',
            'METHOD', 'test_external_mpi', 'increment', '0', '1', 'localhost',
            '1', 'false', '9', '1', '2', '4', '3', 'null', 'value', 'null',
            '1', '9', '3', '#', '$return_0', 'null',
            job2_result + ':d1v2_1599560599402.IT:false:true:' + job2_result,
            '-', '0', '0'
        ])
    ]
    current_path = os.path.dirname(os.path.abspath(__file__))
    sys.path.append(current_path)
    main()
    sys.argv = sys_argv_backup
    sys.path = sys_path_backup
    check_task(job2_out, job2_err)
    os.remove(job2_out)
    os.remove(job2_err)
    os.remove(job2_result)
Example #2
0
def test_external_mpi_worker_increment_task():
    if using_mypy:
        raise Exception("UNSUPPORTED WITH MYPY")
    # Override sys.argv to mimic runtime call
    sys_argv_backup = list(sys.argv)
    sys_path_backup = list(sys.path)
    job2_out = tempfile.NamedTemporaryFile(delete=False).name
    job2_err = tempfile.NamedTemporaryFile(delete=False).name
    job2_result = tempfile.NamedTemporaryFile(delete=False).name
    sys.argv = [
        "test_external_mpi.py",
        " ".join([
            "EXECUTE_TASK",
            "2",
            job2_out,
            job2_err,
            "0",
            "1",
            "true",
            "null",
            "METHOD",
            "test_external_mpi",
            "increment",
            "0",
            "1",
            "localhost",
            "1",
            "false",
            "9",
            "1",
            "2",
            "4",
            "3",
            "null",
            "value",
            "null",
            "1",
            "9",
            "3",
            "#",
            "$return_0",
            "null",
            job2_result + ":d1v2_1599560599402.IT:false:true:" +
            job2_result,  # noqa: E501
            "-",
            "0",
            "0",
        ]),
    ]
    current_path = os.path.dirname(os.path.abspath(__file__))
    sys.path.append(current_path)
    main()
    sys.argv = sys_argv_backup
    sys.path = sys_path_backup
    check_task(job2_out, job2_err)
    os.remove(job2_out)
    os.remove(job2_err)
    os.remove(job2_result)
Example #3
0
def test_external_mpi_worker_simple_task():
    if using_mypy:
        raise Exception("UNSUPPORTED WITH MYPY")
    # Override sys.argv to mimic runtime call
    sys_argv_backup = list(sys.argv)
    sys_path_backup = list(sys.path)
    job1_out = tempfile.NamedTemporaryFile(delete=False).name
    job1_err = tempfile.NamedTemporaryFile(delete=False).name
    sys.argv = [
        "test_external_mpi.py",
        " ".join([
            "EXECUTE_TASK",
            "1",
            job1_out,
            job1_err,
            "0",
            "1",
            "true",
            "null",
            "METHOD",
            "test_external_mpi",
            "simple",
            "0",
            "1",
            "localhost",
            "1",
            "false",
            "None",
            "0",
            "0",
            "-",
            "0",
            "0",
        ]),
    ]
    current_path = os.path.dirname(os.path.abspath(__file__))
    sys.path.append(current_path)
    main()
    sys.argv = sys_argv_backup
    sys.path = sys_path_backup
    check_task(job1_out, job1_err)
    os.remove(job1_out)
    os.remove(job1_err)
def test_external_mpi_worker_simple_task():
    # Override sys.argv to mimic runtime call
    sys_argv_backup = list(sys.argv)
    sys_path_backup = list(sys.path)
    job1_out = '/tmp/job1_NEW.out'
    job1_err = '/tmp/job1_NEW.err'
    sys.argv = [
        "test_external_mpi.py", " ".join([
            'EXECUTE_TASK', '1', job1_out, job1_err, '0', '1', 'true', 'null',
            'METHOD', 'test_external_mpi', 'simple', '0', '1', 'localhost',
            '1', 'false', 'None', '0', '0', '-', '0', '0'
        ])
    ]
    current_path = os.path.dirname(os.path.abspath(__file__))
    sys.path.append(current_path)
    main()
    sys.argv = sys_argv_backup
    sys.path = sys_path_backup
    check_task(job1_out, job1_err)
    os.remove(job1_out)
    os.remove(job1_err)