From ffcca96d5f585a65596d851afe9044097123e612 Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Mon, 5 Feb 2024 17:53:49 +0100 Subject: [PATCH 01/13] less use of repadmin --- examples/cfx_static_mixer/project_setup.py | 4 ++-- examples/fluent_2d_heat_exchanger/project_setup.py | 4 ++-- examples/fluent_nozzle/project_setup.py | 4 ++-- examples/mapdl_linked_analyses/project_setup.py | 4 ++-- examples/mapdl_motorbike_frame/project_query.py | 4 ++-- examples/mapdl_motorbike_frame/project_setup.py | 4 ++-- examples/mapdl_motorbike_frame/task_files.py | 4 ++-- examples/mapdl_tyre_performance/project_setup.py | 4 ++-- .../python_linked_multi_process_step/project_setup.py | 4 ++-- examples/python_multi_process_step/project_setup.py | 4 ++-- examples/python_two_bar_truss_problem/project_setup.py | 4 ++-- src/ansys/hps/client/auth/api/auth_api.py | 2 +- src/ansys/hps/client/exceptions.py | 8 ++++---- src/ansys/hps/client/jms/api/jms_api.py | 2 +- src/ansys/hps/client/jms/api/project_api.py | 4 ++-- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/examples/cfx_static_mixer/project_setup.py b/examples/cfx_static_mixer/project_setup.py index d87e91db8..a5b7f9c84 100644 --- a/examples/cfx_static_mixer/project_setup.py +++ b/examples/cfx_static_mixer/project_setup.py @@ -175,8 +175,8 @@ def create_project(client, name, num_jobs=20, version=__ansys_apps_version__): parser.add_argument("-n", "--name", type=str, default="cfx_static_mixer") parser.add_argument("-j", "--num-jobs", type=int, default=1) parser.add_argument("-U", "--url", default="https://127.0.0.1:8443/rep") - parser.add_argument("-u", "--username", default="repadmin") - parser.add_argument("-p", "--password", default="repadmin") + parser.add_argument("-u", "--username", default="repuser") + parser.add_argument("-p", "--password", default="repuser") parser.add_argument("-v", "--ansys-version", default=__ansys_apps_version__) args = parser.parse_args() diff --git a/examples/fluent_2d_heat_exchanger/project_setup.py b/examples/fluent_2d_heat_exchanger/project_setup.py index 71ca335fd..bf6bda77d 100644 --- a/examples/fluent_2d_heat_exchanger/project_setup.py +++ b/examples/fluent_2d_heat_exchanger/project_setup.py @@ -151,8 +151,8 @@ def create_project( parser.add_argument("-n", "--name", type=str, default="Fluent 2D Heat Exchanger") parser.add_argument("-es", "--use-exec-script", default=False, type=bool) parser.add_argument("-U", "--url", default="https://localhost:8443/rep") - parser.add_argument("-u", "--username", default="repadmin") - parser.add_argument("-p", "--password", default="repadmin") + parser.add_argument("-u", "--username", default="repuser") + parser.add_argument("-p", "--password", default="repuser") parser.add_argument("-v", "--ansys-version", default=__ansys_apps_version__) args = parser.parse_args() diff --git a/examples/fluent_nozzle/project_setup.py b/examples/fluent_nozzle/project_setup.py index fd20cbc03..22c5100c1 100644 --- a/examples/fluent_nozzle/project_setup.py +++ b/examples/fluent_nozzle/project_setup.py @@ -207,8 +207,8 @@ def create_project(client, name, num_jobs=20, version=__ansys_apps_version__): parser.add_argument("-j", "--num-jobs", type=int, default=1) parser.add_argument("-es", "--use-exec-script", default=True, action="store_true") parser.add_argument("-U", "--url", default="https://127.0.0.1:8443/rep") - parser.add_argument("-u", "--username", default="repadmin") - parser.add_argument("-p", "--password", default="repadmin") + parser.add_argument("-u", "--username", default="repuser") + parser.add_argument("-p", "--password", default="repuser") parser.add_argument("-v", "--ansys-version", default=__ansys_apps_version__) args = parser.parse_args() diff --git a/examples/mapdl_linked_analyses/project_setup.py b/examples/mapdl_linked_analyses/project_setup.py index 4d14f60bd..a2c50583b 100644 --- a/examples/mapdl_linked_analyses/project_setup.py +++ b/examples/mapdl_linked_analyses/project_setup.py @@ -386,8 +386,8 @@ def create_project( parser.add_argument("-n", "--name", type=str, default="MAPDL Prestress-Modal-Harmonic") parser.add_argument("-es", "--use-exec-script", default=False, type=bool) parser.add_argument("-U", "--url", default="https://localhost:8443/rep") - parser.add_argument("-u", "--username", default="repadmin") - parser.add_argument("-p", "--password", default="repadmin") + parser.add_argument("-u", "--username", default="repuser") + parser.add_argument("-p", "--password", default="repuser") parser.add_argument("--incremental", action="store_true") parser.add_argument("-v", "--ansys-version", default=__ansys_apps_version__) diff --git a/examples/mapdl_motorbike_frame/project_query.py b/examples/mapdl_motorbike_frame/project_query.py index 78bc33356..f90dd9b27 100644 --- a/examples/mapdl_motorbike_frame/project_query.py +++ b/examples/mapdl_motorbike_frame/project_query.py @@ -138,8 +138,8 @@ def download_files(client, project_name): parser.add_argument("-n", "--name", type=str, default="Mapdl Motorbike Frame") parser.add_argument("-j", "--num-jobs", type=int, default=500) parser.add_argument("-U", "--url", default="https://127.0.0.1:8443/rep") - parser.add_argument("-u", "--username", default="repadmin") - parser.add_argument("-p", "--password", default="repadmin") + parser.add_argument("-u", "--username", default="repuser") + parser.add_argument("-p", "--password", default="repuser") args = parser.parse_args() logger = logging.getLogger() diff --git a/examples/mapdl_motorbike_frame/project_setup.py b/examples/mapdl_motorbike_frame/project_setup.py index dac5de66c..e5d35992b 100644 --- a/examples/mapdl_motorbike_frame/project_setup.py +++ b/examples/mapdl_motorbike_frame/project_setup.py @@ -353,8 +353,8 @@ def create_project( parser.add_argument("-j", "--num-jobs", type=int, default=50) parser.add_argument("-es", "--use-exec-script", default=False, action="store_true") parser.add_argument("-U", "--url", default="https://127.0.0.1:8443/rep") - parser.add_argument("-u", "--username", default="repadmin") - parser.add_argument("-p", "--password", default="repadmin") + parser.add_argument("-u", "--username", default="repuser") + parser.add_argument("-p", "--password", default="repuser") parser.add_argument("-v", "--ansys-version", default=__ansys_apps_version__) args = parser.parse_args() diff --git a/examples/mapdl_motorbike_frame/task_files.py b/examples/mapdl_motorbike_frame/task_files.py index 9215d3fa9..3b2c74bab 100644 --- a/examples/mapdl_motorbike_frame/task_files.py +++ b/examples/mapdl_motorbike_frame/task_files.py @@ -143,8 +143,8 @@ def modify_task_files(client, project_name): parser.add_argument("-n", "--name", type=str, default="mapdl_motorbike_frame") parser.add_argument("-j", "--num-jobs", type=int, default=500) parser.add_argument("-U", "--url", default="https://127.0.0.1:8443/rep") - parser.add_argument("-u", "--username", default="repadmin") - parser.add_argument("-p", "--password", default="repadmin") + parser.add_argument("-u", "--username", default="repuser") + parser.add_argument("-p", "--password", default="repuser") args = parser.parse_args() logger = logging.getLogger() diff --git a/examples/mapdl_tyre_performance/project_setup.py b/examples/mapdl_tyre_performance/project_setup.py index 61f1b16aa..b80293dc3 100644 --- a/examples/mapdl_tyre_performance/project_setup.py +++ b/examples/mapdl_tyre_performance/project_setup.py @@ -264,8 +264,8 @@ def create_project( parser.add_argument("-j", "--num-jobs", type=int, default=10) parser.add_argument("-es", "--use-exec-script", default=False, type=bool) parser.add_argument("-U", "--url", default="https://localhost:8443/rep") - parser.add_argument("-u", "--username", default="repadmin") - parser.add_argument("-p", "--password", default="repadmin") + parser.add_argument("-u", "--username", default="repuser") + parser.add_argument("-p", "--password", default="repuser") parser.add_argument("-v", "--ansys-version", default=__ansys_apps_version__) args = parser.parse_args() diff --git a/examples/python_linked_multi_process_step/project_setup.py b/examples/python_linked_multi_process_step/project_setup.py index 1c958bd14..582a8eb85 100644 --- a/examples/python_linked_multi_process_step/project_setup.py +++ b/examples/python_linked_multi_process_step/project_setup.py @@ -203,8 +203,8 @@ def main(client, num_task_definitions, num_jobs, start, inactive): parser = argparse.ArgumentParser() parser.add_argument("-U", "--url", default="https://127.0.0.1:8443/rep") - parser.add_argument("-u", "--username", default="repadmin") - parser.add_argument("-p", "--password", default="repadmin") + parser.add_argument("-u", "--username", default="repuser") + parser.add_argument("-p", "--password", default="repuser") parser.add_argument("-j", "--num-jobs", type=int, default=10) parser.add_argument("-t", "--num-task-definitions", type=int, default=3) parser.add_argument("-f", "--start", type=float, default=10.0) diff --git a/examples/python_multi_process_step/project_setup.py b/examples/python_multi_process_step/project_setup.py index 5d5f14c59..864d1f726 100644 --- a/examples/python_multi_process_step/project_setup.py +++ b/examples/python_multi_process_step/project_setup.py @@ -289,8 +289,8 @@ def main( parser = argparse.ArgumentParser() parser.add_argument("-U", "--url", default="https://127.0.0.1:8443/rep") - parser.add_argument("-u", "--username", default="repadmin") - parser.add_argument("-p", "--password", default="repadmin") + parser.add_argument("-u", "--username", default="repuser") + parser.add_argument("-p", "--password", default="repuser") parser.add_argument("-n", "--num-jobs", type=int, default=10) parser.add_argument("-t", "--num-task-definitions", type=int, default=3) parser.add_argument("-d", "--duration", type=int, default=10) diff --git a/examples/python_two_bar_truss_problem/project_setup.py b/examples/python_two_bar_truss_problem/project_setup.py index 05088c0e6..e15c2ec7a 100644 --- a/examples/python_two_bar_truss_problem/project_setup.py +++ b/examples/python_two_bar_truss_problem/project_setup.py @@ -286,8 +286,8 @@ def main(client, num_jobs, use_exec_script) -> Project: if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("-U", "--url", default="https://127.0.0.1:8443/rep") - parser.add_argument("-u", "--username", default="repadmin") - parser.add_argument("-p", "--password", default="repadmin") + parser.add_argument("-u", "--username", default="repuser") + parser.add_argument("-p", "--password", default="repuser") parser.add_argument("-n", "--num-jobs", type=int, default=50) parser.add_argument("-es", "--use-exec-script", default=False, action="store_true") diff --git a/src/ansys/hps/client/auth/api/auth_api.py b/src/ansys/hps/client/auth/api/auth_api.py index 81c027c76..59d3ce537 100644 --- a/src/ansys/hps/client/auth/api/auth_api.py +++ b/src/ansys/hps/client/auth/api/auth_api.py @@ -49,7 +49,7 @@ class AuthApi: >>> from ansys.hps.client import Client >>> from ansys.hps.client.auth import AuthApi, User >>> cl = Client( - ... url="https://127.0.0.1:8443/rep/", username="repadmin", password="repadmin" + ... url="https://127.0.0.1:8443/hps", username="repuser", password="repuser" ... ) >>> auth_api = AuthApi(cl) >>> users = auth_api.get_users(firstName="john", exact=False) diff --git a/src/ansys/hps/client/exceptions.py b/src/ansys/hps/client/exceptions.py index 5a274e09e..b099ce652 100644 --- a/src/ansys/hps/client/exceptions.py +++ b/src/ansys/hps/client/exceptions.py @@ -26,7 +26,7 @@ class HPSError(RequestException): def __init__(self, *args, **kwargs): - """Provides the base class for all REP-related errors. + """Provides the base class for all HPS-related errors. This class derives from the :class:`requests.exceptions.RequestException` base class. @@ -35,12 +35,12 @@ def __init__(self, *args, **kwargs): >>> from ansys.hps.client import HPSError >>> from ansys.hps.client.jms import Client >>> try: - >>> client = Client(url="https://127.0.0.1:8443/rep/", - username="repadmin", + >>> client = Client(url="https://127.0.0.1:8443/hps/", + username="repuser", password="wrong_psw") >>> except HPSError as e: >>> print(e) - 401 Client Error: invalid_grant for: POST https://127.0.0.1:8443/rep/auth... + 401 Client Error: invalid_grant for: POST https://127.0.0.1:8443/hps/auth... Invalid user credentials """ self.reason = kwargs.pop("reason", None) diff --git a/src/ansys/hps/client/jms/api/jms_api.py b/src/ansys/hps/client/jms/api/jms_api.py index c97218f31..f64073802 100644 --- a/src/ansys/hps/client/jms/api/jms_api.py +++ b/src/ansys/hps/client/jms/api/jms_api.py @@ -57,7 +57,7 @@ class JmsApi(object): >>> from ansys.hps.client import Client >>> from ansys.hps.client.jms import JmsApi, Project >>> cl = Client( - ... url="https://127.0.0.1:8443/rep", username="repadmin", password="repadmin" + ... url="https://127.0.0.1:8443/hps", username="repuser", password="repuser" ... ) >>> jms_api = JmsApi(cl) >>> project = jms_api.create_project(Project(name="Example Project")) diff --git a/src/ansys/hps/client/jms/api/project_api.py b/src/ansys/hps/client/jms/api/project_api.py index 229396dc1..718088541 100644 --- a/src/ansys/hps/client/jms/api/project_api.py +++ b/src/ansys/hps/client/jms/api/project_api.py @@ -69,7 +69,7 @@ class ProjectApi: >>> from ansys.hps.client import Client >>> from ansys.hps.client.jms import JmsApi, Project, ProjectApi >>> cl = Client( - ... url="https://127.0.0.1:8443/rep", username="repadmin", password="repadmin" + ... url="https://127.0.0.1:8443/hps", username="repuser", password="repuser" ... ) >>> project = Project(name="Example Project") >>> print(project) @@ -89,7 +89,7 @@ class ProjectApi: } >>> project_api = ProjectApi(cl, project.id) >>> print(project_api) - 'https://127.0.0.1:8443/rep/jms/api/v1/projects/02qtyJfpfAQ0fr3zkoIAfC' + 'https://127.0.0.1:8443/hps/jms/api/v1/projects/02qtyJfpfAQ0fr3zkoIAfC' >>> jobs = project_api.get_jobs() """ From 69b5c5722628f9aea994852da4372042b62ba5dc Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Mon, 5 Feb 2024 17:55:48 +0100 Subject: [PATCH 02/13] remove rep instances --- doc/source/examples/index.rst | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/source/examples/index.rst b/doc/source/examples/index.rst index 1a17be605..9a33aecdc 100644 --- a/doc/source/examples/index.rst +++ b/doc/source/examples/index.rst @@ -3,14 +3,14 @@ Examples ======== -The examples in this section show how to interact with a REP server in Python using +The examples in this section show how to interact with an HPS server in Python using PyHPS. Each example consists of a Python script plus a data file, such as a solver input file. You can execute many Python scripts with these command-line arguments: -* ``-n``, ``--name``: Name of the REP project -* ``-U``, ``--url``: URL or the REP server (default: https://localhost:8443/rep) -* ``-u``, ``--username``: REP username (default: repadmin) -* ``-p``, ``--password``: REP password (default: repadmin) +* ``-n``, ``--name``: Name of the HPS project +* ``-U``, ``--url``: URL or the HPS server (default: https://localhost:8443/hps) +* ``-u``, ``--username``: HPS username (default: repuser) +* ``-p``, ``--password``: HPS password (default: repuser) * ``-v``, ``--ansys-version``: Ansys version (default: |ansys_version|) A link to download the required resources is available on each example page. If @@ -37,20 +37,20 @@ one :download:`ZIP file <../../../build/pyhps_examples.zip>`. * - Name - Description * - :ref:`example_mapdl_motorbike_frame` - - Create from scratch a REP project consisting of an Ansys APDL beam model of a tubular steel trellis motorbike frame. This example shows how to create a parameter study and submit design points. + - Create from scratch an HPS project consisting of an Ansys APDL beam model of a tubular steel trellis motorbike frame. This example shows how to create a parameter study and submit design points. * - :ref:`example_mapdl_motorbike_frame_query` - Query an existing project and download output files. * - :ref:`example_mapdl_tire_performance` - Submit an MAPDL analysis as a single job. Solution convergence and contact tracking files are periodically collected. * - :ref:`example_mapdl_linked_analyses` - - Submit an MAPDL linked analysis workflow as a multi-task job to the REP server. + - Submit an MAPDL linked analysis workflow as a multi-task job to the HPS server. * - :ref:`example_lsdyna_job` - Submit, monitor, and download results of an LS-DYNA job. * - :ref:`example_fluent_2d_heat_exchanger` - - Submit a Fluent solve job to the REP server. + - Submit a Fluent solve job to the HPS server. * - :ref:`example_fluent_nozzle` - - Submit a Fluent solve job to the REP server using an execution script. + - Submit a Fluent solve job to the HPS server using an execution script. * - :ref:`example_cfx_static_mixer` - - Submit a CFX solve job to the REP server using an execution script. + - Submit a CFX solve job to the HPS server using an execution script. * - :ref:`example_python_two_bar` - - Create a REP project that solves a two-bar truss problem with Python. + - Create an HPS project that solves a two-bar truss problem with Python. From 99eec408dac6ab68a5d8f85a06edf98766e3213e Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Mon, 5 Feb 2024 17:59:00 +0100 Subject: [PATCH 03/13] Remove jms evaluator's leftover --- generate_resources.py | 16 ---------------- src/ansys/hps/client/jms/resource/__init__.py | 1 - 2 files changed, 17 deletions(-) diff --git a/generate_resources.py b/generate_resources.py index 75ca5bdd8..2ec98575a 100644 --- a/generate_resources.py +++ b/generate_resources.py @@ -46,22 +46,6 @@ "class": "Algorithm", "resource_filename": "algorithm", }, - { - "schema": "EvaluatorConfigurationUpdateSchema", - "schema_filename": "evaluator", - "rest_name": None, - "additional_fields": [], - "class": "EvaluatorConfigurationUpdate", - "resource_filename": "evaluator", - }, - { - "schema": "EvaluatorSchema", - "schema_filename": "evaluator", - "rest_name": "evaluators", - "additional_fields": [], - "class": "Evaluator", - "resource_filename": "evaluator", - }, { "schema": "FileSchema", "schema_filename": "file", diff --git a/src/ansys/hps/client/jms/resource/__init__.py b/src/ansys/hps/client/jms/resource/__init__.py index 80c7c525d..0c0a57368 100644 --- a/src/ansys/hps/client/jms/resource/__init__.py +++ b/src/ansys/hps/client/jms/resource/__init__.py @@ -21,7 +21,6 @@ # SOFTWARE. """PyHPS JMS resource subpackage.""" from .algorithm import Algorithm -from .evaluator import Evaluator, EvaluatorConfigurationUpdate from .file import File from .fitness_definition import FitnessDefinition, FitnessTermDefinition from .job import Job From ef4a473d0cce6afdb3d86b6edbcfc4cf8c8ef782 Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Mon, 5 Feb 2024 17:59:16 +0100 Subject: [PATCH 04/13] Remove jms evaluator's leftover --- .../hps/client/jms/resource/evaluator.py | 171 ------------------ src/ansys/hps/client/jms/schema/evaluator.py | 149 --------------- 2 files changed, 320 deletions(-) delete mode 100644 src/ansys/hps/client/jms/resource/evaluator.py delete mode 100644 src/ansys/hps/client/jms/schema/evaluator.py diff --git a/src/ansys/hps/client/jms/resource/evaluator.py b/src/ansys/hps/client/jms/resource/evaluator.py deleted file mode 100644 index c45f44ecd..000000000 --- a/src/ansys/hps/client/jms/resource/evaluator.py +++ /dev/null @@ -1,171 +0,0 @@ -# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# autogenerated code -from marshmallow.utils import missing - -from ansys.hps.client.common import Object - -from ..schema.evaluator import EvaluatorConfigurationUpdateSchema, EvaluatorSchema - - -class EvaluatorConfigurationUpdate(Object): - """Provides for updating an evaluator configuration resource. - - Parameters - ---------- - id : str, optional - Unique ID to access the resource, generated internally by the server on creation. - name : str, optional - Name of the evaluator. - applications : list, optional - max_num_parallel_tasks : int, optional - loop_interval : float, optional - working_directory : str, optional - local_file_cache : bool, optional - local_file_cache_max_size : int, optional - task_directory_cleanup : str, optional - custom_resource_properties : dict, optional - - """ - - class Meta: - schema = EvaluatorConfigurationUpdateSchema - rest_name = "None" - - def __init__( - self, - id=missing, - name=missing, - applications=missing, - max_num_parallel_tasks=missing, - loop_interval=missing, - working_directory=missing, - local_file_cache=missing, - local_file_cache_max_size=missing, - task_directory_cleanup=missing, - custom_resource_properties=missing, - **kwargs - ): - self.id = id - self.name = name - self.applications = applications - self.max_num_parallel_tasks = max_num_parallel_tasks - self.loop_interval = loop_interval - self.working_directory = working_directory - self.local_file_cache = local_file_cache - self.local_file_cache_max_size = local_file_cache_max_size - self.task_directory_cleanup = task_directory_cleanup - self.custom_resource_properties = custom_resource_properties - - self.obj_type = self.__class__.__name__ - - -EvaluatorConfigurationUpdateSchema.Meta.object_class = EvaluatorConfigurationUpdate - - -class Evaluator(Object): - """Provides the evaluator resource. - - Parameters - ---------- - id : str, optional - Unique ID to access the resource, generated internally by the server on creation. - host_id : str - Unique ID built from hardware information and the selected configuration information of the - evaluator. - name : str, optional - Name of the evaluator. - hostname : str, optional - Name of the host that the evaluator is running on. - username : str, optional - HPS user that the evaluator is connected to JMS as. - platform : str, optional - Operating system that the evaluator is running on. - task_manager_type : str, optional - Type of the task manager used by the evaluator. - project_server_select : bool, optional - Whether the evaluator allows server-driven assignment of projects or uses its own - local settings. - alive_update_interval : int, optional - Minimal time in seconds between evaluator registration updates. - update_time : datetime, optional - Last time the evaluator updated its registration information. This parameter is used - to check which evaluators are alive. - external_access_port : int, optional - Port number for external access to the evaluator. - project_assignment_mode : str, optional - Strategy to use for selecting projects to work on. - project_list : list - List of projects that this evaluator should be working on. - configuration : object, optional - Evaluator configuration information, including hardware and available applications. - configuration_updates : EvaluatorConfigurationUpdate, optional - Changes to the evaluator configurations. - build_info : dict, optional - Evaluator's build information. - """ - - class Meta: - schema = EvaluatorSchema - rest_name = "evaluators" - - def __init__( - self, - id=missing, - host_id=missing, - name=missing, - hostname=missing, - username=missing, - platform=missing, - task_manager_type=missing, - project_server_select=missing, - alive_update_interval=missing, - update_time=missing, - external_access_port=missing, - project_assignment_mode=missing, - project_list=missing, - configuration=missing, - configuration_updates=missing, - build_info=missing, - **kwargs - ): - self.id = id - self.host_id = host_id - self.name = name - self.hostname = hostname - self.username = username - self.platform = platform - self.task_manager_type = task_manager_type - self.project_server_select = project_server_select - self.alive_update_interval = alive_update_interval - self.update_time = update_time - self.external_access_port = external_access_port - self.project_assignment_mode = project_assignment_mode - self.project_list = project_list - self.configuration = configuration - self.configuration_updates = configuration_updates - self.build_info = build_info - - self.obj_type = self.__class__.__name__ - - -EvaluatorSchema.Meta.object_class = Evaluator diff --git a/src/ansys/hps/client/jms/schema/evaluator.py b/src/ansys/hps/client/jms/schema/evaluator.py deleted file mode 100644 index 87ca2507b..000000000 --- a/src/ansys/hps/client/jms/schema/evaluator.py +++ /dev/null @@ -1,149 +0,0 @@ -# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -"""Module providing evaluator configuration update schema.""" - -import marshmallow -from marshmallow import fields -from marshmallow.validate import OneOf - -from ansys.hps.client.common import ObjectSchema, RestrictedValue - -project_assignment_modes = ["disabled", "all_active", "project_list"] - - -class EvaluatorConfigurationUpdateSchema(ObjectSchema): - class Meta: - ordered = True - - name = fields.String(allow_none=True) - applications = fields.List(fields.Dict(), allow_none=True) - max_num_parallel_tasks = fields.Integer(allow_none=True) - loop_interval = fields.Float(allow_none=True) - working_directory = fields.String(allow_none=True) - local_file_cache = fields.Boolean(allow_none=True) - local_file_cache_max_size = fields.Integer(allow_none=True) - task_directory_cleanup = fields.String( - validate=OneOf(["always", "on_success", "never"]), allow_none=True - ) - custom_resource_properties = fields.Dict(allow_none=True) - - -class EvaluatorRegistrationConfigurationContextSchema(marshmallow.Schema): - class Meta: - unknown = marshmallow.INCLUDE - - custom = fields.Dict(allow_none=True, keys=fields.Str(), values=RestrictedValue()) - - -class EvaluatorRegistrationConfigurationResourcesSchema(marshmallow.Schema): - class Meta: - unknown = marshmallow.INCLUDE - - custom = fields.Dict(allow_none=True, keys=fields.Str(), values=RestrictedValue()) - - -class EvaluatorRegistrationConfigurationSchema(marshmallow.Schema): - class Meta: - unknown = marshmallow.INCLUDE - - context = fields.Nested(EvaluatorRegistrationConfigurationContextSchema, allow_none=True) - resources = fields.Nested(EvaluatorRegistrationConfigurationResourcesSchema, allow_none=True) - - -class EvaluatorSchema(ObjectSchema): - class Meta: - ordered = True - - host_id = fields.String( - metadata={ - "description": "Unique identifier built from hardware information and " - "selected configuration details of an evaluator." - } - ) - name = fields.String(allow_none=True, metadata={"description": "Name of the evaluator."}) - hostname = fields.String( - allow_none=True, - metadata={"description": "Name of the host on which the evaluator is running."}, - ) - username = fields.String( - allow_none=True, - metadata={"description": "HPS user that the evaluator is connected to JMS as."}, - ) - platform = fields.String( - allow_none=True, - metadata={"description": "Operating system on which the evaluator is running."}, - ) - task_manager_type = fields.String( - allow_none=True, metadata={"description": "Type of the task manager used by the evaluator."} - ) - project_server_select = fields.Bool( - allow_none=True, - metadata={ - "description": "Whether the evaluator allows " - "server-driven assignment of projects or uses " - "it's own local settings." - }, - ) - alive_update_interval = fields.Int( - allow_none=True, - metadata={ - "description": "Minimal time (in seconds) between evaluator registration updates." - }, - ) - update_time = fields.DateTime( - allow_none=True, - load_only=True, - metadata={ - "description": "Last time the evaluator updated it's registration details. " - "Used to check which evaluators are alive." - }, - ) - external_access_port = fields.Integer( - allow_none=True, - metadata={"description": "Port number for external access to the evaluator."}, - ) - project_assignment_mode = fields.String( - validate=OneOf(project_assignment_modes), - allow_none=True, - metadata={"description": "Which strategy to use for selecting projects to work on."}, - ) - project_list = fields.List( - fields.String, - metadata={"description": "List of projects on which this evaluator should be working."}, - ) - configuration = fields.Nested( - EvaluatorRegistrationConfigurationSchema, - allow_none=True, - metadata={ - "description": "Details of the evaluator configuration, " - "including hardware info and available applications." - }, - ) - configuration_updates = fields.Nested( - EvaluatorConfigurationUpdateSchema, - allow_none=True, - metadata={"description": "Changes to the evaluator configurations."}, - ) - build_info = fields.Dict( - allow_none=True, - metadata={"description": "Evaluator's build information."}, - ) From 993fcd367b0143ff04be55e7018950ab9fd3c9e0 Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Mon, 5 Feb 2024 18:02:08 +0100 Subject: [PATCH 05/13] don't use client.rep_url --- examples/cfx_static_mixer/project_setup.py | 2 +- examples/fluent_2d_heat_exchanger/project_setup.py | 4 ++-- examples/fluent_nozzle/project_setup.py | 2 +- examples/lsdyna_cylinder_plate/lsdyna_job.py | 4 ++-- examples/mapdl_linked_analyses/project_setup.py | 2 +- examples/mapdl_motorbike_frame/project_query.py | 2 +- examples/mapdl_motorbike_frame/project_setup.py | 2 +- examples/mapdl_motorbike_frame/task_files.py | 2 +- examples/mapdl_tyre_performance/project_setup.py | 2 +- tests/jms/test_project_permissions.py | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/cfx_static_mixer/project_setup.py b/examples/cfx_static_mixer/project_setup.py index a5b7f9c84..56a145dbe 100644 --- a/examples/cfx_static_mixer/project_setup.py +++ b/examples/cfx_static_mixer/project_setup.py @@ -186,7 +186,7 @@ def create_project(client, name, num_jobs=20, version=__ansys_apps_version__): try: log.info("Connect to HPC Platform Services") client = Client(url=args.url, username=args.username, password=args.password) - log.info(f"HPS URL: {client.rep_url}") + log.info(f"HPS URL: {client.url}") proj = create_project( client=client, name=args.name, num_jobs=args.num_jobs, version=args.ansys_version ) diff --git a/examples/fluent_2d_heat_exchanger/project_setup.py b/examples/fluent_2d_heat_exchanger/project_setup.py index bf6bda77d..78827930e 100644 --- a/examples/fluent_2d_heat_exchanger/project_setup.py +++ b/examples/fluent_2d_heat_exchanger/project_setup.py @@ -140,7 +140,7 @@ def create_project( log.info(f"Created project '{proj.name}', ID='{proj.id}'") log.info( f"You can monitor the job status at " - f"{project_api.client.rep_url}/jms/#/projects/{project_api.project_id}/jobs/{job.id}" + f"{project_api.client.url}/jms/#/projects/{project_api.project_id}/jobs/{job.id}" ) return proj @@ -164,7 +164,7 @@ def create_project( client = Client(url=args.url, username=args.username, password=args.password) try: - log.info(f"HPS URL: {client.rep_url}") + log.info(f"HPS URL: {client.url}") proj = create_project( client=client, name=args.name, diff --git a/examples/fluent_nozzle/project_setup.py b/examples/fluent_nozzle/project_setup.py index 22c5100c1..00e6116a2 100644 --- a/examples/fluent_nozzle/project_setup.py +++ b/examples/fluent_nozzle/project_setup.py @@ -218,7 +218,7 @@ def create_project(client, name, num_jobs=20, version=__ansys_apps_version__): try: log.info("Connect to HPC Platform Services") client = Client(url=args.url, username=args.username, password=args.password) - log.info(f"HPS URL: {client.rep_url}") + log.info(f"HPS URL: {client.url}") proj = create_project( client=client, name=args.name, num_jobs=args.num_jobs, version=args.ansys_version ) diff --git a/examples/lsdyna_cylinder_plate/lsdyna_job.py b/examples/lsdyna_cylinder_plate/lsdyna_job.py index 1526ab859..af193b918 100644 --- a/examples/lsdyna_cylinder_plate/lsdyna_job.py +++ b/examples/lsdyna_cylinder_plate/lsdyna_job.py @@ -281,7 +281,7 @@ def submit_job(use_exec_script=False) -> REPJob: app_job.project_id = proj.id app_job.job_definition_id = job_def.id app_job.job_id = job.id - app_job.rep_url = client.rep_url + app_job.rep_url = client.url app_job.auth_token = client.refresh_token tasks = project_api.get_tasks(job_id=job.id) @@ -306,7 +306,7 @@ def monitor_job(app_job: REPJob): time.sleep(2) log.info( f"Waiting for job {job.name} to complete " - f"[{client.rep_url}/jms/#/projects/{app_job.project_id}/jobs/{job.id}] ... " + f"[{client.url}/jms/#/projects/{app_job.project_id}/jobs/{job.id}] ... " ) job = project_api.get_jobs(id=job.id)[0] diff --git a/examples/mapdl_linked_analyses/project_setup.py b/examples/mapdl_linked_analyses/project_setup.py index a2c50583b..53d6c2fdc 100644 --- a/examples/mapdl_linked_analyses/project_setup.py +++ b/examples/mapdl_linked_analyses/project_setup.py @@ -314,7 +314,7 @@ def create_project( ) -> Project: log.info("=== HPS connection") - log.info(f"Client connected at {client.rep_url}") + log.info(f"Client connected at {client.url}") log.info("=== Create new Project") if incremental: diff --git a/examples/mapdl_motorbike_frame/project_query.py b/examples/mapdl_motorbike_frame/project_query.py index f90dd9b27..bd7690e85 100644 --- a/examples/mapdl_motorbike_frame/project_query.py +++ b/examples/mapdl_motorbike_frame/project_query.py @@ -148,7 +148,7 @@ def download_files(client, project_name): try: log.info("Connect to HPC Platform Services") client = Client(url=args.url, username=args.username, password=args.password) - log.info(f"HPS URL: {client.rep_url}") + log.info(f"HPS URL: {client.url}") query_stats(client=client, project_name=args.name) download_files(client=client, project_name=args.name) diff --git a/examples/mapdl_motorbike_frame/project_setup.py b/examples/mapdl_motorbike_frame/project_setup.py index e5d35992b..d9306ef09 100644 --- a/examples/mapdl_motorbike_frame/project_setup.py +++ b/examples/mapdl_motorbike_frame/project_setup.py @@ -364,7 +364,7 @@ def create_project( try: log.info("Connect to HPC Platform Services") client = Client(url=args.url, username=args.username, password=args.password) - log.info(f"HPS URL: {client.rep_url}") + log.info(f"HPS URL: {client.url}") proj = create_project( client=client, name=args.name, diff --git a/examples/mapdl_motorbike_frame/task_files.py b/examples/mapdl_motorbike_frame/task_files.py index 3b2c74bab..d2b7b5277 100644 --- a/examples/mapdl_motorbike_frame/task_files.py +++ b/examples/mapdl_motorbike_frame/task_files.py @@ -153,7 +153,7 @@ def modify_task_files(client, project_name): try: log.info("Connect to HPC Platform Services") client = Client(url=args.url, username=args.username, password=args.password) - log.info(f"HPS URL: {client.rep_url}") + log.info(f"HPS URL: {client.url}") modify_task_files(client=client, project_name=args.name) except HPSError as e: diff --git a/examples/mapdl_tyre_performance/project_setup.py b/examples/mapdl_tyre_performance/project_setup.py index b80293dc3..cfd231ba8 100644 --- a/examples/mapdl_tyre_performance/project_setup.py +++ b/examples/mapdl_tyre_performance/project_setup.py @@ -277,7 +277,7 @@ def create_project( client = Client(url=args.url, username=args.username, password=args.password) try: - log.info(f"HPS URL: {client.rep_url}") + log.info(f"HPS URL: {client.url}") proj = create_project( client=client, name=args.name, diff --git a/tests/jms/test_project_permissions.py b/tests/jms/test_project_permissions.py index f32f0a366..42569a29a 100644 --- a/tests/jms/test_project_permissions.py +++ b/tests/jms/test_project_permissions.py @@ -127,7 +127,7 @@ def test_modify_project_permissions(client, keycloak_client): username=user1.username, password=user_credentials["user1"]["password"], ) - log.info(f"Client connected at {client1.rep_url} with user {user1.username}") + log.info(f"Client connected at {client1.url} with user {user1.username}") root_api1 = JmsApi(client1) proj = Project(name=proj_name, priority=1, active=True) From c5c426d7b928c53764b6a9c60963ef242938280f Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Mon, 5 Feb 2024 21:41:04 +0100 Subject: [PATCH 06/13] expose hps version as input --- .github/workflows/ci_cd.yml | 7 +++++++ .github/workflows/tests.yml | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index d802ce232..61c6e76b8 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -1,6 +1,12 @@ name: GitHub CI on: workflow_dispatch: + inputs: + hps-version: + description: HPS version to test against + default: '1.0.2' + type: string + pull_request: push: tags: @@ -61,6 +67,7 @@ jobs: python-version: ${{ matrix.cfg.python-version }} toxenv: ${{ matrix.cfg.toxenv }} runner: ${{ matrix.os }} + hps-version: v${{ inputs.hps-version || '1.0.2' }} docs: name: Documentation diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f617ab3fc..575003511 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,8 +14,11 @@ on: runner: description: Where to run type: string - required: true default: 'ubuntu-latest' + hps-version: + description: HPS version to test against + type: string + default: 'v1.0.2' jobs: @@ -40,7 +43,7 @@ jobs: file: 'docker-compose-internal.tar.gz' target: 'docker-compose-artifact/docker-compose-internal.tar.gz' repo: ansys-internal/rep-deployments - version: 'tags/v1.0.2' + version: tags/${{ inputs.hps-version }} token: ${{secrets.PYANSYS_CI_BOT_TOKEN}} - uses: KengoTODA/actions-setup-docker-compose@main From 1269827c1a000be9129d9a5b3983da9d4bc86203 Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Mon, 5 Feb 2024 21:53:42 +0100 Subject: [PATCH 07/13] fix import --- src/ansys/hps/client/jms/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ansys/hps/client/jms/__init__.py b/src/ansys/hps/client/jms/__init__.py index 384214900..49461279a 100644 --- a/src/ansys/hps/client/jms/__init__.py +++ b/src/ansys/hps/client/jms/__init__.py @@ -25,8 +25,6 @@ from .resource import ( Algorithm, BoolParameterDefinition, - Evaluator, - EvaluatorConfigurationUpdate, File, FitnessDefinition, FitnessTermDefinition, From 715017116d2087415b7e471789bb807074c1542d Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Mon, 5 Feb 2024 21:54:08 +0100 Subject: [PATCH 08/13] limit smoke tests --- .github/workflows/ci_cd.yml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 61c6e76b8..008c42026 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -107,19 +107,33 @@ jobs: retention-days: 7 smoke-tests: + if: ${{ !(github.event_name == 'push' && contains(github.ref, 'refs/tags')) }} name: Build and Smoke tests runs-on: ${{ matrix.os }} needs: [style] + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: ['3.10'] + steps: + - name: Build wheelhouse and perform smoke test + uses: ansys/actions/build-wheelhouse@v5 + with: + library-name: ${{ env.PACKAGE_NAME }} + operating-system: ${{ matrix.os }} + python-version: ${{ matrix.python-version }} + + smoke-tests-release: + if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }} + name: Build and Smoke tests for release + runs-on: ${{ matrix.os }} + needs: [style] strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] python-version: ['3.9', '3.10', '3.11', '3.12'] - should-release: - - ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }} - exclude: - - should-release: false - os: macos-latest steps: - name: Build wheelhouse and perform smoke test uses: ansys/actions/build-wheelhouse@v5 From 0a2ab2232d0418e44757897212afbc5c09884e2e Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Mon, 5 Feb 2024 22:06:08 +0100 Subject: [PATCH 09/13] update readme doc links --- README.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index e77ac214f..967b9122d 100644 --- a/README.rst +++ b/README.rst @@ -47,7 +47,7 @@ Documentation and issues ------------------------ Documentation for the latest stable release of PyHPS is hosted at -`PyHPS documentation `_. +`PyHPS documentation `_. In the upper right corner of the documentation's title bar, there is an option for switching from viewing the documentation for the latest stable release @@ -56,16 +56,16 @@ released versions. The PyHPS documentation contains these sections: -- `Getting started `_: Explains +- `Getting started `_: Explains how to install PyHPS in user mode. -- `User guide `_: Describes the basics +- `User guide `_: Describes the basics of how to use PyHPS to interact with Ansys HPS. -- `Examples `_: Provides examples of how +- `Examples `_: Provides examples of how to interact with a Remote Execution Platform (REP) server in Python using PyHPS. -- `API reference `_: Describes PyHPS functions, +- `API reference `_: Describes PyHPS functions, classes, methods, and their parameters and return values so that you can understand how to interact with them programmatically -- `Contribute _`: Provides information on +- `Contribute _`: Provides information on how to install PyHPS in developer mode and make contributions to the codebase. On the `PyHPS Issues `_ page, you can From f52c3e4995f755620532daa47b06d28db4f5f1ef Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Mon, 5 Feb 2024 22:20:04 +0100 Subject: [PATCH 10/13] tests services and print build info to summary --- .github/workflows/tests.yml | 4 +++ .gitignore | 3 +- tests/conftest.py | 5 +++ tests/test_services.py | 71 +++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 tests/test_services.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 575003511..fd1bb7c0d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -92,6 +92,10 @@ jobs: check_name: Test Report ${{ inputs.runner }}:${{ inputs.python-version }} detailed_summary: true include_passed: true + + - name: Publish services info to summary + if: success() || failure() + run: cat build_info.md >> $GITHUB_STEP_SUMMARY - name: Stop services if: always() diff --git a/.gitignore b/.gitignore index c0ba8cc93..958366d9a 100644 --- a/.gitignore +++ b/.gitignore @@ -162,4 +162,5 @@ cython_debug/ doc/source/api/schemas test_results*.xml mapdl_motorbike_frame.zip -examples/mapdl_motorbike_frame/task_input_file* \ No newline at end of file +examples/mapdl_motorbike_frame/task_input_file* +build_info.* \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index 1b6c9acbf..7f3f97e07 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -98,3 +98,8 @@ def run_id(): agent_id = os.environ.get("HOSTNAME", "localhost") build_id = os.environ.get("Build.BuildId", "1") return f"{agent_id}_{build_id}".lower() + + +@pytest.fixture +def build_info_path(): + return os.path.join(os.getcwd(), "build_info.json") diff --git a/tests/test_services.py b/tests/test_services.py new file mode 100644 index 000000000..603dd92ca --- /dev/null +++ b/tests/test_services.py @@ -0,0 +1,71 @@ +# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import json +import logging + +import pytest + +from ansys.hps.client import Client +from ansys.hps.client.jms import JmsApi +from ansys.hps.client.rms import RmsApi + +log = logging.getLogger(__name__) + + +@pytest.mark.order(1) +def test_services(client: Client, build_info_path: str): + # make sure services are up and running, print info + + # check jms api + jms_api = JmsApi(client) + jms_info = jms_api.get_api_info() + log.info(f"JMS api info\n{json.dumps(jms_info, indent=2)}") + assert "build" in jms_info + assert "services" in jms_info + assert "auth_url" in jms_info["services"] + assert "settings" in jms_info + assert "execution_script_bucket" in jms_info["settings"] + assert "execution_script_default_bucket" in jms_info["settings"] + + # check file storage api + r = client.session.get(f"{client.rep_url}/fs/api/v1") + fs_info = r.json() + log.info(f"FS api info\n{json.dumps(fs_info, indent=2)}") + assert "build" in fs_info + + # check rms api + rms_api = RmsApi(client) + rms_info = rms_api.get_api_info() + log.info(f"RMS api info\n{json.dumps(rms_info, indent=2)}") + assert "build" in rms_info + assert "version" in rms_info["build"] + + info = {"jms": jms_info, "fs": fs_info, "rms": rms_info} + with open(build_info_path, "w") as f: + f.write(json.dumps(info, indent=2)) + + with open(build_info_path.replace(".json", ".md"), "w") as f: + f.write(f"### Build info") + f.write(f"\n```json\n") + f.write(json.dumps(info, indent=2)) + f.write(f"\n```") From 36f742cfec845f6409cc5d2b5ae2aa83985ed990 Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Mon, 5 Feb 2024 22:35:17 +0100 Subject: [PATCH 11/13] use customer package --- .github/workflows/tests.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fd1bb7c0d..019abf312 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,8 +40,8 @@ jobs: - uses: dsaltares/fetch-gh-release-asset@master name: Download Services Artifact with: - file: 'docker-compose-internal.tar.gz' - target: 'docker-compose-artifact/docker-compose-internal.tar.gz' + file: 'docker-compose-customer.tar.gz' + target: 'docker-compose-artifact/docker-compose-customer.tar.gz' repo: ansys-internal/rep-deployments version: tags/${{ inputs.hps-version }} token: ${{secrets.PYANSYS_CI_BOT_TOKEN}} @@ -62,17 +62,16 @@ jobs: ls -la tar -xvzf docker-compose-internal.tar.gz cd docker-compose - FSGATEWAY_TAG=latest-dev JMS_TAG=latest-dev docker-compose pull - FSGATEWAY_TAG=latest-dev JMS_TAG=latest-dev LOCALHOST_ADDR=localhost docker-compose up -d keycloak + docker-compose build + docker-compose up -d echo "Waiting a few sec ..." sleep 5 - FSGATEWAY_TAG=latest-dev JMS_TAG=latest-dev LOCALHOST_ADDR=localhost docker-compose up -d working-directory: ./docker-compose-artifact - name: Test with tox run: tox -e ${{ inputs.toxenv }}-coverage env: - HPS_TEST_URL: https://localhost:8443/rep + HPS_TEST_URL: https://localhost:8443/hps HPS_TEST_USERNAME: repadmin HPS_TEST_PASSWORD: repadmin From 700de036d5fc8cad6be8ca6a12933604d65bef09 Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Mon, 5 Feb 2024 22:37:06 +0100 Subject: [PATCH 12/13] fix file name --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 019abf312..b4ff574a3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -60,7 +60,7 @@ jobs: - name: Start services run: | ls -la - tar -xvzf docker-compose-internal.tar.gz + tar -xvzf docker-compose-customer.tar.gz cd docker-compose docker-compose build docker-compose up -d From bf2c605edd28aee7e3f80989395e63b22fd66a7f Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Mon, 5 Feb 2024 22:38:39 +0100 Subject: [PATCH 13/13] fix path --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b4ff574a3..7eb58db9a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -61,7 +61,7 @@ jobs: run: | ls -la tar -xvzf docker-compose-customer.tar.gz - cd docker-compose + cd docker-compose-customer docker-compose build docker-compose up -d echo "Waiting a few sec ..." @@ -100,4 +100,4 @@ jobs: if: always() run: | docker-compose down -v - working-directory: ./docker-compose-artifact/docker-compose + working-directory: ./docker-compose-artifact/docker-compose-customer