Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rep-deployments] Improve basic url's used ../rep -> ../hps #261

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Test with tox
run: tox -e ${{ matrix.cfg.toxenv }}-noeval-coverage
env:
REP_TEST_URL: https://localhost:8443/rep
REP_TEST_URL: https://localhost:8443/hps
REP_TEST_USERNAME: repadmin
REP_TEST_PASSWORD: repadmin

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
- name: Test with tox
run: tox -e ${{ matrix.cfg.toxenv }}-noeval-coverage
env:
REP_TEST_URL: https://localhost:8443/rep
REP_TEST_URL: https://localhost:8443/hps
REP_TEST_USERNAME: repadmin
REP_TEST_PASSWORD: repadmin

Expand Down
2 changes: 1 addition & 1 deletion ansys/hps/client/auth/api/auth_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class AuthApi:
>>> from ansys.hps.client import Client
>>> from ansys.hps.client.auth import AuthApi, User
>>> cl = Client(
... rep_url="https://127.0.0.1:8443/rep/", username="repadmin", password="repadmin"
... rep_url="https://127.0.0.1:8443/hps/", username="repadmin", password="repadmin"
... )
>>> auth_api = AuthApi(cl)
>>> users = auth_api.get_users(firstName="john", exact=False)
Expand Down
4 changes: 2 additions & 2 deletions ansys/hps/client/auth/authenticate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


def authenticate(
url: str = "https://127.0.0.1:8443/rep",
url: str = "https://127.0.0.1:8443/hps",
realm: str = "rep",
grant_type: str = "password",
scope="openid",
Expand All @@ -38,7 +38,7 @@ def authenticate(
----------

url : str
The base path for the server to call, e.g. "https://127.0.0.1:8443/rep".
The base path for the server to call, e.g. "https://127.0.0.1:8443/hps".
realm : str
Keycloak realm, defaults to 'rep'.
grant_type: str
Expand Down
8 changes: 4 additions & 4 deletions ansys/hps/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Client(object):
Parameters
----------
url : str
The base path for the server to call, e.g. "https://127.0.0.1:8443/rep".
The base path for the server to call, e.g. "https://127.0.0.1:8443/hps".
username : str, optional
Username
password : str, optional
Expand Down Expand Up @@ -70,15 +70,15 @@ class Client(object):

>>> from ansys.hps.client import Client
>>> cl = Client(
... url="https://localhost:8443/rep",
... url="https://localhost:8443/hps",
... username="repuser",
... password="repuser"
... )

Create client object and connect to HPS with refresh token

>>> cl = Client(
... url="https://localhost:8443/rep",
... url="https://localhost:8443/hps",
... username="repuser",
... refresh_token="eyJhbGciOiJIUzI1NiIsInR5cC..."
>>> )
Expand All @@ -87,7 +87,7 @@ class Client(object):

def __init__(
self,
url: str = "https://127.0.0.1:8443/rep",
url: str = "https://127.0.0.1:8443/hps",
username: str = None,
password: str = None,
*,
Expand Down
4 changes: 2 additions & 2 deletions ansys/hps/client/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ def __init__(self, *args, **kwargs):
>>> from ansys.hps.client import HPSError
>>> from ansys.hps.client.jms import Client
>>> try:
>>> client = Client(rep_url="https://127.0.0.1:8443/rep/",
>>> client = Client(rep_url="https://127.0.0.1:8443/hps/",
username="repadmin",
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)
Expand Down
2 changes: 1 addition & 1 deletion ansys/hps/client/jms/api/jms_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class JmsApi(object):
>>> from ansys.hps.client import Client
>>> from ansys.hps.client.jms import JmsApi, Project
>>> cl = Client(
... rep_url="https://127.0.0.1:8443/rep", username="repadmin", password="repadmin"
... rep_url="https://127.0.0.1:8443/hps", username="repadmin", password="repadmin"
... )
>>> jms_api = JmsApi(cl)
>>> project = jms_api.create_project(Project(name="Example Project"))
Expand Down
4 changes: 2 additions & 2 deletions ansys/hps/client/jms/api/project_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ProjectApi:
>>> from ansys.hps.client import Client
>>> from ansys.hps.client.jms import JmsApi, Project, ProjectApi
>>> cl = Client(
... rep_url="https://127.0.0.1:8443/rep", username="repadmin", password="repadmin"
... rep_url="https://127.0.0.1:8443/hps", username="repadmin", password="repadmin"
... )
>>> project = Project(name="Example Project")
>>> print(project)
Expand All @@ -67,7 +67,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()

"""
Expand Down
2 changes: 1 addition & 1 deletion ansys/hps/client/rms/api/rms_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def update_evaluator_configuration(
>>> from ansys.hps.client import Client
>>> from ansys.hps.client.jms import RmsApi, EvaluatorConfigurationUpdate
>>> cl = Client(
... rep_url="https://localhost:8443/rep", username="repuser", password="repuser"
... rep_url="https://localhost:8443/hps", username="repuser", password="repuser"
... )
>>> rms_api = RmsApi(cl)
>>> query_params = {
Expand Down
2 changes: 1 addition & 1 deletion doc/source/api/auth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Authentication Service
The REP Authentication Service processes all REP sign ins following OAuth 2.0 resource owner password credentials flow.
When you enter your REP credentials, you get an access token (expiring after 24 hours) and a refresh token for authenticating all services.

The ``ansys.hps.client.auth`` subpackage wraps around the Authentication Service REST API available at ``https://hostname:port/rep/auth/api``.
The ``ansys.hps.client.auth`` subpackage wraps around the Authentication Service REST API available at ``https://hostname:port/hps/auth/api``.

Authentication function
------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/source/api/jms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Job Management Service

Ansys REP includes Job Management Service (JMS), which is the main service for storing and evaluating jobs using multiple heterogeneous compute resources.

The Python subpackage ``ansys.hps.client.jms`` wraps around the JMS service REST API available at ``https://hostname:port/rep/jms/api``.
The Python subpackage ``ansys.hps.client.jms`` wraps around the JMS service REST API available at ``https://hostname:port/hps/jms/api``.

APIs
--------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/source/api/rms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Resource Management Service

Ansys REP includes the Resource Management Service (JMS), which is the main service for managing heterogeneous compute resources.

The Python subpackage ``ansys.hps.client.rms`` wraps around the RMS service REST API available at ``https://hostname:port/rep/rms/api``.
The Python subpackage ``ansys.hps.client.rms`` wraps around the RMS service REST API available at ``https://hostname:port/hps/rms/api``.

APIs
--------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/source/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Examples consist of a Python script plus some data files (e.g. solver input file
Many of the Python scripts can be executed with the following command line arguments:

* ``-n``, ``--name``: name of the REP project
* ``-U``, ``--url``: url or the REP server (default: https://localhost:8443/rep)
* ``-U``, ``--url``: url or the REP server (default: https://localhost:8443/hps)
* ``-u``, ``--username``: REP username (default: repadmin)
* ``-p``, ``--password``: REP password (default: repadmin)
* ``-v``, ``--ansys-version``: Ansys version (default: |ansys_version|)
Expand Down
10 changes: 5 additions & 5 deletions doc/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Let's start by connecting to a REP server running on the localhost with default
from ansys.hps.client import Client
from ansys.hps.client.jms import JmsApi, ProjectApi

client = Client(rep_url="https://localhost:8443/rep", username="repuser", password="repuser")
client = Client(rep_url="https://localhost:8443/hps", username="repuser", password="repuser")

# check which JMS version the server is running
jms_api = JmsApi(client)
Expand Down Expand Up @@ -286,7 +286,7 @@ Admin users with the Keycloak "manage-users" role can create new users as well a
from ansys.hps.client import Client
from ansys.hps.client.auth import AuthApi, User

client = Client(rep_url="https://localhost:8443/rep/", username="repadmin", password="repadmin")
client = Client(rep_url="https://localhost:8443/hps/", username="repadmin", password="repadmin")
auth_api = AuthApi(client)

# modify the default password of the repadmin user
Expand Down Expand Up @@ -321,12 +321,12 @@ For example, instantiating a client with invalid credentials will return a 401 C
from ansys.hps.client import Client, HPSError

try:
client = Client(rep_url="https://localhost:8443/rep/", username="repuser", password="wrong_psw")
client = Client(rep_url="https://localhost:8443/hps/", username="repuser", password="wrong_psw")
except HPSError as e:
print(e)

#Output:
# 401 Client Error: invalid_grant for: POST https://localhost:8443/rep/auth/realms/rep/protocol/openid-connect/token
# 401 Client Error: invalid_grant for: POST https://localhost:8443/hps/auth/realms/rep/protocol/openid-connect/token
# Invalid user credentials

A *get* call on a non-existing resource will return a 404 Client Error.
Expand All @@ -342,4 +342,4 @@ A *get* call on a non-existing resource will return a 404 Client Error.
print(e)

#Output:
#404 Client Error: Not Found for: GET https://localhost:8443/rep//jms/api/v1/projects/non_existing_project
#404 Client Error: Not Found for: GET https://localhost:8443/rep/jms/api/v1/projects/non_existing_project
4 changes: 2 additions & 2 deletions examples/authorization_grant/authorization_grant.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

client_id = "rep-cli"
scope = "openid"
base_url = "https://localhost:8443/rep/auth/realms/rep"
base_url = "https://localhost:8443/hps/auth/realms/rep"
authorization_endpoint = f"{base_url}/protocol/openid-connect/auth"
token_endpoint = f"{base_url}/protocol/openid-connect/token"

Expand Down Expand Up @@ -114,7 +114,7 @@ async def on_get(self, req, resp):
if args.mode == "web":
redirect_uri = "http://localhost:9999/token-info"
else:
redirect_uri = "https://localhost:8443/rep/jms/api/v1"
redirect_uri = "https://localhost:8443/hps/jms/api/v1"

client = AsyncOAuth2Client(client_id, scope=scope, verify=False)
uri, state = client.create_authorization_url(authorization_endpoint, redirect_uri=redirect_uri)
Expand Down
2 changes: 1 addition & 1 deletion examples/cfx_static_mixer/project_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def create_project(client, name, num_jobs=20, version=__ansys_apps_version__):
parser = argparse.ArgumentParser()
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", "--url", default="https://127.0.0.1:8443/hps")
parser.add_argument("-u", "--username", default="repadmin")
parser.add_argument("-p", "--password", default="repadmin")
parser.add_argument("-v", "--ansys-version", default=__ansys_apps_version__)
Expand Down
2 changes: 1 addition & 1 deletion examples/fluent_2d_heat_exchanger/project_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def create_project(
parser = argparse.ArgumentParser()
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", "--url", default="https://localhost:8443/hps")
parser.add_argument("-u", "--username", default="repadmin")
parser.add_argument("-p", "--password", default="repadmin")
parser.add_argument("-v", "--ansys-version", default=__ansys_apps_version__)
Expand Down
2 changes: 1 addition & 1 deletion examples/fluent_nozzle/project_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def create_project(client, name, num_jobs=20, version=__ansys_apps_version__):
parser.add_argument("-n", "--name", type=str, default="fluent_nozzle")
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", "--url", default="https://127.0.0.1:8443/hps")
parser.add_argument("-u", "--username", default="repadmin")
parser.add_argument("-p", "--password", default="repadmin")
parser.add_argument("-v", "--ansys-version", default=__ansys_apps_version__)
Expand Down
2 changes: 1 addition & 1 deletion examples/lsdyna_cylinder_plate/lsdyna_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

log = logging.getLogger(__name__)

REP_URL = "https://localhost:8443/rep"
REP_URL = "https://localhost:8443/hps"
USERNAME = "repadmin"
PASSWORD = "repadmin"
USE_LSDYNA_MPP = False
Expand Down
2 changes: 1 addition & 1 deletion examples/mapdl_linked_analyses/project_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def create_project(
parser = argparse.ArgumentParser()
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", "--url", default="https://localhost:8443/hps")
parser.add_argument("-u", "--username", default="repadmin")
parser.add_argument("-p", "--password", default="repadmin")
parser.add_argument("--incremental", action="store_true")
Expand Down
2 changes: 1 addition & 1 deletion examples/mapdl_motorbike_frame/project_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def download_files(client, project_name):
parser = argparse.ArgumentParser()
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", "--url", default="https://127.0.0.1:8443/hps")
parser.add_argument("-u", "--username", default="repadmin")
parser.add_argument("-p", "--password", default="repadmin")
args = parser.parse_args()
Expand Down
2 changes: 1 addition & 1 deletion examples/mapdl_motorbike_frame/project_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def create_project(
parser.add_argument("-n", "--name", type=str, default="Mapdl Motorbike Frame")
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", "--url", default="https://127.0.0.1:8443/hps")
parser.add_argument("-u", "--username", default="repadmin")
parser.add_argument("-p", "--password", default="repadmin")
parser.add_argument("-v", "--ansys-version", default=__ansys_apps_version__)
Expand Down
2 changes: 1 addition & 1 deletion examples/mapdl_motorbike_frame/task_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def modify_task_files(client, project_name):
parser = argparse.ArgumentParser()
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", "--url", default="https://127.0.0.1:8443/hps")
parser.add_argument("-u", "--username", default="repadmin")
parser.add_argument("-p", "--password", default="repadmin")
args = parser.parse_args()
Expand Down
2 changes: 1 addition & 1 deletion examples/mapdl_tyre_performance/project_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def create_project(
parser.add_argument("-n", "--name", type=str, default="Mapdl Tyre Performance")
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", "--url", default="https://localhost:8443/hps")
parser.add_argument("-u", "--username", default="repadmin")
parser.add_argument("-p", "--password", default="repadmin")
parser.add_argument("-v", "--ansys-version", default=__ansys_apps_version__)
Expand Down
2 changes: 1 addition & 1 deletion examples/python_linked_multi_process_step/project_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def main(client, num_task_definitions, num_jobs, start, inactive):
logging.basicConfig(format="[%(asctime)s | %(levelname)s] %(message)s", level=logging.DEBUG)

parser = argparse.ArgumentParser()
parser.add_argument("-U", "--url", default="https://127.0.0.1:8443/rep")
parser.add_argument("-U", "--url", default="https://127.0.0.1:8443/hps")
parser.add_argument("-u", "--username", default="repadmin")
parser.add_argument("-p", "--password", default="repadmin")
parser.add_argument("-j", "--num-jobs", type=int, default=10)
Expand Down
2 changes: 1 addition & 1 deletion examples/python_multi_process_step/project_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def main(
logging.basicConfig(format="[%(asctime)s | %(levelname)s] %(message)s", level=logging.DEBUG)

parser = argparse.ArgumentParser()
parser.add_argument("-U", "--url", default="https://127.0.0.1:8443/rep")
parser.add_argument("-U", "--url", default="https://127.0.0.1:8443/hps")
parser.add_argument("-u", "--username", default="repadmin")
parser.add_argument("-p", "--password", default="repadmin")
parser.add_argument("-n", "--num-jobs", type=int, default=10)
Expand Down
2 changes: 1 addition & 1 deletion examples/python_two_bar_truss_problem/project_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ 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", "--url", default="https://127.0.0.1:8443/hps")
parser.add_argument("-u", "--username", default="repadmin")
parser.add_argument("-p", "--password", default="repadmin")
parser.add_argument("-n", "--num-jobs", type=int, default=50)
Expand Down
2 changes: 1 addition & 1 deletion tests/rep_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def setUp(self):
# self._stream_handler = logging.StreamHandler(sys.stdout)
# self.logger.addHandler(self._stream_handler)

self.rep_url = os.environ.get("REP_TEST_URL") or "https://127.0.0.1:8443/rep"
self.rep_url = os.environ.get("REP_TEST_URL") or "https://127.0.0.1:8443/hps"
self.username = os.environ.get("REP_TEST_USERNAME") or "repadmin"
self.password = os.environ.get("REP_TEST_PASSWORD") or "repadmin"
self.keycloak_username = os.environ.get("REP_TEST_KEYCLOAK_USERNAME") or "keycloak"
Expand Down
Loading