示例#1
0
def test_launch_streaming_application():
    current_path = os.path.dirname(os.path.abspath(__file__))

    stream_type = "OBJECTS"
    server_name = "localhost"
    server_port = "49049"

    # Start streaming server
    start_script = os.path.join(current_path, "..", "resources",
                                "streaming", "start_server.sh")
    subprocess.check_call([start_script, stream_type, server_name, server_port])

    from pycompss.runtime.launch import launch_pycompss_application

    app = os.path.join(current_path, "..", "resources", "stream_objects.py")
    launch_pycompss_application(
        app, "main", debug=True, app_name="stream_objects",
        streaming_backend=stream_type,
        streaming_master_name=server_name,
        streaming_master_port=server_port
    )

    # Stop the streaming server
    stop_script = os.path.join(current_path, "..", "resources",
                               "streaming", "stop_server.sh")
    subprocess.check_call([stop_script, stream_type])
def test_launch_test_0_basic1():
    if "COMPSS_HOME" in os.environ:
        from pycompss.runtime.launch import launch_pycompss_application

        current_path = os.path.dirname(os.path.abspath(__file__))
        app_path = os.path.join(current_path, "..", "..", "..", "..", "..", "..",
                                "..", "..", "tests", "sources", "python",
                                "0_basic1", "src")
        app = os.path.join(app_path, "test_mp.py")
        sys.path.insert(0, app_path)
        launch_pycompss_application(app,
                                    "main_program",
                                    debug=True,
                                    app_name="test_0_basic1")
        sys.path.pop(0)
        if os.path.exists("infile"):
            os.remove("infile")
        if os.path.exists("outfile"):
            os.remove("outfile")
        if os.path.exists("inoutfile"):
            os.remove("inoutfile")
        if os.path.exists("message.txt"):
            os.remove("message.txt")
    else:
        raise Exception("COMPSs is not installed")
示例#3
0
def test_launch_test_0_basic1():
    from pycompss.runtime.launch import launch_pycompss_application

    current_path = os.path.dirname(os.path.abspath(__file__))
    app_path = os.path.join(
        current_path,
        "..",
        "..",
        "..",
        "..",
        "..",
        "..",
        "..",
        "..",
        "tests",
        "sources",
        "local",
        "python",
        "0_basic1",
        "src",
    )
    app = os.path.join(app_path, "test_mp.py")
    sys.path.insert(0, app_path)
    launch_pycompss_application(app,
                                "main_program",
                                debug=True,
                                app_name="test_0_basic1")
    sys.path.pop(0)
    if os.path.exists("infile"):
        os.remove("infile")
    if os.path.exists("outfile"):
        os.remove("outfile")
    if os.path.exists("inoutfile"):
        os.remove("inoutfile")
def test_launch_application():
    from pycompss.runtime.launch import launch_pycompss_application

    current_path = os.path.dirname(os.path.abspath(__file__))
    app = os.path.join(current_path, "..", "resources", "app_collection.py")
    launch_pycompss_application(
        app, "main", debug=True, app_name="main"
    )
示例#5
0
def test_launch_application():
    from pycompss.runtime.launch import launch_pycompss_application

    current_path = os.path.dirname(os.path.abspath(__file__))
    app = os.path.join(current_path, "..", FOLDER, "api_tester.py")
    launch_pycompss_application(app,
                                PACKAGE,
                                debug=True,
                                trace=False,
                                app_name=APPLICATION_NAME)
def test_launch_application():
    if "COMPSS_HOME" in os.environ:
        from pycompss.runtime.launch import launch_pycompss_application

        current_path = os.path.dirname(os.path.abspath(__file__))
        app = os.path.join(current_path, "..", "resources", "increment.py")
        launch_pycompss_application(app,
                                    "main",
                                    debug=True,
                                    app_name="increment")
    else:
        raise Exception("COMPSs is not installed")
示例#7
0
def test_launch_application_with_cache():
    if sys.version_info >= (3, 8):
        from pycompss.runtime.launch import launch_pycompss_application
        current_path = os.path.dirname(os.path.abspath(__file__))
        app = os.path.join(current_path, "..", FOLDER, APPLICATION)
        launch_pycompss_application(app,
                                    PACKAGE,
                                    debug=True,
                                    trace=False,
                                    app_name=APPLICATION_NAME,
                                    worker_cache=True)
    else:
        print("WARNING: Cache not tested because python version is not >= 3.8")
def test_launch_application():
    from pycompss.runtime.launch import launch_pycompss_application
    global JAVA_API_JAR
    global STORAGE_API

    current_path = os.path.dirname(os.path.abspath(__file__))
    app = os.path.join(current_path, "..", "resources", "storage_app",
                       "pscos.py")
    __initialize_storage__()
    launch_pycompss_application(app,
                                "main",
                                debug=True,
                                app_name="pscos",
                                storage_conf=STORAGE_CONF,
                                storage_impl=JAVA_API_JAR,
                                classpath=JAVA_API_JAR,
                                pythonpath=STORAGE_API)
    __clean_storage__()
示例#9
0
 def test_launch_task_launch_task_2(self):
     from pycompss.runtime.launch import launch_pycompss_application
     app_path = os.path.abspath(modules.maqueta7.__file__).replace(
         '.pyc', '.py')
     args = ['1', '2', '3']
     kwargs = {}
     x = launch_pycompss_application(app_path, 'app', args, kwargs)
     print(x)
     self.assertEqual(x, str(123))
示例#10
0
def function_A(x, y, z):
    result = x + y + z
    # print result
    from pycompss.runtime.launch import launch_pycompss_application
    import modules.auxiliar
    aux = os.path.abspath(modules.auxiliar.__file__).replace('.pyc', '.py')  # "/home/user/test_maqueta/src/auxiliar.py"
    args = ['3', '2', '1']
    kwargs = {}
    x = launch_pycompss_application(aux, 'app2', args, kwargs)
    # print x
    return [result, x]
示例#11
0
 def test_launch_simple(self):
     """ Aplicacion que utiliza la funcionalidad de launch_pycompss_applicacion
         llamando a aplicaciones externas sin parametros (de distinto fichero! sin anidamiento)
         __main__ --> launch(maqueta.main)|--------> task(function_A)
     """
     time.sleep(20)
     from pycompss.runtime.launch import launch_pycompss_application
     print(self.app)
     app = os.path.abspath(modules.maqueta.__file__).replace('.pyc', '.py')
     x = launch_pycompss_application(app, 'main')
     print(x)
     self.assertEqual(x, 6)
示例#12
0
 def test_launch_2(self):
     """ Aplicacion que utiliza la funcionalidad de launch_pycompss_applicacion
         llamando a aplicaciones con parametros (de distinto fichero! sin anidamiento)
         __main__ --> launch(app) |--------> task(function_A)
     """
     time.sleep(20)
     from pycompss.runtime.launch import launch_pycompss_application
     args = ['1', '2', '3']
     kwargs = {}
     app = os.path.abspath(modules.maqueta3.__file__).replace('.pyc', '.py')
     x = launch_pycompss_application(app, 'app', args, kwargs)
     print(x)
     self.assertEqual(x, str(123))
示例#13
0
def function_A(x, y, z):
    result = x + y + z
    # print result
    from pycompss.runtime.launch import launch_pycompss_application
    aux = "/home/user/test_maqueta/src/maqueta8.py"
    args = ['3', '2', '1']
    kwargs = {}
    x = launch_pycompss_application(aux, 'app2', args, kwargs,
                                    debug=False,
                                    project_xml='/home/user/test_maqueta/xml/project.xml',
                                    resources_xml='/home/user/test_maqueta/xml/resources.xml',
                                    comm='NIO')

    # print x
    return [result, x]
示例#14
0
 def test_launch_params(self):
     from pycompss.runtime.launch import launch_pycompss_application
     app_path = "/home/user/test_maqueta/src/maqueta8.py"
     args = ['1', '2', '3']
     kwargs = {}
     x = launch_pycompss_application(
         app_path,
         'app',
         args,
         kwargs,
         debug=False,
         project_xml='/home/user/test_maqueta/xml/project.xml',
         resources_xml='/home/user/test_maqueta/xml/resources.xml',
         comm='NIO')
     print(x)
示例#15
0
    def test_launch_task_launch_task(self):
        """ Aplicacion que utiliza la funcionalidad de launch_pycompss_applicacion
            llamando a aplicaciones con parametros y con anidamiento
            (distintos ficheros!)

            __main__ --> launch(app)|--------> task(function_A)
                                             -----> launch(auxiliar.app2)
                                                        |----------> task(function_B)"""
        from pycompss.runtime.launch import launch_pycompss_application
        app = os.path.abspath(modules.maqueta5.__file__).replace('.pyc', '.py')
        args = ['1', '2', '3']
        kwargs = {}
        x = launch_pycompss_application(app, 'app', args, kwargs)
        print(x)
        self.assertEqual(x, str(123))
示例#16
0
def test_launch_dds_examples():
    from pycompss.runtime.launch import launch_pycompss_application

    current_path = os.path.dirname(os.path.abspath(__file__))
    app = os.path.join(current_path, "dds_examples.py")
    launch_pycompss_application(app, "main", debug=True, app_name="main")