From 8a48a0d60787c156d7abd7d4efa10c91a9edf4da Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 11 Jan 2024 16:43:31 -0500 Subject: [PATCH 01/61] make ANSYS, Inc. the project maintainer --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b586230b0..b9e86be09 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ url=about["__url__"], author="ANSYS, Inc.", author_email="pyansys.support@ansys.com", - maintainer="PyAnsys developers", + maintainer="ANSYS, Inc.", maintainer_email="pyansys.maintainers@ansys.com", classifiers=[ "Development Status :: 4 - Beta", From 088d4db639776b04d1464b891c5b053654cda53e Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 11 Jan 2024 16:44:33 -0500 Subject: [PATCH 02/61] add contact/support section to readme --- README.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.rst b/README.rst index 43c57b423..365096026 100644 --- a/README.rst +++ b/README.rst @@ -166,6 +166,7 @@ the building requirements and then executing the build module: python -m build python -m twine check dist/* + How to generate/update RMS models --------------------------------- @@ -177,6 +178,19 @@ Then, run the datamodel generator: datamodel-codegen --input .\rms_openapi.json --input-file-type openapi --output ansys/hps/client/rms/models.py --output-model-type pydantic_v2.BaseModel + +Documentation, Issues, and Support +---------------------------------- +Documentation for the latest stable release of PyHPS is hosted at `PyHPS documentation +`_. + +On the `PyHPS Issues `_ page, +you can create issues to report bugs and request new features. On the `PyHPS Discussions +`_ page or the `Discussions `_ +page on the Ansys Developer portal, you can post questions, share ideas, and get community feedback. + +To reach the project support team, email `pyansys.core@ansys.com `_. + .. LINKS AND REFERENCES .. _black: https://github.com/psf/black .. _flake8: https://flake8.pycqa.org/en/latest/ From 051cdd845e56cdc038bbb0187b6bbc514f20f9fb Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 11 Jan 2024 17:03:13 -0500 Subject: [PATCH 03/61] update and add authors, code of conduct, contributing, contributors, and license files --- AUTHORS | 12 ++++++++++++ CODE_OF_CONDUCT.md | 30 +++++++++++++++--------------- CONTRIBUTING.md | 7 ++++++- CONTRIBUTORS.md | 20 ++++++++++++++++++++ LICENSE | 16 ++++++++-------- 5 files changed, 61 insertions(+), 24 deletions(-) create mode 100644 AUTHORS create mode 100644 CONTRIBUTORS.md diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 000000000..dde31397a --- /dev/null +++ b/AUTHORS @@ -0,0 +1,12 @@ +# This is the list of PyHPS's significant contributors. +# +# This file does not necessarily list everyone who has contributed code. +# +# For contributions made under a Corporate CLA, the organization is +# added to this file. +# +# If you have contributed to the repository and wish to be added to this file +# please submit a request. +# +# +ANSYS, Inc. \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 1cf484f16..6705d0536 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,18 +1,18 @@ -# Contributor Covenant Code of Conduct +# Contributor covenant code of conduct -## Our Pledge +## Pledge -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our -project and our community a harassment-free experience for everyone, -regardless of age, body size, disability, ethnicity, sex -characteristics, gender identity and expression, level of experience, -education, socio-economic status, nationality, personal appearance, -race, religion, or sexual identity and orientation. +In the interest of fostering an open and welcoming environment, +all contributors and maintainers pledge to making participation +in the Ansys project and community a harassment-free experience +for everyone, regardless of age, body size, disability, ethnicity, +sex characteristics, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. -## Our Standards +## Standards -Examples of behavior that contributes to creating a positive environment +Examples of behavior that contribute to creating a positive environment include: * Using welcoming and inclusive language @@ -32,7 +32,7 @@ Examples of unacceptable behavior by participants include: * Other conduct which could reasonably be considered inappropriate in a professional setting -## Our Responsibilities +## Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in @@ -48,18 +48,18 @@ offensive, or harmful. This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail +representing a project or community include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Attribution -This Code of Conduct is adapted from the [Contributor Covenant][homepage], +This code of conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see -https://www.contributor-covenant.org/faq +https://www.contributor-covenant.org/faq \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index deebbad38..bf9cc8aa8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,2 +1,7 @@ -# Contributing +# Contributing +Please, refer to the [PyAnsys Developer's Guide] for contributing to this project. + +[PyAnsys Developer's Guide]: https://dev.docs.pyansys.com/index.html + + \ No newline at end of file diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 000000000..9159c893b --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,20 @@ +# Contributors + +## Project Lead or Owner + +* [Federico Negri](https://github.com/FedericoNegri) +* [Oliver Koenig](https://github.com/ojkoenig) + +## Individual Contributors + +* [davel94](https://github.com/davel94) +* [Jonathan Zopes](https://github.com/jonathanzopes) +* [Ryan Wehrle](https://github.com/wehrler) +* [Michal Pawlik](https://github.com/nezgrath) +* [Jon Novak](https://github.com/Buzz1167) +* [Manikanth Sai](https://github.com/saimanikant) +* [Dominik Gresch](https://github.com/greschd) +* [Nathan Sharp](https://github.com/phxnsharp) +* [Sashanka Krishna](https://github.com/sashankh01) +* [Roberto Pastor Muela](https://github.com/RobPasMue) +* [Kerry McAdams](https://github.com/klmcadams) \ No newline at end of file diff --git a/LICENSE b/LICENSE index 94e66d5ad..27fe2c1d5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,13 @@ MIT License -Copyright (c) 2022 PyAnsys +Copyright (c) 2024 ANSYS, Inc. and/or its affiliates. -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: +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. @@ -18,4 +18,4 @@ 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. +SOFTWARE. \ No newline at end of file From ea09e33af3e98557f065ad65099683971ba06861 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Fri, 12 Jan 2024 08:24:43 -0500 Subject: [PATCH 04/61] changelog updates --- CHANGELOG.md | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 169 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 505d21df1..8f9d1201c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,169 @@ -# CHANGELOG \ No newline at end of file +# CHANGELOG + +## [0.5.0](https://github.com/ansys-internal/pyhps/releases/tag/v0.5.0) - December 14 2023 + +### Added +* Expose the resource management service (RMS) API by @FedericoNegri in #247 +* Add missing RMS api doc file by @FedericoNegri in #250 +* Add wheel asset to release by @FedericoNegri in #255 + +### Fixed +* Fix download of file when the evaluation path contains a subdir by @FedericoNegri in #254 +* Fix task def property by @wehrler in #257 + +### Changed +* Update nightly workflow by @FedericoNegri in #256 + +### Dependencies +* Bump datamodel-code-generator from 0.24.1 to 0.25.1 in /requirements by @dependabot in #249 + +## [0.4.0](https://github.com/ansys-internal/pyhps/releases/tag/v0.4.0) - November 17 2023 + +### Added +* Add HPC resources by @wehrler in #186 +* Add PR, bug and feature template by @sashankh01 in #179 +* Expose SSL certificates verification by @FedericoNegri in #235 +* Create File resource with a file-like object by @FedericoNegri in #238 + +### Fixed +* Jnovak/client refresh failure by @Buzz1167 in #194 +* Fix output files and parameter ids in the success criteria by @FedericoNegri in #234 +* Fix marshmallow warnings by @FedericoNegri in #239 + +### Changed +* Update schemas and resources by @FedericoNegri in #196 +* Update tests requiring the auth api by @FedericoNegri in #201 +* Update github workflows by @FedericoNegri in #220 +* Update Python and dependencies versions by @FedericoNegri in #228 +* Remove unnecessary files from wheel by @FedericoNegri in #237 +* Update examples to optionally use the official execution scripts by @saimanikant in #240 + +### Dependencies +* Bump pytest from 7.3.2 to 7.4.3 in /requirements by @dependabot in #192, #232 +* Bump docs requirements by @FedericoNegri in #245 + +## [0.3.0](https://github.com/ansys-internal/pyhps/releases/tag/v0.3.0) - June 29 2023 + +### Added +* Add build_info to evaluator's schema by @FedericoNegri in #190 +* Expose created/modified by by @FedericoNegri in #189 + +### Changed +* Rename external version by @FedericoNegri in #184 +* Rework auth api by @FedericoNegri in #185 +* Bump default Ansys apps version by @FedericoNegri in #187 + +### Dependencies +* Bump ``ansys-sphinx-theme`` from 0.9.8 to 0.9.9 in /requirements by @dependabot in #173 +* Bump ``pytest`` from 7.3.1 to 7.3.2 in /requirements by @dependabot in #188 +* Bump ``pytest-cov`` from 4.0.0 to 4.1.0 in /requirements by @dependabot in #183 + +## [0.2.0](https://github.com/ansys-internal/pyhps/releases/tag/v0.2.0) - June 6 2023 + +### Added +* Objects copy by @FedericoNegri in #181 + +### Fixed +* Fix test: task files by @FedericoNegri in #174 + +### Changed +* Update ci_cd.yml by @FedericoNegri in #175 +* Update nightly build by @FedericoNegri in #176 +* Update ci/cd by @FedericoNegri in #178 +* Adjust schemas to match jms and evaluator by @wehrler in #182 +* Remove file storage from project schema by @wehrler in #160 + +## [0.1.0](https://github.com/ansys-internal/pyhps/releases/tag/v0.1.0) - May 9 2023 + +### Added + +* Add missing fields for app template handling by @nezgrath in https://github.com/pyansys/pyrep/pull/14 +* Okoenig/exec script examples by @ojkoenig in https://github.com/pyansys/pyrep/pull/18 +* Add publish step to private pypi. by @jonathanzopes in https://github.com/pyansys/pyrep/pull/20 +* Add log messages in execution scripts by @ojkoenig in https://github.com/pyansys/pyrep/pull/27 +* Add use_execution_script to pyrep by @ojkoenig in https://github.com/pyansys/pyrep/pull/33 +* Add new examples + docstring updates by @FedericoNegri in https://github.com/pyansys/pyrep/pull/35 +* Add version as a cmd line argument in the examples by @FedericoNegri in https://github.com/pyansys/pyrep/pull/71 +* Add nightly build and make CI run faster by @FedericoNegri in https://github.com/pyansys/pyrep/pull/85 +* Add task custom_data field by @FedericoNegri in https://github.com/pyansys/pyrep/pull/143 +* Add release job to ci/cd by @FedericoNegri in https://github.com/pyansys/pyrep/pull/172 +* Common Client and separate API objects by @FedericoNegri in https://github.com/pyansys/pyrep/pull/28 +* Set REP server for CI tests by @FedericoNegri in https://github.com/pyansys/pyrep/pull/39 +* Include examples in the doc by @FedericoNegri in https://github.com/pyansys/pyrep/pull/45 +* Auto generate code for resource objects by @FedericoNegri in https://github.com/pyansys/pyrep/pull/42 +* Fluent example by @FedericoNegri in https://github.com/pyansys/pyrep/pull/46 +* Separate tests by @FedericoNegri in https://github.com/pyansys/pyrep/pull/49 +* Davel/fluent example by @davel94 in https://github.com/pyansys/pyrep/pull/52 +* CFX example by @davel94 in https://github.com/pyansys/pyrep/pull/55 +* doc for fluent nozzle and cfx examples by @davel94 in https://github.com/pyansys/pyrep/pull/58 +* get_project_by_name in mapdl_motorbike_frame example by @saimanikant in https://github.com/pyansys/pyrep/pull/65 +* Don't assume projects exists on server for tests by @FedericoNegri in https://github.com/pyansys/pyrep/pull/86 +* Test task definition fields by @FedericoNegri in https://github.com/pyansys/pyrep/pull/92 +* Auto-generate __init__ arguments for resources by @FedericoNegri in https://github.com/pyansys/pyrep/pull/93 +* Correct dependabot labels by @nezgrath in https://github.com/pyansys/pyrep/pull/101 +* Task definition template permissions by @FedericoNegri in https://github.com/pyansys/pyrep/pull/100 +* Sort File System Rest Gateway by ascending priority by @FedericoNegri in https://github.com/pyansys/pyrep/pull/112 +* Test against local REP deployment by @FedericoNegri in https://github.com/pyansys/pyrep/pull/127 +* Verify that a user can query newly created templates by @FedericoNegri in https://github.com/pyansys/pyrep/pull/118 +* Enable multi-version documentation by @greschd in https://github.com/pyansys/pyrep/pull/130 +* Run unit tests in nightly build against local deployment by @FedericoNegri in https://github.com/pyansys/pyrep/pull/132 +* Clean up old/unused files by @FedericoNegri in https://github.com/pyansys/pyrep/pull/133 +* Expose distributed flag in the task definition and template by @FedericoNegri in https://github.com/pyansys/pyrep/pull/134 +* Expose argument to control the default for the `fields="all"` query parameter by @FedericoNegri in https://github.com/pyansys/pyrep/pull/150 +* Helper function to copy default execution scripts by @FedericoNegri in https://github.com/pyansys/pyrep/pull/154 +* Ansys org rename by @FedericoNegri in https://github.com/pyansys/pyrep/pull/170 +* Expose sync_jobs and deprecate _sync_jobs by @FedericoNegri in https://github.com/pyansys/pyrep/pull/171 + +### Fixed + +* Fix mapdl_motorbike_frame examples. To be continued by @ojkoenig in https://github.com/pyansys/pyrep/pull/5 +* Okoenig/fix examples by @ojkoenig in https://github.com/pyansys/pyrep/pull/6 +* Okoenig/fix examples by @ojkoenig in https://github.com/pyansys/pyrep/pull/8 +* Minor fix by @ojkoenig in https://github.com/pyansys/pyrep/pull/9 +* Minor fix for the example as reported by Sorin by @ojkoenig in https://github.com/pyansys/pyrep/pull/12 +* Adjust replace rules by @nezgrath in https://github.com/pyansys/pyrep/pull/13 +* Small fix for task definition schema. execution_script_id is optional by @ojkoenig in https://github.com/pyansys/pyrep/pull/17 +* Pass env correctly by @ojkoenig in https://github.com/pyansys/pyrep/pull/19 +* Jzopes/fix code style by @jonathanzopes in https://github.com/pyansys/pyrep/pull/22 +* okoenig/fix tests by @ojkoenig in https://github.com/pyansys/pyrep/pull/24 +* Fix doc build by @FedericoNegri in https://github.com/pyansys/pyrep/pull/111 +* Fix api update calls by @FedericoNegri in https://github.com/pyansys/pyrep/pull/126 + +### Changed + +* Change required_output_parameters to required_output_parameter_ids by @nezgrath in https://github.com/pyansys/pyrep/pull/2 +* Updating more examples by @ojkoenig in https://github.com/pyansys/pyrep/pull/7 +* Disable pydocstyle for now by @ojkoenig in https://github.com/pyansys/pyrep/pull/11 +* Update doc build step. by @jonathanzopes in https://github.com/pyansys/pyrep/pull/21 +* Minor update for exec scripts by @ojkoenig in https://github.com/pyansys/pyrep/pull/23 +* Doc update + get_project_by_name and pretty print by @FedericoNegri in https://github.com/pyansys/pyrep/pull/36 +* Update task definition templates + doc improvements by @FedericoNegri in https://github.com/pyansys/pyrep/pull/38 +* Update app names by @FedericoNegri in https://github.com/pyansys/pyrep/pull/53 +* Update url of testing server by @FedericoNegri in https://github.com/pyansys/pyrep/pull/59 +* Schema and resource generation updates by @FedericoNegri in https://github.com/pyansys/pyrep/pull/57 +* Update test server credentials by @FedericoNegri in https://github.com/pyansys/pyrep/pull/75 +* Expose update of evaluator configuration by @FedericoNegri in https://github.com/pyansys/pyrep/pull/137 +* Update dependencies by @FedericoNegri in https://github.com/pyansys/pyrep/pull/145 +* Update dependencies by @FedericoNegri in https://github.com/pyansys/pyrep/pull/162 +* Update project copy and evaluator's schema by @FedericoNegri in https://github.com/pyansys/pyrep/pull/165 +* Change source import for flake8 by @RobPasMue in https://github.com/pyansys/pyrep/pull/88 +* changes to exec scripts for templates. by @davel94 in https://github.com/pyansys/pyrep/pull/80 +* Specify python-keycloak<=2.12.0 to avoid breaking changes with newer releases by @FedericoNegri in https://github.com/pyansys/pyrep/pull/141 +* Re-enable the Auth API by @FedericoNegri in https://github.com/pyansys/pyrep/pull/32 +* Adjust package name to ansys-rep-client by @FedericoNegri in https://github.com/pyansys/pyrep/pull/138 +* Improve type annotations and APIs doc by @FedericoNegri in https://github.com/pyansys/pyrep/pull/47 + +### Dependencies +* Bump ``sphinx`` from 5.0.2 to 0.10.0 in /requirements by @dependabot in ([#4](https://github.com/pyansys/pyrep/pull/4), [#73](https://github.com/pyansys/pyrep/pull/73), [#109](https://github.com/pyansys/pyrep/pull/109)) +* Bump ``ansys-sphinx-theme`` from 0.4.2 to 0.8.2 in /requirements by @dependabot in ([#16](https://github.com/pyansys/pyrep/pull/16), [#25](https://github.com/pyansys/pyrep/pull/25), [#37](https://github.com/pyansys/pyrep/pull/37), [#91](https://github.com/pyansys/pyrep/pull/91), [#98](https://github.com/pyansys/pyrep/pull/98), [#122](https://github.com/pyansys/pyrep/pull/122), [#129](https://github.com/pyansys/pyrep/pull/129)) +* Bump ``sphinxnotes-strike`` from 1.1 to 1.2 in /requirements by @dependabot in https://github.com/pyansys/pyrep/pull/34 +* Bump ``pytest`` from 7.1.2 to 7.2.1 in /requirements by @dependabot in https://github.com/pyansys/pyrep/pull/44, https://github.com/pyansys/pyrep/pull/77, https://github.com/pyansys/pyrep/pull/113 +* Bump ``sphinx-autodoc-typehints`` from 1.18.1 to 1.22 in /requirements by @dependabot in ([#54](https://github.com/pyansys/pyrep/pull/54), [#108](https://github.com/pyansys/pyrep/pull/108), [#123](https://github.com/pyansys/pyrep/pull/123), [#124](https://github.com/pyansys/pyrep/pull/124), [#128](https://github.com/pyansys/pyrep/pull/128) +* Bump dependencies version by @FedericoNegri in https://github.com/pyansys/pyrep/pull/72 +* Bump ``apispec`` from 5.2.2 to 6.0.2 in /requirements by @dependabot in https://github.com/pyansys/pyrep/pull/74, https://github.com/pyansys/pyrep/pull/87 +* Bump versions in requirements by @FedericoNegri in https://github.com/pyansys/pyrep/pull/84 +* Bump ``sphinx-copybutton`` from 0.5 to 0.5.1 in /requirements by @dependabot in https://github.com/pyansys/pyrep/pull/89 +* Bump ``sphinxcontrib-httpdomain`` from 1.8.0 to 1.8.1 in /requirements by @dependabot in https://github.com/pyansys/pyrep/pull/90 +* Bump ``twine`` from 4.0.1 to 4.0.2 in /requirements by @dependabot in https://github.com/pyansys/pyrep/pull/95 +* Bump ``build`` from 0.9.0 to 0.10.0 in /requirements by @dependabot in https://github.com/pyansys/pyrep/pull/110 +* Bump ``sphinxcontrib-globalsubs`` from 0.1.0 to 0.1.1 in /requirements by @dependabot in https://github.com/pyansys/pyrep/pull/115 From 72ec7cc611a0e611a9fc76846af25a5d00e15853 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Fri, 12 Jan 2024 10:44:50 -0500 Subject: [PATCH 05/61] make min python version 3.9 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b9e86be09..4ffbbaef1 100644 --- a/setup.py +++ b/setup.py @@ -38,6 +38,6 @@ "backoff>=2.0.0", "pydantic>=1.10.0", ], - python_requires=">=3.7", + python_requires=">=3.9", packages=find_namespace_packages(include=["ansys.*"]), ) From d8f42d9afe7a4dd96138c86bb4339f16adc59f7e Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 16 Jan 2024 15:45:49 -0500 Subject: [PATCH 06/61] use pyproject.toml only, update workflow, and move ansys/ into src/ directory --- .github/labeler.yml | 11 +- .github/workflows/ci_cd.yml | 2 +- .github/workflows/label.yml | 3 +- .github/workflows/nightly.yml | 2 +- README.rst | 6 +- ansys/hps/client/rms/models.py | 683 ----------------- pyproject.toml | 77 +- requirements/requirements_build.txt | 4 - requirements/requirements_doc.txt | 10 - requirements/requirements_tests.txt | 2 - setup.py | 43 -- {ansys => src/ansys}/hps/client/__init__.py | 0 .../ansys}/hps/client/__version__.py | 0 .../ansys}/hps/client/auth/__init__.py | 0 .../ansys}/hps/client/auth/api/__init__.py | 0 .../ansys}/hps/client/auth/api/auth_api.py | 0 .../ansys}/hps/client/auth/authenticate.py | 0 .../hps/client/auth/resource/__init__.py | 0 .../ansys}/hps/client/auth/resource/user.py | 7 +- .../ansys}/hps/client/auth/schema/__init__.py | 0 .../ansys}/hps/client/auth/schema/user.py | 0 {ansys => src/ansys}/hps/client/client.py | 0 .../ansys}/hps/client/common/__init__.py | 0 .../ansys}/hps/client/common/base_resource.py | 0 .../ansys}/hps/client/common/base_schema.py | 0 .../hps/client/common/restricted_value.py | 0 {ansys => src/ansys}/hps/client/connection.py | 0 {ansys => src/ansys}/hps/client/exceptions.py | 0 .../ansys}/hps/client/jms/__init__.py | 0 .../ansys}/hps/client/jms/api/__init__.py | 0 .../ansys}/hps/client/jms/api/base.py | 0 .../ansys}/hps/client/jms/api/jms_api.py | 0 .../ansys}/hps/client/jms/api/project_api.py | 0 {ansys => src/ansys}/hps/client/jms/keys.py | 0 .../ansys}/hps/client/jms/resource/.gitignore | 0 .../hps/client/jms/resource/__init__.py | 28 +- .../hps/client/jms/resource/algorithm.py | 10 +- .../hps/client/jms/resource/evaluator.py | 24 +- .../ansys}/hps/client/jms/resource/file.py | 29 +- .../client/jms/resource/fitness_definition.py | 15 +- .../ansys}/hps/client/jms/resource/job.py | 10 +- .../hps/client/jms/resource/job_definition.py | 12 +- .../client/jms/resource/license_context.py | 10 +- .../hps/client/jms/resource/operation.py | 7 +- .../jms/resource/parameter_definition.py | 43 +- .../client/jms/resource/parameter_mapping.py | 7 +- .../hps/client/jms/resource/permission.py | 12 +- .../ansys}/hps/client/jms/resource/project.py | 7 +- .../hps/client/jms/resource/selection.py | 7 +- .../ansys}/hps/client/jms/resource/task.py | 10 +- .../client/jms/resource/task_definition.py | 51 +- .../jms/resource/task_definition_template.py | 44 +- .../ansys}/hps/client/jms/schema/__init__.py | 0 .../ansys}/hps/client/jms/schema/algorithm.py | 0 .../ansys}/hps/client/jms/schema/evaluator.py | 0 .../ansys}/hps/client/jms/schema/file.py | 0 .../client/jms/schema/fitness_definition.py | 0 .../ansys}/hps/client/jms/schema/job.py | 0 .../hps/client/jms/schema/job_definition.py | 0 .../hps/client/jms/schema/license_context.py | 0 .../hps/client/jms/schema/object_reference.py | 0 .../ansys}/hps/client/jms/schema/operation.py | 0 .../client/jms/schema/parameter_definition.py | 0 .../client/jms/schema/parameter_mapping.py | 0 .../hps/client/jms/schema/permission.py | 0 .../ansys}/hps/client/jms/schema/project.py | 0 .../ansys}/hps/client/jms/schema/selection.py | 0 .../ansys}/hps/client/jms/schema/task.py | 0 .../hps/client/jms/schema/task_definition.py | 0 .../jms/schema/task_definition_template.py | 0 .../ansys}/hps/client/rms/__init__.py | 0 .../ansys}/hps/client/rms/api/base.py | 0 .../ansys}/hps/client/rms/api/rms_api.py | 0 src/ansys/hps/client/rms/models.py | 696 ++++++++++++++++++ {ansys => src/ansys}/hps/client/warnings.py | 0 tox.ini | 6 +- 76 files changed, 1013 insertions(+), 865 deletions(-) delete mode 100644 ansys/hps/client/rms/models.py delete mode 100644 requirements/requirements_build.txt delete mode 100644 requirements/requirements_doc.txt delete mode 100644 requirements/requirements_tests.txt delete mode 100644 setup.py rename {ansys => src/ansys}/hps/client/__init__.py (100%) rename {ansys => src/ansys}/hps/client/__version__.py (100%) rename {ansys => src/ansys}/hps/client/auth/__init__.py (100%) rename {ansys => src/ansys}/hps/client/auth/api/__init__.py (100%) rename {ansys => src/ansys}/hps/client/auth/api/auth_api.py (100%) rename {ansys => src/ansys}/hps/client/auth/authenticate.py (100%) rename {ansys => src/ansys}/hps/client/auth/resource/__init__.py (100%) rename {ansys => src/ansys}/hps/client/auth/resource/user.py (96%) rename {ansys => src/ansys}/hps/client/auth/schema/__init__.py (100%) rename {ansys => src/ansys}/hps/client/auth/schema/user.py (100%) rename {ansys => src/ansys}/hps/client/client.py (100%) rename {ansys => src/ansys}/hps/client/common/__init__.py (100%) rename {ansys => src/ansys}/hps/client/common/base_resource.py (100%) rename {ansys => src/ansys}/hps/client/common/base_schema.py (100%) rename {ansys => src/ansys}/hps/client/common/restricted_value.py (100%) rename {ansys => src/ansys}/hps/client/connection.py (100%) rename {ansys => src/ansys}/hps/client/exceptions.py (100%) rename {ansys => src/ansys}/hps/client/jms/__init__.py (100%) rename {ansys => src/ansys}/hps/client/jms/api/__init__.py (100%) rename {ansys => src/ansys}/hps/client/jms/api/base.py (100%) rename {ansys => src/ansys}/hps/client/jms/api/jms_api.py (100%) rename {ansys => src/ansys}/hps/client/jms/api/project_api.py (100%) rename {ansys => src/ansys}/hps/client/jms/keys.py (100%) rename {ansys => src/ansys}/hps/client/jms/resource/.gitignore (100%) rename {ansys => src/ansys}/hps/client/jms/resource/__init__.py (58%) rename {ansys => src/ansys}/hps/client/jms/resource/algorithm.py (95%) rename {ansys => src/ansys}/hps/client/jms/resource/evaluator.py (95%) rename {ansys => src/ansys}/hps/client/jms/resource/file.py (87%) rename {ansys => src/ansys}/hps/client/jms/resource/fitness_definition.py (98%) rename {ansys => src/ansys}/hps/client/jms/resource/job.py (95%) rename {ansys => src/ansys}/hps/client/jms/resource/job_definition.py (94%) rename {ansys => src/ansys}/hps/client/jms/resource/license_context.py (86%) rename {ansys => src/ansys}/hps/client/jms/resource/operation.py (97%) rename {ansys => src/ansys}/hps/client/jms/resource/parameter_definition.py (94%) rename {ansys => src/ansys}/hps/client/jms/resource/parameter_mapping.py (98%) rename {ansys => src/ansys}/hps/client/jms/resource/permission.py (84%) rename {ansys => src/ansys}/hps/client/jms/resource/project.py (97%) rename {ansys => src/ansys}/hps/client/jms/resource/selection.py (97%) rename {ansys => src/ansys}/hps/client/jms/resource/task.py (97%) rename {ansys => src/ansys}/hps/client/jms/resource/task_definition.py (92%) rename {ansys => src/ansys}/hps/client/jms/resource/task_definition_template.py (92%) rename {ansys => src/ansys}/hps/client/jms/schema/__init__.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/algorithm.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/evaluator.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/file.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/fitness_definition.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/job.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/job_definition.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/license_context.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/object_reference.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/operation.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/parameter_definition.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/parameter_mapping.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/permission.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/project.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/selection.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/task.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/task_definition.py (100%) rename {ansys => src/ansys}/hps/client/jms/schema/task_definition_template.py (100%) rename {ansys => src/ansys}/hps/client/rms/__init__.py (100%) rename {ansys => src/ansys}/hps/client/rms/api/base.py (100%) rename {ansys => src/ansys}/hps/client/rms/api/rms_api.py (100%) create mode 100644 src/ansys/hps/client/rms/models.py rename {ansys => src/ansys}/hps/client/warnings.py (100%) diff --git a/.github/labeler.yml b/.github/labeler.yml index f5d904279..30c2c1f33 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,8 +1,9 @@ documentation: -- doc/source/**/* +- changed-files: + - any-glob-to-any-file: ['doc/source/**/*'] maintenance: -- .github/**/* -- .flake8 -- pyproject.toml +- changed-files: + - any-glob-to-any-file: ['.github/**/*', '.flake8', 'pyproject.toml'] dependencies: -- requirements/* +- changed-files: + - any-glob-to-any-file: ['pyproject.toml'] \ No newline at end of file diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index b06e1dc0a..d67b2757e 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -167,7 +167,7 @@ jobs: id: build run: | python -m pip install --upgrade pip setuptools - python -m pip install -r requirements/requirements_build.txt + python -m pip install -e .[build] python -m build venv wheel python -m twine check dist/* version=$(ls dist | grep ansys_pyhps | grep -E -o "[0-9]+.[0-9]+.[a-z0-9]+") diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index ae405f788..596446d76 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -32,10 +32,9 @@ jobs: # Label based on modified files - name: Label based on changed files - uses: actions/labeler@v4 + uses: actions/labeler@v5 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - sync-labels: '' # Label based on branch name - uses: actions-ecosystem/action-add-labels@v1 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c324b36ce..cae6ef242 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -121,7 +121,7 @@ jobs: - name: Install dependencies and build the library run: | python -m pip install --upgrade pip setuptools - python -m pip install -r requirements/requirements_build.txt + python -m pip install -e .[build] python -m build venv wheel python -m twine check dist/* - name: Upload artifact diff --git a/README.rst b/README.rst index 365096026..85b5c0389 100644 --- a/README.rst +++ b/README.rst @@ -86,10 +86,7 @@ need to follow these steps: .. code:: bash python -m pip install -U pip setuptools tox - python -m pip install -r requirements/requirements_build.txt - python -m pip install -r requirements/requirements_doc.txt - python -m pip install -r requirements/requirements_tests.txt - + python -m pip install -e .[tests,doc] #. Install the project in editable mode: @@ -162,7 +159,6 @@ the building requirements and then executing the build module: .. code:: bash - python -m pip install -r requirements/requirements_build.txt python -m build python -m twine check dist/* diff --git a/ansys/hps/client/rms/models.py b/ansys/hps/client/rms/models.py deleted file mode 100644 index ad09a7ec4..000000000 --- a/ansys/hps/client/rms/models.py +++ /dev/null @@ -1,683 +0,0 @@ -# generated by datamodel-codegen: -# filename: rms_openapi.json -# timestamp: 2023-12-22T09:38:15+00:00 - -from __future__ import annotations - -from datetime import datetime -from enum import Enum -from typing import Any, Dict, List, Optional, Union - -from pydantic import BaseModel, Field -from typing_extensions import Literal - - -class ApplicationInfo(BaseModel): - name: str = Field(..., description='Application name', title='Name') - version: str = Field(..., description='Application version', title='Version') - install_path: str = Field( - ..., description='Installation path of application', title='Install Path' - ) - executable: str = Field( - ..., description='Executable path to run application', title='Executable' - ) - environment: Optional[Dict[str, Any]] = Field( - None, description='Environment setup for the process', title='Environment' - ) - capabilities: Optional[List[str]] = Field( - None, description='Capabilities of this application', title='Capabilities' - ) - customization_hook: Optional[Dict[str, Any]] = Field( - None, - description='Details of a custom hook used to modify the configuration before runs are performed', - title='Customization Hook', - ) - - -class EvaluatorTaskDirectoryCleanup(Enum): - always = 'always' - on_success = 'on_success' - never = 'never' - - -class ContextUpdate(BaseModel): - custom: Optional[Dict[str, Optional[Union[int, bool, str, float]]]] = Field( - {}, description='Custom runtime properties.', title='Custom' - ) - - -class CrsCountResponse(BaseModel): - num_compute_resource_sets: Optional[int] = Field(0, title='Num Compute Resource Sets') - - -class TaskDirectoryCleanupEnum(Enum): - always = 'always' - on_success = 'on_success' - never = 'never' - - -class EvaluatorRegistration(BaseModel): - id: Optional[str] = Field(None, description='Unique identifier for this worker', title='Id') - name: Optional[str] = Field(None, description='User defined name for this worker', title='Name') - last_modified: Optional[datetime] = Field( - None, - description='Date and time when the registration was last modified', - title='Last Modified', - ) - host_id: Optional[str] = Field( - None, description='Static, hardware and configuration based UUID', title='Host Id' - ) - host_name: Optional[str] = Field( - None, description='Name of the host on which the worker is running', title='Host Name' - ) - username: Optional[str] = Field( - None, description='Username the evaluator authenticated with', title='Username' - ) - platform: Optional[str] = Field( - None, description='OS the evaluator is running on', title='Platform' - ) - build_info: Optional[Dict[str, Any]] = Field( - {}, description='Detailed build information', title='Build Info' - ) - compute_resource_set_id: Optional[str] = Field( - None, - description='Identifier of the compute resource set the evaluator belongs to', - title='Compute Resource Set Id', - ) - change_requested: Optional[datetime] = Field( - None, - description="Date and time of the configuration's last modification request", - title='Change Requested', - ) - - -class EvaluatorsCountResponse(BaseModel): - num_evaluators: Optional[int] = Field(0, title='Num Evaluators') - - -class EvaluatorsRequest(BaseModel): - evaluators: List[EvaluatorRegistration] = Field( - ..., description='Evaluator details', title='Evaluators' - ) - - -class EvaluatorsResponse(BaseModel): - evaluators: List[EvaluatorRegistration] = Field( - ..., description='Evaluator details', title='Evaluators' - ) - - -class HpcResources(BaseModel): - num_cores_per_node: Optional[int] = Field( - None, description='Number of cores per node.', title='Num Cores Per Node' - ) - num_gpus_per_node: Optional[int] = Field( - None, description='Number of GPUs per node.', title='Num Gpus Per Node' - ) - exclusive: Optional[bool] = Field( - None, description='To not share nodes with other running jobs.', title='Exclusive' - ) - queue: Optional[str] = Field(None, description="Scheduler's queue.", title='Queue') - - -class KubernetesKedaBackend(BaseModel): - plugin_name: Literal['kubernetes'] = Field(..., title='Plugin Name') - debug: Optional[bool] = Field( - False, description='Enable additional debugging of the backend', title='Debug' - ) - job_script_template_path: Optional[str] = Field( - None, - description='Path to the job script template to use in the backend', - title='Job Script Template Path', - ) - working_dir: Optional[str] = Field( - None, description='Working directory to use in the backend', title='Working Dir' - ) - env: Optional[Dict[str, Any]] = Field( - None, description='Static environment variables needed for job execution', title='Env' - ) - cpu_limit: Optional[str] = Field( - '1.0', description='CPU limit applied to each evaluator instance', title='Cpu Limit' - ) - memory_limit: Optional[str] = Field( - '250M', description='Memory limit applied to each evaluator instance', title='Memory Limit' - ) - namespace: Optional[str] = Field( - 'default', - description='Kubernetes namespace to be used to scale evaluators', - title='Namespace', - ) - target_resource_kind: Optional[str] = Field( - 'job', - description='kubernetes resource kind rep scaler should scale, should be one of job, deployment, statefulset', - title='Target Resource Kind', - ) - - -class KubernetesResourceScaling(BaseModel): - plugin_name: Literal['kubernetes_resource_scaling'] = Field(..., title='Plugin Name') - target_resource_kind: Optional[str] = Field( - 'job', - description='kubernetes resource kind rep scaler should scale, should be one of job, deployment, statefulset', - title='Target Resource Kind', - ) - - -class LocalBackend(BaseModel): - plugin_name: Literal['local'] = Field(..., title='Plugin Name') - debug: Optional[bool] = Field( - False, description='Enable additional debugging of the backend', title='Debug' - ) - working_dir: Optional[str] = Field( - None, description='Working directory to use in the backend', title='Working Dir' - ) - env: Optional[Dict[str, Any]] = Field( - None, description='Static environment variables needed for job execution', title='Env' - ) - - -class Machine(BaseModel): - name: str = Field(..., description='Name of the machine', title='Name') - num_cores: int = Field(..., description='Number of cores available', title='Num Cores') - - -class MaxAvailableResourceScaling(BaseModel): - plugin_name: Literal['max_available_resource_scaling'] = Field(..., title='Plugin Name') - match_all_requirements: Optional[bool] = Field( - False, - description='Whether scaling should work with available resource properties specified in compute resource set (default) or require a match of all requirements of the task definition.', - title='Match All Requirements', - ) - - -class MockupBackend(BaseModel): - plugin_name: Literal['mockup'] = Field(..., title='Plugin Name') - debug: Optional[bool] = Field( - False, description='Enable additional debugging of the backend', title='Debug' - ) - - -class Node(BaseModel): - name: Optional[str] = Field(None, description='Node name', title='Name') - total_memory_mb: Optional[int] = Field(..., description='Total memory', title='Total Memory Mb') - total_cores: Optional[int] = Field(..., description='Number of cores', title='Total Cores') - additional_props: Optional[Dict[str, Any]] = Field({}, title='Additional Props') - - -class NodeGroup(BaseModel): - node_names: List[str] = Field(..., title='Node Names') - total_memory_mb: Optional[int] = Field(..., description='Total memory', title='Total Memory Mb') - total_cores: Optional[int] = Field(..., description='Number of cores', title='Total Cores') - - -class PlatformEnum(Enum): - windows = 'windows' - linux = 'linux' - darwin = 'darwin' - - -class ProblemDetail(BaseModel): - type: Optional[str] = Field(None, title='Type') - title: Optional[str] = Field(None, title='Title') - status: int = Field(..., title='Status') - detail: str = Field(..., title='Detail') - instance: Optional[str] = Field(None, title='Instance') - - -class ProcessLauncherProcessRunner(BaseModel): - plugin_name: Literal['process_launcher_module'] = Field(..., title='Plugin Name') - default_user: Optional[str] = Field( - None, description='The user to use when none is specified', title='Default User' - ) - timeout: Optional[int] = Field( - 30, description='Timeout in seconds before the request is aborted.', title='Timeout' - ) - allowed_users: Optional[List[str]] = Field( - None, description='Users allowed to launch processes', title='Allowed Users' - ) - disallowed_users: Optional[List[str]] = Field( - ['root'], description='Users not allowed to launch processes', title='Disallowed Users' - ) - user_mapping: Optional[Dict[str, str]] = Field( - {}, description='Map of calling user to system user', title='User Mapping' - ) - minimum_uid: Optional[int] = Field( - 1000, description='Minimum UID of users allowed to launch processes', title='Minimum Uid' - ) - minimum_gid: Optional[int] = Field( - 1000, description='Minimum GID of users allowed to launch processes', title='Minimum Gid' - ) - - -class Queue(BaseModel): - name: Optional[str] = Field(None, description='Queue name', title='Name') - node_groups: Optional[List[NodeGroup]] = Field( - None, - description='List of node groups associated with the queue (If available)', - title='Node Groups', - ) - additional_props: Optional[Dict[str, Any]] = Field({}, title='Additional Props') - - -class Resources(BaseModel): - num_cores: Optional[int] = Field(None, description='Number of cores', title='Num Cores') - platform: Optional[PlatformEnum] = Field( - None, description="Basic platform information: 'windows' or 'linux'" - ) - memory: Optional[int] = Field(None, description='Amount of RAM in bytes', title='Memory') - disk_space: Optional[int] = Field( - None, description='Amount of disk space in bytes', title='Disk Space' - ) - custom: Optional[Dict[str, Optional[Union[bool, int, str, float]]]] = Field( - {}, description='Custom resource properties.', title='Custom' - ) - num_instances: Optional[int] = Field( - None, - description='Number of instances/jobs that can be created on the compute resource set', - title='Num Instances', - ) - - -class RestLauncherProcessRunner(BaseModel): - plugin_name: Literal['process_launcher_service'] = Field(..., title='Plugin Name') - launcher_url: Optional[str] = Field( - 'http://localhost:4911', - description='The url to use when none is specified', - title='Launcher Url', - ) - verify_ssl: Optional[bool] = Field( - True, description='Check the SSL certificate for HTTPS launchers', title='Verify Ssl' - ) - timeout: Optional[int] = Field( - 30, description='Timeout in seconds before the request is aborted.', title='Timeout' - ) - shell: Optional[bool] = Field( - True, description='Enable the shell interpretation on subprocess run', title='Shell' - ) - - -class ScalerApplicationInfo(BaseModel): - name: str = Field(..., description='Application name', title='Name') - version: str = Field(..., description='Application version', title='Version') - install_path: str = Field( - ..., description='Installation path of application', title='Install Path' - ) - executable: str = Field( - ..., description='Executable path to run application', title='Executable' - ) - environment: Optional[Dict[str, Any]] = Field( - None, description='Environment setup for the process', title='Environment' - ) - capabilities: Optional[List[str]] = Field( - None, description='Capabilities of this application', title='Capabilities' - ) - customization_hook: Optional[Dict[str, Any]] = Field( - None, - description='Details of a custom hook used to modify the configuration before runs are performed', - title='Customization Hook', - ) - resource_name: Optional[str] = Field( - None, - description='Kubernetes object (deployment/statefulset) name to be used as target resource by keda', - title='Resource Name', - ) - scaling_max_eval_instances: Optional[int] = Field( - 1, - description='Maximum number of instances that can be created when scaling up', - title='Scaling Max Eval Instances', - ) - scaling_min_eval_instances: Optional[int] = Field( - 0, - description='Minimum number of instances than can de terminated when scaling down', - title='Scaling Min Eval Instances', - ) - scaling_threshold: Optional[int] = Field( - 1, - description='Threshold value to determine when kubernetes deployments should be scaled up/down', - title='Scaling Threshold', - ) - cool_down_period: Optional[int] = Field( - 60, - description='The period to wait after the last trigger reported active before scaling the resource back to 0', - title='Cool Down Period', - ) - - -class ScalerRegistration(BaseModel): - id: Optional[str] = Field(None, description='Unique identifier for this worker', title='Id') - name: Optional[str] = Field(None, description='User defined name for this worker', title='Name') - last_modified: Optional[datetime] = Field( - None, - description='Date and time when the registration was last modified', - title='Last Modified', - ) - host_id: Optional[str] = Field( - None, description='Static, hardware and configuration based UUID', title='Host Id' - ) - host_name: Optional[str] = Field( - None, description='Name of the host on which the worker is running', title='Host Name' - ) - username: Optional[str] = Field( - None, description='Username the evaluator authenticated with', title='Username' - ) - platform: Optional[str] = Field( - None, description='OS the evaluator is running on', title='Platform' - ) - build_info: Optional[Dict[str, Any]] = Field( - {}, description='Detailed build information', title='Build Info' - ) - config_modified: Optional[datetime] = Field( - None, - description="Date and time of the configuration's last modification", - title='Config Modified', - ) - - -class ScalersCountResponse(BaseModel): - num_scalers: Optional[int] = Field(0, title='Num Scalers') - - -class ScalersRequest(BaseModel): - scalers: List[ScalerRegistration] = Field(..., description='Scaler details', title='Scalers') - - -class ScalersResponse(BaseModel): - scalers: List[ScalerRegistration] = Field(..., description='Scaler details', title='Scalers') - - -class ServiceUserProcessRunner(BaseModel): - plugin_name: Literal['service_user_module'] = Field(..., title='Plugin Name') - - -class Status(BaseModel): - time: str = Field(..., title='Time') - build: Dict[str, Any] = Field(..., title='Build') - - -class ClusterInfo(BaseModel): - id: Optional[str] = Field(None, description='Unique identifier for database', title='Id') - crs_id: Optional[str] = Field(None, description='Compute resource set ID', title='Crs Id') - name: Optional[str] = Field(None, description='Cluster name', title='Name') - queues: Optional[List[Queue]] = Field([], title='Queues') - nodes: Optional[List[Node]] = Field([], title='Nodes') - additional_props: Optional[Dict[str, Dict[str, Any]]] = Field({}, title='Additional Props') - - -class Context(BaseModel): - custom: Optional[Dict[str, Optional[Union[int, bool, str, float]]]] = Field( - {}, description='Custom runtime properties.', title='Custom' - ) - machines_list: Optional[List[Machine]] = Field( - None, - description='List of machines for distributed parallel processing.', - title='Machines List', - ) - - -class EvaluatorResources(BaseModel): - num_cores: Optional[int] = Field(None, description='Number of cores', title='Num Cores') - platform: Optional[PlatformEnum] = Field( - None, description="Basic platform information: 'windows' or 'linux'" - ) - memory: Optional[int] = Field(None, description='Amount of RAM in bytes', title='Memory') - disk_space: Optional[int] = Field( - None, description='Amount of disk space in bytes', title='Disk Space' - ) - custom: Optional[Dict[str, Optional[Union[bool, int, str, float]]]] = Field( - {}, description='Custom resource properties.', title='Custom' - ) - hpc_resources: Optional[HpcResources] = None - - -class OrchestrationInterfacesBackend(BaseModel): - plugin_name: Literal['orchestration_interfaces'] = Field(..., title='Plugin Name') - debug: Optional[bool] = Field( - False, description='Enable additional debugging of the backend', title='Debug' - ) - scheduler_type: Optional[str] = Field( - 'slurm', - description='Job scheduler type to use in the backend (slurm, pbs, uge...)', - title='Scheduler Type', - ) - scheduler_queue_default: Optional[str] = Field( - None, - description='Job scheduler queue to be used for submission', - title='Scheduler Queue Default', - ) - scheduler_command_override: Optional[str] = Field( - None, - description='The path to the Json file with custom scheduler command definitions', - title='Scheduler Command Override', - ) - scheduler_script_override: Optional[str] = Field( - None, - description='The path to the shell script to template for the scheduler', - title='Scheduler Script Override', - ) - exclusive_default: Optional[bool] = Field( - False, - description='Request the scheduler to hold the node(s) exclusively for one request', - title='Exclusive Default', - ) - distributed_default: Optional[bool] = Field( - True, - description='Allow the scheduler to provide multiple machines to fulfill the request', - title='Distributed Default', - ) - num_cores_default: Optional[int] = Field( - 1, - description='The number of cores to request from the scheduler for a task', - title='Num Cores Default', - ) - working_dir: Optional[str] = Field( - None, description='Working directory to use in the backend', title='Working Dir' - ) - env: Optional[Dict[str, Any]] = Field( - None, description='Static environment variables needed for job execution', title='Env' - ) - process_runner: Optional[ - Union[ServiceUserProcessRunner, ProcessLauncherProcessRunner, RestLauncherProcessRunner] - ] = Field( - {'plugin_name': 'service_user_module'}, - description='Process runner used to execute commands', - discriminator='plugin_name', - title='Process Runner', - ) - create_workdir: Optional[bool] = Field( - True, - description='Create base and/or user specific working directories at runtime', - title='Create Workdir', - ) - use_templates: Optional[bool] = Field( - True, - description='Use the templated versions of the scripts and write them to the workdir', - title='Use Templates', - ) - - -class ComputeResourceSet(BaseModel): - name: Optional[str] = Field( - 'default', description='Name of the compute resource set', title='Name' - ) - id: Optional[str] = Field(None, description='Unique identifier for this set', title='Id') - scaler_id: Optional[str] = Field( - None, description='temporary. removed after transitioning to client_id', title='Scaler Id' - ) - last_modified: Optional[datetime] = Field( - None, description='Last modified time', title='Last Modified' - ) - backend: Optional[ - Union[KubernetesKedaBackend, OrchestrationInterfacesBackend, LocalBackend, MockupBackend] - ] = Field( - {'debug': False, 'plugin_name': 'local'}, - description='Backend to use in this compute resource set', - discriminator='plugin_name', - title='Backend', - ) - scaling_strategy: Optional[Union[MaxAvailableResourceScaling, KubernetesResourceScaling]] = ( - Field( - {'match_all_requirements': False, 'plugin_name': 'max_available_resource_scaling'}, - description='Scaling strategy to use in this compute resource set', - discriminator='plugin_name', - title='Scaling Strategy', - ) - ) - available_resources: Optional[Resources] = Field( - {'custom': {}}, description='Available resources in the compute resource set' - ) - available_applications: Optional[List[ScalerApplicationInfo]] = Field( - [], description='List of available applications', title='Available Applications' - ) - evaluator_requirements_matching: Optional[bool] = Field( - False, - description='Whether the evaluators should do matching of resource and software requirements or not', - title='Evaluator Requirements Matching', - ) - evaluator_task_directory_cleanup: Optional[EvaluatorTaskDirectoryCleanup] = Field( - 'always', - description='Cleanup policy for task directories passed to evaluators', - title='Evaluator Task Directory Cleanup', - ) - evaluator_auto_shutdown_time: Optional[int] = Field( - 20, - description='Time after which to shutdown the evaluator if not running any jobs.', - title='Evaluator Auto Shutdown Time', - ) - evaluator_loop_interval: Optional[int] = Field( - 5, - description='The main evaluator loop is repeated every loop_interval seconds', - title='Evaluator Loop Interval', - ) - - -class ComputeResourceSetsRequest(BaseModel): - compute_resource_sets: List[ComputeResourceSet] = Field( - ..., description='Compute resource set details', title='Compute Resource Sets' - ) - - -class ComputeResourceSetsResponse(BaseModel): - compute_resource_sets: List[ComputeResourceSet] = Field( - ..., description='Compute resource set details', title='Compute Resource Sets' - ) - - -class EvaluatorConfiguration(BaseModel): - id: Optional[str] = Field(None, description='Unique DB identifier (readonly)', title='Id') - evaluator_id: Optional[str] = Field( - None, description='Identifier of the parent evaluator (readonly)', title='Evaluator Id' - ) - last_modified: Optional[datetime] = Field( - None, description='Last modified time', title='Last Modified' - ) - working_directory: Optional[str] = Field(None, title='Working Directory') - local_file_cache_max_size: Optional[int] = Field( - None, - description='Maximum allowed cache size in bytes or None', - title='Local File Cache Max Size', - ) - max_num_parallel_tasks: Optional[int] = Field(None, title='Max Num Parallel Tasks') - task_directory_cleanup: Optional[TaskDirectoryCleanupEnum] = Field( - None, title='Task Directory Cleanup' - ) - resources: Optional[EvaluatorResources] = {'custom': {}} - task_manager_type: Optional[str] = Field(None, title='Task Manager Type') - loop_interval: Optional[float] = Field( - 5.0, - description='The main evaluator loop is repeated every loop_interval seconds', - title='Loop Interval', - ) - local_file_cache: Optional[bool] = Field( - True, - description='Whether to configure a local file cache in file tool or not', - title='Local File Cache', - ) - applications: Optional[List[ApplicationInfo]] = Field( - [], description='List of available applications', title='Applications' - ) - project_server_select: Optional[bool] = Field( - True, - description='Get project assignments from the server instead of using the locally set values', - title='Project Server Select', - ) - project_list: Optional[List[str]] = Field( - [], - description='IDs of projects the evaluator should work on, in order', - title='Project List', - ) - project_assignment_mode: Optional[str] = Field( - 'all_active', - description='Specifies how the evaluator selects projects to work on. One of: disabled, all_active, list', - title='Project Assignment Mode', - ) - context: Optional[Context] = Field( - {'custom': {}}, description='Runtime properties to be passed to executed tasks' - ) - - -class EvaluatorConfigurationUpdate(BaseModel): - id: Optional[str] = Field(None, description='Unique DB identifier (readonly)', title='Id') - evaluator_id: Optional[str] = Field( - None, description='Identifier of the parent evaluator (readonly)', title='Evaluator Id' - ) - last_modified: Optional[datetime] = Field( - None, description='Last modified time', title='Last Modified' - ) - working_directory: Optional[str] = Field(None, title='Working Directory') - local_file_cache_max_size: Optional[int] = Field( - None, - description='Maximum allowed cache size in bytes or None', - title='Local File Cache Max Size', - ) - max_num_parallel_tasks: Optional[int] = Field(None, title='Max Num Parallel Tasks') - task_directory_cleanup: Optional[TaskDirectoryCleanupEnum] = Field( - None, title='Task Directory Cleanup' - ) - resources: Optional[EvaluatorResources] = {'custom': {}} - name: Optional[str] = Field( - None, description='Update the name of Evaluator (updating the registration)', title='Name' - ) - loop_interval: Optional[float] = Field( - None, - description='The main evaluator loop is repeated every loop_interval seconds', - title='Loop Interval', - ) - local_file_cache: Optional[bool] = Field( - None, - description='Whether to configure a local file cache in file tool or not', - title='Local File Cache', - ) - applications: Optional[List[ApplicationInfo]] = Field( - [], description='List of available applications', title='Applications' - ) - project_list: Optional[List[str]] = Field( - None, - description='IDs of projects the evaluator should work on, in order', - title='Project List', - ) - project_assignment_mode: Optional[str] = Field( - None, - description='Specifies how the evaluator selects projects to work on. One of: disabled, all_active, list', - title='Project Assignment Mode', - ) - context: Optional[ContextUpdate] = Field( - {'custom': {}}, description='Runtime properties to be passed to executed tasks' - ) - - -class EvaluatorConfigurationUpdatesRequest(BaseModel): - configuration_updates: List[EvaluatorConfigurationUpdate] = Field( - ..., description='Configuration update details', title='Configuration Updates' - ) - - -class EvaluatorConfigurationUpdatesResponse(BaseModel): - configuration_updates: List[EvaluatorConfigurationUpdate] = Field( - ..., description='Configuration update details', title='Configuration Updates' - ) - - -class EvaluatorConfigurationsResponse(BaseModel): - configurations: List[EvaluatorConfiguration] = Field( - ..., description='Evaluator configurations', title='Configurations' - ) diff --git a/pyproject.toml b/pyproject.toml index 8ff20f05b..be73be452 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,76 @@ [build-system] -requires = ["setuptools", "wheel"] -build-backend = "setuptools.build_meta" +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" + +[project] +# Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections +name = "ansys-pyhps" +version = "0.6.dev0" +description = "A python client for Ansys HPC Platform Services" +readme = "README.rst" +requires-python = ">=3.9,<4.0" +license = {file = "LICENSE"} +authors = [ + {name = "ANSYS, Inc.", email = "pyansys.core@ansys.com"}, +] +maintainers = [ + {name = "ANSYS, Inc.", email = "pyansys.core@ansys.com"}, +] + +classifiers = [ + "Development Status :: 4 - Beta", + 'Intended Audience :: Science/Research', + 'Topic :: Scientific/Engineering :: Information Analysis', + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] + +dependencies = [ + "requests>=2.21.0", + "marshmallow>=3.0.0", + "marshmallow_oneofschema>=2.0.1", + "python-keycloak>=1.5.0,<=2.12.0", + "backoff>=2.0.0", + "pydantic>=1.10.0", +] + +[project.optional-dependencies] +tests = [ + "pytest==7.4.4", + "pytest-cov==4.1.0", +] + +doc = [ + "Sphinx==7.2.6", + "numpydoc==1.6.0", + "ansys-sphinx-theme==0.12.5", + "sphinx-copybutton==0.5.2", + "sphinxcontrib-httpdomain==1.8.1", + "sphinxcontrib-globalsubs==0.1.1", + "sphinxnotes-strike==1.2", + "sphinx-autodoc-typehints==1.25.2", + "autodoc_pydantic==2.0.1", +] + +build = [ + "build==1.0.3", + "twine==4.0.2", + "wheel", + "datamodel-code-generator==0.24.2" +] + +[project.urls] +Documentation = "https://hps.docs.pyansys.com" +Source = "https://github.com/ansys/pyhps" +Homepage = "https://github.com/ansys/pyhps" +Tracker = "https://github.com/ansys/pyhps/issues" + +[tool.flit.module] +name = "ansys.hps.client" [tool.black] line-length = 100 @@ -10,9 +80,10 @@ profile = "black" force_sort_within_sections = true line_length = 100 default_section = "THIRDPARTY" -src_paths = ["doc", "ansys", "tests"] +src_paths = ["doc", "src", "tests"] [tool.coverage.run] +relative_files = true source = ["ansys.rep"] [tool.coverage.report] diff --git a/requirements/requirements_build.txt b/requirements/requirements_build.txt deleted file mode 100644 index 22cd1a5c5..000000000 --- a/requirements/requirements_build.txt +++ /dev/null @@ -1,4 +0,0 @@ -build==1.0.3 -twine==4.0.2 -wheel -datamodel-code-generator==0.24.2 \ No newline at end of file diff --git a/requirements/requirements_doc.txt b/requirements/requirements_doc.txt deleted file mode 100644 index 758915c79..000000000 --- a/requirements/requirements_doc.txt +++ /dev/null @@ -1,10 +0,0 @@ -Sphinx==7.2.6 -numpydoc==1.6.0 -ansys-sphinx-theme==0.12.5 -sphinx-copybutton==0.5.2 -apispec==6.3.1 -sphinxcontrib-httpdomain==1.8.1 -sphinxcontrib-globalsubs==0.1.1 -sphinxnotes-strike==1.2 -sphinx-autodoc-typehints==1.25.2 -autodoc_pydantic==2.0.1 \ No newline at end of file diff --git a/requirements/requirements_tests.txt b/requirements/requirements_tests.txt deleted file mode 100644 index 9a6c85a4f..000000000 --- a/requirements/requirements_tests.txt +++ /dev/null @@ -1,2 +0,0 @@ -pytest==7.4.4 -pytest-cov==4.1.0 diff --git a/setup.py b/setup.py deleted file mode 100644 index 4ffbbaef1..000000000 --- a/setup.py +++ /dev/null @@ -1,43 +0,0 @@ -import os - -from setuptools import find_namespace_packages, setup - -# We follow option 3 suggested by PyPA -# https://packaging.python.org/guides/single-sourcing-package-version/ -# to get the package version. -root = os.path.abspath(os.path.dirname(__file__)) -about = {} -with open(os.path.join(root, "ansys", "hps", "client", "__version__.py"), "r") as f: - exec(f.read(), about) - -setup( - name="ansys-pyhps", - version=about["__version__"], - url=about["__url__"], - author="ANSYS, Inc.", - author_email="pyansys.support@ansys.com", - maintainer="ANSYS, Inc.", - maintainer_email="pyansys.maintainers@ansys.com", - classifiers=[ - "Development Status :: 4 - Beta", - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], - license="MIT", - license_file="LICENSE", - description="A python client for Ansys HPC Platform Services", - long_description=open("README.rst").read(), - long_description_content_type="text/x-rst", - install_requires=[ - "requests>=2.21.0", - "marshmallow>=3.0.0", - "marshmallow_oneofschema>=2.0.1", - "cachetools>=4.0.0", - "python-keycloak>=1.5.0,<=2.12.0", - "backoff>=2.0.0", - "pydantic>=1.10.0", - ], - python_requires=">=3.9", - packages=find_namespace_packages(include=["ansys.*"]), -) diff --git a/ansys/hps/client/__init__.py b/src/ansys/hps/client/__init__.py similarity index 100% rename from ansys/hps/client/__init__.py rename to src/ansys/hps/client/__init__.py diff --git a/ansys/hps/client/__version__.py b/src/ansys/hps/client/__version__.py similarity index 100% rename from ansys/hps/client/__version__.py rename to src/ansys/hps/client/__version__.py diff --git a/ansys/hps/client/auth/__init__.py b/src/ansys/hps/client/auth/__init__.py similarity index 100% rename from ansys/hps/client/auth/__init__.py rename to src/ansys/hps/client/auth/__init__.py diff --git a/ansys/hps/client/auth/api/__init__.py b/src/ansys/hps/client/auth/api/__init__.py similarity index 100% rename from ansys/hps/client/auth/api/__init__.py rename to src/ansys/hps/client/auth/api/__init__.py diff --git a/ansys/hps/client/auth/api/auth_api.py b/src/ansys/hps/client/auth/api/auth_api.py similarity index 100% rename from ansys/hps/client/auth/api/auth_api.py rename to src/ansys/hps/client/auth/api/auth_api.py diff --git a/ansys/hps/client/auth/authenticate.py b/src/ansys/hps/client/auth/authenticate.py similarity index 100% rename from ansys/hps/client/auth/authenticate.py rename to src/ansys/hps/client/auth/authenticate.py diff --git a/ansys/hps/client/auth/resource/__init__.py b/src/ansys/hps/client/auth/resource/__init__.py similarity index 100% rename from ansys/hps/client/auth/resource/__init__.py rename to src/ansys/hps/client/auth/resource/__init__.py diff --git a/ansys/hps/client/auth/resource/user.py b/src/ansys/hps/client/auth/resource/user.py similarity index 96% rename from ansys/hps/client/auth/resource/user.py rename to src/ansys/hps/client/auth/resource/user.py index 8076d5e0d..ac5911273 100644 --- a/ansys/hps/client/auth/resource/user.py +++ b/src/ansys/hps/client/auth/resource/user.py @@ -1,8 +1,11 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object + from ..schema.user import UserSchema + class User(Object): """User resource. @@ -27,7 +30,8 @@ class Meta: schema = UserSchema rest_name = "None" - def __init__(self, + def __init__( + self, id=missing, username=missing, password=missing, @@ -45,4 +49,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + UserSchema.Meta.object_class = User diff --git a/ansys/hps/client/auth/schema/__init__.py b/src/ansys/hps/client/auth/schema/__init__.py similarity index 100% rename from ansys/hps/client/auth/schema/__init__.py rename to src/ansys/hps/client/auth/schema/__init__.py diff --git a/ansys/hps/client/auth/schema/user.py b/src/ansys/hps/client/auth/schema/user.py similarity index 100% rename from ansys/hps/client/auth/schema/user.py rename to src/ansys/hps/client/auth/schema/user.py diff --git a/ansys/hps/client/client.py b/src/ansys/hps/client/client.py similarity index 100% rename from ansys/hps/client/client.py rename to src/ansys/hps/client/client.py diff --git a/ansys/hps/client/common/__init__.py b/src/ansys/hps/client/common/__init__.py similarity index 100% rename from ansys/hps/client/common/__init__.py rename to src/ansys/hps/client/common/__init__.py diff --git a/ansys/hps/client/common/base_resource.py b/src/ansys/hps/client/common/base_resource.py similarity index 100% rename from ansys/hps/client/common/base_resource.py rename to src/ansys/hps/client/common/base_resource.py diff --git a/ansys/hps/client/common/base_schema.py b/src/ansys/hps/client/common/base_schema.py similarity index 100% rename from ansys/hps/client/common/base_schema.py rename to src/ansys/hps/client/common/base_schema.py diff --git a/ansys/hps/client/common/restricted_value.py b/src/ansys/hps/client/common/restricted_value.py similarity index 100% rename from ansys/hps/client/common/restricted_value.py rename to src/ansys/hps/client/common/restricted_value.py diff --git a/ansys/hps/client/connection.py b/src/ansys/hps/client/connection.py similarity index 100% rename from ansys/hps/client/connection.py rename to src/ansys/hps/client/connection.py diff --git a/ansys/hps/client/exceptions.py b/src/ansys/hps/client/exceptions.py similarity index 100% rename from ansys/hps/client/exceptions.py rename to src/ansys/hps/client/exceptions.py diff --git a/ansys/hps/client/jms/__init__.py b/src/ansys/hps/client/jms/__init__.py similarity index 100% rename from ansys/hps/client/jms/__init__.py rename to src/ansys/hps/client/jms/__init__.py diff --git a/ansys/hps/client/jms/api/__init__.py b/src/ansys/hps/client/jms/api/__init__.py similarity index 100% rename from ansys/hps/client/jms/api/__init__.py rename to src/ansys/hps/client/jms/api/__init__.py diff --git a/ansys/hps/client/jms/api/base.py b/src/ansys/hps/client/jms/api/base.py similarity index 100% rename from ansys/hps/client/jms/api/base.py rename to src/ansys/hps/client/jms/api/base.py diff --git a/ansys/hps/client/jms/api/jms_api.py b/src/ansys/hps/client/jms/api/jms_api.py similarity index 100% rename from ansys/hps/client/jms/api/jms_api.py rename to src/ansys/hps/client/jms/api/jms_api.py diff --git a/ansys/hps/client/jms/api/project_api.py b/src/ansys/hps/client/jms/api/project_api.py similarity index 100% rename from ansys/hps/client/jms/api/project_api.py rename to src/ansys/hps/client/jms/api/project_api.py diff --git a/ansys/hps/client/jms/keys.py b/src/ansys/hps/client/jms/keys.py similarity index 100% rename from ansys/hps/client/jms/keys.py rename to src/ansys/hps/client/jms/keys.py diff --git a/ansys/hps/client/jms/resource/.gitignore b/src/ansys/hps/client/jms/resource/.gitignore similarity index 100% rename from ansys/hps/client/jms/resource/.gitignore rename to src/ansys/hps/client/jms/resource/.gitignore diff --git a/ansys/hps/client/jms/resource/__init__.py b/src/ansys/hps/client/jms/resource/__init__.py similarity index 58% rename from ansys/hps/client/jms/resource/__init__.py rename to src/ansys/hps/client/jms/resource/__init__.py index c88cb5b7a..bde84e4df 100644 --- a/ansys/hps/client/jms/resource/__init__.py +++ b/src/ansys/hps/client/jms/resource/__init__.py @@ -14,12 +14,30 @@ from .job_definition import JobDefinition from .license_context import LicenseContext from .operation import Operation -from .parameter_definition import ParameterDefinition, FloatParameterDefinition, \ - IntParameterDefinition, StringParameterDefinition, BoolParameterDefinition +from .parameter_definition import ( + BoolParameterDefinition, + FloatParameterDefinition, + IntParameterDefinition, + ParameterDefinition, + StringParameterDefinition, +) from .parameter_mapping import ParameterMapping -from .project import Project from .permission import Permission +from .project import Project from .selection import JobSelection from .task import Task -from .task_definition import Licensing, SuccessCriteria, Software, ResourceRequirements, TaskDefinition, HpcResources -from .task_definition_template import TaskDefinitionTemplate, TemplateInputFile, TemplateOutputFile, TemplateResourceRequirements, TemplateProperty \ No newline at end of file +from .task_definition import ( + HpcResources, + Licensing, + ResourceRequirements, + Software, + SuccessCriteria, + TaskDefinition, +) +from .task_definition_template import ( + TaskDefinitionTemplate, + TemplateInputFile, + TemplateOutputFile, + TemplateProperty, + TemplateResourceRequirements, +) diff --git a/ansys/hps/client/jms/resource/algorithm.py b/src/ansys/hps/client/jms/resource/algorithm.py similarity index 95% rename from ansys/hps/client/jms/resource/algorithm.py rename to src/ansys/hps/client/jms/resource/algorithm.py index 75329adfe..ffcca2dda 100644 --- a/ansys/hps/client/jms/resource/algorithm.py +++ b/src/ansys/hps/client/jms/resource/algorithm.py @@ -1,8 +1,11 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object + from ..schema.algorithm import AlgorithmSchema + class Algorithm(Object): """Algorithm resource. @@ -23,7 +26,8 @@ class Algorithm(Object): description : str, optional Description of the algorithm. data : str, optional - Generic string field to hold arbitrary algorithm configuration data, e.g. as JSON dictionary. + Generic string field to hold arbitrary algorithm configuration data, + e.g. as JSON dictionary. jobs : list[str] List of job IDs. @@ -33,7 +37,8 @@ class Meta: schema = AlgorithmSchema rest_name = "algorithms" - def __init__(self, + def __init__( + self, id=missing, creation_time=missing, modification_time=missing, @@ -57,4 +62,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + AlgorithmSchema.Meta.object_class = Algorithm diff --git a/ansys/hps/client/jms/resource/evaluator.py b/src/ansys/hps/client/jms/resource/evaluator.py similarity index 95% rename from ansys/hps/client/jms/resource/evaluator.py rename to src/ansys/hps/client/jms/resource/evaluator.py index 8e1943988..a304b7d5a 100644 --- a/ansys/hps/client/jms/resource/evaluator.py +++ b/src/ansys/hps/client/jms/resource/evaluator.py @@ -1,8 +1,10 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object -from ..schema.evaluator import EvaluatorConfigurationUpdateSchema -from ..schema.evaluator import EvaluatorSchema + +from ..schema.evaluator import EvaluatorConfigurationUpdateSchema, EvaluatorSchema + class EvaluatorConfigurationUpdate(Object): """EvaluatorConfigurationUpdate resource. @@ -27,7 +29,8 @@ class Meta: schema = EvaluatorConfigurationUpdateSchema rest_name = "None" - def __init__(self, + def __init__( + self, id=missing, name=missing, applications=missing, @@ -53,8 +56,10 @@ def __init__(self, self.obj_type = self.__class__.__name__ + EvaluatorConfigurationUpdateSchema.Meta.object_class = EvaluatorConfigurationUpdate + class Evaluator(Object): """Evaluator resource. @@ -63,7 +68,8 @@ class Evaluator(Object): id : str, optional Unique ID to access the resource, generated internally by the server on creation. host_id : str - Unique identifier built from hardware information and selected configuration details of an evaluator. + Unique identifier built from hardware information and selected configuration details + of an evaluator. name : str, optional Name of the evaluator. hostname : str, optional @@ -75,11 +81,13 @@ class Evaluator(Object): 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 it's own local settings. + Whether the evaluator allows server-driven assignment of projects or + uses it's 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 it's registration details. Used to check which evaluators are alive. + Last time the evaluator updated it's registration details. + 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 @@ -99,7 +107,8 @@ class Meta: schema = EvaluatorSchema rest_name = "evaluators" - def __init__(self, + def __init__( + self, id=missing, host_id=missing, name=missing, @@ -137,4 +146,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + EvaluatorSchema.Meta.object_class = Evaluator diff --git a/ansys/hps/client/jms/resource/file.py b/src/ansys/hps/client/jms/resource/file.py similarity index 87% rename from ansys/hps/client/jms/resource/file.py rename to src/ansys/hps/client/jms/resource/file.py index 65c9fa044..f062aac9f 100644 --- a/ansys/hps/client/jms/resource/file.py +++ b/src/ansys/hps/client/jms/resource/file.py @@ -1,10 +1,12 @@ -from marshmallow.utils import missing -from typing import Union import io +from typing import Union + +from marshmallow.utils import missing -from ..schema.file import FileSchema from ansys.hps.client.common import Object +from ..schema.file import FileSchema + class File(Object): """File resource. @@ -14,15 +16,16 @@ class File(Object): src : Union[str, io.IOBase], optional Client-only field to specify either the path of an input file or a file-like object. In the latter case, `requests` recommends that - you open files in binary mode. + you open files in binary mode. id : str, optional Unique ID to access the resource, generated internally by the server on creation. name : str Name of the file resource. type : str, optional - Type of the file. This can be any string but using a correct media type for the given resource is advisable. + Type of the file. This can be any string but using a correct media type for + the given resource is advisable. storage_id : str, optional - File's identifier in the (orthogonal) file storage system + File's identifier in the (orthogonal) file storage system. size : int, optional hash : str, optional creation_time : datetime, optional @@ -41,11 +44,13 @@ class File(Object): monitor : bool, optional Whether to live monitor the file's content. collect : bool, optional - Whether file should be collected per job + Whether file should be collected per job. collect_interval : int, optional - Collect frequency for a file with collect=True. Min value limited by the evaluator's settings. 0/None - let the evaluator decide, other value - interval in seconds + Collect frequency for a file with collect=True. Min value limited by the + evaluator's settings. + 0/None - let the evaluator decide, other value - interval in seconds. reference_id : str, optional - Reference file from which this one was created + Reference file from which this one was created. """ @@ -53,8 +58,9 @@ class Meta: schema = FileSchema rest_name = "files" - def __init__(self, - src=None, + def __init__( + self, + src=Union[str, io.IOBase], id=missing, name=missing, type=missing, @@ -97,4 +103,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + FileSchema.Meta.object_class = File diff --git a/ansys/hps/client/jms/resource/fitness_definition.py b/src/ansys/hps/client/jms/resource/fitness_definition.py similarity index 98% rename from ansys/hps/client/jms/resource/fitness_definition.py rename to src/ansys/hps/client/jms/resource/fitness_definition.py index fa3178b0e..faa55ecbd 100644 --- a/ansys/hps/client/jms/resource/fitness_definition.py +++ b/src/ansys/hps/client/jms/resource/fitness_definition.py @@ -9,9 +9,10 @@ from marshmallow.utils import missing -from ..schema.fitness_definition import FitnessDefinitionSchema, FitnessTermDefinitionSchema from ansys.hps.client.common import Object +from ..schema.fitness_definition import FitnessDefinitionSchema, FitnessTermDefinitionSchema + log = logging.getLogger(__name__) @@ -22,7 +23,7 @@ class FitnessTermDefinition(Object): ---------- id : str, optional Unique ID to access the resource, generated internally by the server on creation. - name : str, optional + name : str, optional Name of the fitness term. expression : str, optional The Python expression that defines the fitness term. @@ -35,16 +36,16 @@ class FitnessTermDefinition(Object): -------- A fitness term of type objective - + >>> ft1 = FitnessTermDefinition( ... name="weight", ... type="design_objective", ... weighting_factor=1.0, ... expression="map_design_objective(values['weight'],7.5,5.5)" ... ) - + A fitness term of type target constraint - + >>> ft2 = FitnessTermDefinition( ... name="torsional_stiffness", ... type="target_constraint", @@ -52,9 +53,9 @@ class FitnessTermDefinition(Object): ... expression="map_target_constraint( ... values['torsion_stiffness'], 1313.0, 5.0, 30.0)" ... ) - + A fitness term of type limit constraint - + >>> ft3 = FitnessTermDefinition( ... name="max_stress", ... type="limit_constraint", diff --git a/ansys/hps/client/jms/resource/job.py b/src/ansys/hps/client/jms/resource/job.py similarity index 95% rename from ansys/hps/client/jms/resource/job.py rename to src/ansys/hps/client/jms/resource/job.py index 9bcc7e5a6..b76a99282 100644 --- a/ansys/hps/client/jms/resource/job.py +++ b/src/ansys/hps/client/jms/resource/job.py @@ -1,8 +1,11 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object + from ..schema.job import JobSchema + class Job(Object): """Job resource. @@ -25,7 +28,8 @@ class Job(Object): job_definition_id : str ID of the linked job definition, see :class:`JobDefinition`. priority : int, optional - Priority with which jobs are evaluated. The default is 0, which is the highest priority. Assigning a higher value to a job makes it a lower priority. + Priority with which jobs are evaluated. The default is 0, which is the highest priority. + Assigning a higher value to a job makes it a lower priority. values : dict[str, any], optional Dictionary with (name,value) pairs for all parameters defined in the linked job definition. fitness : float, optional @@ -51,7 +55,8 @@ class Meta: schema = JobSchema rest_name = "jobs" - def __init__(self, + def __init__( + self, id=missing, creation_time=missing, modification_time=missing, @@ -93,4 +98,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + JobSchema.Meta.object_class = Job diff --git a/ansys/hps/client/jms/resource/job_definition.py b/src/ansys/hps/client/jms/resource/job_definition.py similarity index 94% rename from ansys/hps/client/jms/resource/job_definition.py rename to src/ansys/hps/client/jms/resource/job_definition.py index 9529f9ba4..1afc29108 100644 --- a/ansys/hps/client/jms/resource/job_definition.py +++ b/src/ansys/hps/client/jms/resource/job_definition.py @@ -1,8 +1,11 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object + from ..schema.job_definition import JobDefinitionSchema + class JobDefinition(Object): """JobDefinition resource. @@ -19,9 +22,10 @@ class JobDefinition(Object): modified_by : str, optional ID of the user who last modified the object. name : str, optional - Name of the job definition + Name of the job definition. active : bool - Defines whether this is the active job definition in the project where evaluators will evaluate pending jobs + Defines whether this is the active job definition in the project where + evaluators will evaluate pending jobs. client_hash : str, optional parameter_definition_ids : list[str] List of parameter definition IDs. @@ -38,7 +42,8 @@ class Meta: schema = JobDefinitionSchema rest_name = "job_definitions" - def __init__(self, + def __init__( + self, id=missing, creation_time=missing, modification_time=missing, @@ -68,4 +73,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + JobDefinitionSchema.Meta.object_class = JobDefinition diff --git a/ansys/hps/client/jms/resource/license_context.py b/src/ansys/hps/client/jms/resource/license_context.py similarity index 86% rename from ansys/hps/client/jms/resource/license_context.py rename to src/ansys/hps/client/jms/resource/license_context.py index 15fbeaea0..31289f732 100644 --- a/ansys/hps/client/jms/resource/license_context.py +++ b/src/ansys/hps/client/jms/resource/license_context.py @@ -1,8 +1,11 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object + from ..schema.license_context import LicenseContextSchema + class LicenseContext(Object): """LicenseContext resource. @@ -19,14 +22,11 @@ class Meta: schema = LicenseContextSchema rest_name = "license_contexts" - def __init__(self, - context_id=missing, - environment=missing, - **kwargs - ): + def __init__(self, context_id=missing, environment=missing, **kwargs): self.context_id = context_id self.environment = environment self.obj_type = self.__class__.__name__ + LicenseContextSchema.Meta.object_class = LicenseContext diff --git a/ansys/hps/client/jms/resource/operation.py b/src/ansys/hps/client/jms/resource/operation.py similarity index 97% rename from ansys/hps/client/jms/resource/operation.py rename to src/ansys/hps/client/jms/resource/operation.py index dce0ebec7..798f57d99 100644 --- a/ansys/hps/client/jms/resource/operation.py +++ b/src/ansys/hps/client/jms/resource/operation.py @@ -1,8 +1,11 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object + from ..schema.operation import OperationSchema + class Operation(Object): """Operation resource. @@ -27,7 +30,8 @@ class Meta: schema = OperationSchema rest_name = "operations" - def __init__(self, + def __init__( + self, id=missing, name=missing, target=missing, @@ -55,4 +59,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + OperationSchema.Meta.object_class = Operation diff --git a/ansys/hps/client/jms/resource/parameter_definition.py b/src/ansys/hps/client/jms/resource/parameter_definition.py similarity index 94% rename from ansys/hps/client/jms/resource/parameter_definition.py rename to src/ansys/hps/client/jms/resource/parameter_definition.py index fadaec34f..981d057ef 100644 --- a/ansys/hps/client/jms/resource/parameter_definition.py +++ b/src/ansys/hps/client/jms/resource/parameter_definition.py @@ -1,11 +1,16 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object -from ..schema.parameter_definition import ParameterDefinitionSchema -from ..schema.parameter_definition import FloatParameterDefinitionSchema -from ..schema.parameter_definition import IntParameterDefinitionSchema -from ..schema.parameter_definition import BoolParameterDefinitionSchema -from ..schema.parameter_definition import StringParameterDefinitionSchema + +from ..schema.parameter_definition import ( + BoolParameterDefinitionSchema, + FloatParameterDefinitionSchema, + IntParameterDefinitionSchema, + ParameterDefinitionSchema, + StringParameterDefinitionSchema, +) + class ParameterDefinition(Object): """ParameterDefinition resource. @@ -19,14 +24,14 @@ class Meta: schema = ParameterDefinitionSchema rest_name = "parameter_definitions" - def __init__(self, - **kwargs - ): + def __init__(self, **kwargs): self.obj_type = self.__class__.__name__ + ParameterDefinitionSchema.Meta.object_class = ParameterDefinition + class FloatParameterDefinition(ParameterDefinition): """FloatParameterDefinition resource. @@ -60,7 +65,8 @@ class FloatParameterDefinition(ParameterDefinition): upper_limit : float, optional Upper bound for the parameter value. step : float, optional - If provided, allowable values are given by: AllowableValue = lower_limit + n * step, where n is an integer and AllowableValue <= upper_limit. + If provided, allowable values are given by: AllowableValue = lower_limit + n * step, + where n is an integer and AllowableValue <= upper_limit. cyclic : bool, optional Indicates if the parameter is cyclic. value_list : list, optional @@ -72,7 +78,8 @@ class Meta: schema = FloatParameterDefinitionSchema rest_name = "parameter_definitions" - def __init__(self, + def __init__( + self, id=missing, creation_time=missing, modification_time=missing, @@ -112,8 +119,10 @@ def __init__(self, self.obj_type = self.__class__.__name__ + FloatParameterDefinitionSchema.Meta.object_class = FloatParameterDefinition + class IntParameterDefinition(ParameterDefinition): """IntParameterDefinition resource. @@ -157,7 +166,8 @@ class Meta: schema = IntParameterDefinitionSchema rest_name = "parameter_definitions" - def __init__(self, + def __init__( + self, id=missing, creation_time=missing, modification_time=missing, @@ -195,8 +205,10 @@ def __init__(self, self.obj_type = self.__class__.__name__ + IntParameterDefinitionSchema.Meta.object_class = IntParameterDefinition + class BoolParameterDefinition(ParameterDefinition): """BoolParameterDefinition resource. @@ -232,7 +244,8 @@ class Meta: schema = BoolParameterDefinitionSchema rest_name = "parameter_definitions" - def __init__(self, + def __init__( + self, id=missing, creation_time=missing, modification_time=missing, @@ -262,8 +275,10 @@ def __init__(self, self.obj_type = self.__class__.__name__ + BoolParameterDefinitionSchema.Meta.object_class = BoolParameterDefinition + class StringParameterDefinition(ParameterDefinition): """StringParameterDefinition resource. @@ -301,7 +316,8 @@ class Meta: schema = StringParameterDefinitionSchema rest_name = "parameter_definitions" - def __init__(self, + def __init__( + self, id=missing, creation_time=missing, modification_time=missing, @@ -333,4 +349,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + StringParameterDefinitionSchema.Meta.object_class = StringParameterDefinition diff --git a/ansys/hps/client/jms/resource/parameter_mapping.py b/src/ansys/hps/client/jms/resource/parameter_mapping.py similarity index 98% rename from ansys/hps/client/jms/resource/parameter_mapping.py rename to src/ansys/hps/client/jms/resource/parameter_mapping.py index 9987bf640..77075af00 100644 --- a/ansys/hps/client/jms/resource/parameter_mapping.py +++ b/src/ansys/hps/client/jms/resource/parameter_mapping.py @@ -1,8 +1,11 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object + from ..schema.parameter_mapping import ParameterMappingSchema + class ParameterMapping(Object): """ParameterMapping resource. @@ -42,7 +45,8 @@ class Meta: schema = ParameterMappingSchema rest_name = "parameter_mappings" - def __init__(self, + def __init__( + self, id=missing, creation_time=missing, modification_time=missing, @@ -88,4 +92,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + ParameterMappingSchema.Meta.object_class = ParameterMapping diff --git a/ansys/hps/client/jms/resource/permission.py b/src/ansys/hps/client/jms/resource/permission.py similarity index 84% rename from ansys/hps/client/jms/resource/permission.py rename to src/ansys/hps/client/jms/resource/permission.py index d8d1a95b0..8c7b54494 100644 --- a/ansys/hps/client/jms/resource/permission.py +++ b/src/ansys/hps/client/jms/resource/permission.py @@ -1,8 +1,11 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object + from ..schema.permission import PermissionSchema + class Permission(Object): """Permission resource. @@ -22,12 +25,8 @@ class Meta: schema = PermissionSchema rest_name = "permissions" - def __init__(self, - permission_type=missing, - value_id=missing, - value_name=missing, - role=missing, - **kwargs + def __init__( + self, permission_type=missing, value_id=missing, value_name=missing, role=missing, **kwargs ): self.permission_type = permission_type self.value_id = value_id @@ -36,4 +35,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + PermissionSchema.Meta.object_class = Permission diff --git a/ansys/hps/client/jms/resource/project.py b/src/ansys/hps/client/jms/resource/project.py similarity index 97% rename from ansys/hps/client/jms/resource/project.py rename to src/ansys/hps/client/jms/resource/project.py index 6eac5a531..2786d8c94 100644 --- a/ansys/hps/client/jms/resource/project.py +++ b/src/ansys/hps/client/jms/resource/project.py @@ -1,8 +1,11 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object + from ..schema.project import ProjectSchema + class Project(Object): """Project resource. @@ -29,7 +32,8 @@ class Meta: schema = ProjectSchema rest_name = "projects" - def __init__(self, + def __init__( + self, id=missing, name=missing, active=missing, @@ -49,4 +53,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + ProjectSchema.Meta.object_class = Project diff --git a/ansys/hps/client/jms/resource/selection.py b/src/ansys/hps/client/jms/resource/selection.py similarity index 97% rename from ansys/hps/client/jms/resource/selection.py rename to src/ansys/hps/client/jms/resource/selection.py index 052c83c07..fed861998 100644 --- a/ansys/hps/client/jms/resource/selection.py +++ b/src/ansys/hps/client/jms/resource/selection.py @@ -1,8 +1,11 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object + from ..schema.selection import JobSelectionSchema + class JobSelection(Object): """JobSelection resource. @@ -31,7 +34,8 @@ class Meta: schema = JobSelectionSchema rest_name = "job_selections" - def __init__(self, + def __init__( + self, id=missing, creation_time=missing, modification_time=missing, @@ -53,4 +57,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + JobSelectionSchema.Meta.object_class = JobSelection diff --git a/ansys/hps/client/jms/resource/task.py b/src/ansys/hps/client/jms/resource/task.py similarity index 97% rename from ansys/hps/client/jms/resource/task.py rename to src/ansys/hps/client/jms/resource/task.py index 18a9fddde..840890bbf 100644 --- a/ansys/hps/client/jms/resource/task.py +++ b/src/ansys/hps/client/jms/resource/task.py @@ -1,8 +1,11 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object + from ..schema.task import TaskSchema + class Task(Object): """Task resource. @@ -35,7 +38,8 @@ class Task(Object): task_definition_id : str ID of the :class:`TaskDefinition` the task is linked to. task_definition_snapshot : TaskDefinition, optional - Snapshot of :class:`TaskDefinition` created when task status changes to prolog, before evaluation. + Snapshot of :class:`TaskDefinition` created when task status changes to prolog, + before evaluation. executed_command : str, optional job_id : str ID of the :class:`Job` the task is linked to. @@ -62,7 +66,8 @@ class Meta: schema = TaskSchema rest_name = "tasks" - def __init__(self, + def __init__( + self, id=missing, creation_time=missing, modification_time=missing, @@ -116,4 +121,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + TaskSchema.Meta.object_class = Task diff --git a/ansys/hps/client/jms/resource/task_definition.py b/src/ansys/hps/client/jms/resource/task_definition.py similarity index 92% rename from ansys/hps/client/jms/resource/task_definition.py rename to src/ansys/hps/client/jms/resource/task_definition.py index d484a974e..b9cd437cf 100644 --- a/ansys/hps/client/jms/resource/task_definition.py +++ b/src/ansys/hps/client/jms/resource/task_definition.py @@ -1,12 +1,17 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object -from ..schema.task_definition import HpcResourcesSchema -from ..schema.task_definition import ResourceRequirementsSchema -from ..schema.task_definition import SoftwareSchema -from ..schema.task_definition import SuccessCriteriaSchema -from ..schema.task_definition import LicensingSchema -from ..schema.task_definition import TaskDefinitionSchema + +from ..schema.task_definition import ( + HpcResourcesSchema, + LicensingSchema, + ResourceRequirementsSchema, + SoftwareSchema, + SuccessCriteriaSchema, + TaskDefinitionSchema, +) + class HpcResources(Object): """HpcResources resource. @@ -24,7 +29,8 @@ class Meta: schema = HpcResourcesSchema rest_name = "None" - def __init__(self, + def __init__( + self, num_cores_per_node=missing, num_gpus_per_node=missing, exclusive=missing, @@ -38,8 +44,10 @@ def __init__(self, self.obj_type = self.__class__.__name__ + HpcResourcesSchema.Meta.object_class = HpcResources + class ResourceRequirements(Object): """ResourceRequirements resource. @@ -59,7 +67,8 @@ class Meta: schema = ResourceRequirementsSchema rest_name = "None" - def __init__(self, + def __init__( + self, platform=missing, memory=missing, num_cores=missing, @@ -79,8 +88,10 @@ def __init__(self, self.obj_type = self.__class__.__name__ + ResourceRequirementsSchema.Meta.object_class = ResourceRequirements + class Software(Object): """Software resource. @@ -97,18 +108,16 @@ class Meta: schema = SoftwareSchema rest_name = "None" - def __init__(self, - name=missing, - version=missing, - **kwargs - ): + def __init__(self, name=missing, version=missing, **kwargs): self.name = name self.version = version self.obj_type = self.__class__.__name__ + SoftwareSchema.Meta.object_class = Software + class SuccessCriteria(Object): """SuccessCriteria resource. @@ -133,7 +142,8 @@ class Meta: schema = SuccessCriteriaSchema rest_name = "None" - def __init__(self, + def __init__( + self, return_code=missing, expressions=missing, required_output_file_ids=missing, @@ -151,8 +161,10 @@ def __init__(self, self.obj_type = self.__class__.__name__ + SuccessCriteriaSchema.Meta.object_class = SuccessCriteria + class Licensing(Object): """Licensing resource. @@ -167,16 +179,15 @@ class Meta: schema = LicensingSchema rest_name = "None" - def __init__(self, - enable_shared_licensing=missing, - **kwargs - ): + def __init__(self, enable_shared_licensing=missing, **kwargs): self.enable_shared_licensing = enable_shared_licensing self.obj_type = self.__class__.__name__ + LicensingSchema.Meta.object_class = Licensing + class TaskDefinition(Object): """TaskDefinition resource. @@ -230,7 +241,8 @@ class Meta: schema = TaskDefinitionSchema rest_name = "task_definitions" - def __init__(self, + def __init__( + self, id=missing, creation_time=missing, modification_time=missing, @@ -278,4 +290,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + TaskDefinitionSchema.Meta.object_class = TaskDefinition diff --git a/ansys/hps/client/jms/resource/task_definition_template.py b/src/ansys/hps/client/jms/resource/task_definition_template.py similarity index 92% rename from ansys/hps/client/jms/resource/task_definition_template.py rename to src/ansys/hps/client/jms/resource/task_definition_template.py index 4475815b6..a14741a39 100644 --- a/ansys/hps/client/jms/resource/task_definition_template.py +++ b/src/ansys/hps/client/jms/resource/task_definition_template.py @@ -1,11 +1,16 @@ # autogenerated code from marshmallow.utils import missing + from ansys.hps.client.common import Object -from ..schema.task_definition_template import TemplatePropertySchema -from ..schema.task_definition_template import TemplateResourceRequirementsSchema -from ..schema.task_definition_template import TemplateInputFileSchema -from ..schema.task_definition_template import TemplateOutputFileSchema -from ..schema.task_definition_template import TaskDefinitionTemplateSchema + +from ..schema.task_definition_template import ( + TaskDefinitionTemplateSchema, + TemplateInputFileSchema, + TemplateOutputFileSchema, + TemplatePropertySchema, + TemplateResourceRequirementsSchema, +) + class TemplateProperty(Object): """TemplateProperty resource. @@ -27,12 +32,8 @@ class Meta: schema = TemplatePropertySchema rest_name = "None" - def __init__(self, - default=missing, - description=missing, - type=missing, - value_list=missing, - **kwargs + def __init__( + self, default=missing, description=missing, type=missing, value_list=missing, **kwargs ): self.default = default self.description = description @@ -41,8 +42,10 @@ def __init__(self, self.obj_type = self.__class__.__name__ + TemplatePropertySchema.Meta.object_class = TemplateProperty + class TemplateResourceRequirements(Object): """TemplateResourceRequirements resource. @@ -62,7 +65,8 @@ class Meta: schema = TemplateResourceRequirementsSchema rest_name = "None" - def __init__(self, + def __init__( + self, platform=missing, memory=missing, num_cores=missing, @@ -82,8 +86,10 @@ def __init__(self, self.obj_type = self.__class__.__name__ + TemplateResourceRequirementsSchema.Meta.object_class = TemplateResourceRequirements + class TemplateInputFile(Object): """TemplateInputFile resource. @@ -106,7 +112,8 @@ class Meta: schema = TemplateInputFileSchema rest_name = "None" - def __init__(self, + def __init__( + self, name=missing, type=missing, evaluation_path=missing, @@ -122,8 +129,10 @@ def __init__(self, self.obj_type = self.__class__.__name__ + TemplateInputFileSchema.Meta.object_class = TemplateInputFile + class TemplateOutputFile(Object): """TemplateOutputFile resource. @@ -150,7 +159,8 @@ class Meta: schema = TemplateOutputFileSchema rest_name = "None" - def __init__(self, + def __init__( + self, name=missing, type=missing, evaluation_path=missing, @@ -170,8 +180,10 @@ def __init__(self, self.obj_type = self.__class__.__name__ + TemplateOutputFileSchema.Meta.object_class = TemplateOutputFile + class TaskDefinitionTemplate(Object): """TaskDefinitionTemplate resource. @@ -216,7 +228,8 @@ class Meta: schema = TaskDefinitionTemplateSchema rest_name = "task_definition_templates" - def __init__(self, + def __init__( + self, id=missing, modification_time=missing, creation_time=missing, @@ -254,4 +267,5 @@ def __init__(self, self.obj_type = self.__class__.__name__ + TaskDefinitionTemplateSchema.Meta.object_class = TaskDefinitionTemplate diff --git a/ansys/hps/client/jms/schema/__init__.py b/src/ansys/hps/client/jms/schema/__init__.py similarity index 100% rename from ansys/hps/client/jms/schema/__init__.py rename to src/ansys/hps/client/jms/schema/__init__.py diff --git a/ansys/hps/client/jms/schema/algorithm.py b/src/ansys/hps/client/jms/schema/algorithm.py similarity index 100% rename from ansys/hps/client/jms/schema/algorithm.py rename to src/ansys/hps/client/jms/schema/algorithm.py diff --git a/ansys/hps/client/jms/schema/evaluator.py b/src/ansys/hps/client/jms/schema/evaluator.py similarity index 100% rename from ansys/hps/client/jms/schema/evaluator.py rename to src/ansys/hps/client/jms/schema/evaluator.py diff --git a/ansys/hps/client/jms/schema/file.py b/src/ansys/hps/client/jms/schema/file.py similarity index 100% rename from ansys/hps/client/jms/schema/file.py rename to src/ansys/hps/client/jms/schema/file.py diff --git a/ansys/hps/client/jms/schema/fitness_definition.py b/src/ansys/hps/client/jms/schema/fitness_definition.py similarity index 100% rename from ansys/hps/client/jms/schema/fitness_definition.py rename to src/ansys/hps/client/jms/schema/fitness_definition.py diff --git a/ansys/hps/client/jms/schema/job.py b/src/ansys/hps/client/jms/schema/job.py similarity index 100% rename from ansys/hps/client/jms/schema/job.py rename to src/ansys/hps/client/jms/schema/job.py diff --git a/ansys/hps/client/jms/schema/job_definition.py b/src/ansys/hps/client/jms/schema/job_definition.py similarity index 100% rename from ansys/hps/client/jms/schema/job_definition.py rename to src/ansys/hps/client/jms/schema/job_definition.py diff --git a/ansys/hps/client/jms/schema/license_context.py b/src/ansys/hps/client/jms/schema/license_context.py similarity index 100% rename from ansys/hps/client/jms/schema/license_context.py rename to src/ansys/hps/client/jms/schema/license_context.py diff --git a/ansys/hps/client/jms/schema/object_reference.py b/src/ansys/hps/client/jms/schema/object_reference.py similarity index 100% rename from ansys/hps/client/jms/schema/object_reference.py rename to src/ansys/hps/client/jms/schema/object_reference.py diff --git a/ansys/hps/client/jms/schema/operation.py b/src/ansys/hps/client/jms/schema/operation.py similarity index 100% rename from ansys/hps/client/jms/schema/operation.py rename to src/ansys/hps/client/jms/schema/operation.py diff --git a/ansys/hps/client/jms/schema/parameter_definition.py b/src/ansys/hps/client/jms/schema/parameter_definition.py similarity index 100% rename from ansys/hps/client/jms/schema/parameter_definition.py rename to src/ansys/hps/client/jms/schema/parameter_definition.py diff --git a/ansys/hps/client/jms/schema/parameter_mapping.py b/src/ansys/hps/client/jms/schema/parameter_mapping.py similarity index 100% rename from ansys/hps/client/jms/schema/parameter_mapping.py rename to src/ansys/hps/client/jms/schema/parameter_mapping.py diff --git a/ansys/hps/client/jms/schema/permission.py b/src/ansys/hps/client/jms/schema/permission.py similarity index 100% rename from ansys/hps/client/jms/schema/permission.py rename to src/ansys/hps/client/jms/schema/permission.py diff --git a/ansys/hps/client/jms/schema/project.py b/src/ansys/hps/client/jms/schema/project.py similarity index 100% rename from ansys/hps/client/jms/schema/project.py rename to src/ansys/hps/client/jms/schema/project.py diff --git a/ansys/hps/client/jms/schema/selection.py b/src/ansys/hps/client/jms/schema/selection.py similarity index 100% rename from ansys/hps/client/jms/schema/selection.py rename to src/ansys/hps/client/jms/schema/selection.py diff --git a/ansys/hps/client/jms/schema/task.py b/src/ansys/hps/client/jms/schema/task.py similarity index 100% rename from ansys/hps/client/jms/schema/task.py rename to src/ansys/hps/client/jms/schema/task.py diff --git a/ansys/hps/client/jms/schema/task_definition.py b/src/ansys/hps/client/jms/schema/task_definition.py similarity index 100% rename from ansys/hps/client/jms/schema/task_definition.py rename to src/ansys/hps/client/jms/schema/task_definition.py diff --git a/ansys/hps/client/jms/schema/task_definition_template.py b/src/ansys/hps/client/jms/schema/task_definition_template.py similarity index 100% rename from ansys/hps/client/jms/schema/task_definition_template.py rename to src/ansys/hps/client/jms/schema/task_definition_template.py diff --git a/ansys/hps/client/rms/__init__.py b/src/ansys/hps/client/rms/__init__.py similarity index 100% rename from ansys/hps/client/rms/__init__.py rename to src/ansys/hps/client/rms/__init__.py diff --git a/ansys/hps/client/rms/api/base.py b/src/ansys/hps/client/rms/api/base.py similarity index 100% rename from ansys/hps/client/rms/api/base.py rename to src/ansys/hps/client/rms/api/base.py diff --git a/ansys/hps/client/rms/api/rms_api.py b/src/ansys/hps/client/rms/api/rms_api.py similarity index 100% rename from ansys/hps/client/rms/api/rms_api.py rename to src/ansys/hps/client/rms/api/rms_api.py diff --git a/src/ansys/hps/client/rms/models.py b/src/ansys/hps/client/rms/models.py new file mode 100644 index 000000000..98dcd4244 --- /dev/null +++ b/src/ansys/hps/client/rms/models.py @@ -0,0 +1,696 @@ +# generated by datamodel-codegen: +# filename: rms_openapi.json +# timestamp: 2023-12-22T09:38:15+00:00 + +from __future__ import annotations + +from datetime import datetime +from enum import Enum +from typing import Any, Dict, List, Optional, Union + +from pydantic import BaseModel, Field +from typing_extensions import Literal + + +class ApplicationInfo(BaseModel): + name: str = Field(..., description="Application name", title="Name") + version: str = Field(..., description="Application version", title="Version") + install_path: str = Field( + ..., description="Installation path of application", title="Install Path" + ) + executable: str = Field( + ..., description="Executable path to run application", title="Executable" + ) + environment: Optional[Dict[str, Any]] = Field( + None, description="Environment setup for the process", title="Environment" + ) + capabilities: Optional[List[str]] = Field( + None, description="Capabilities of this application", title="Capabilities" + ) + customization_hook: Optional[Dict[str, Any]] = Field( + None, + description="Details of a custom hook used to modify the configuration \ + before runs are performed", + title="Customization Hook", + ) + + +class EvaluatorTaskDirectoryCleanup(Enum): + always = "always" + on_success = "on_success" + never = "never" + + +class ContextUpdate(BaseModel): + custom: Optional[Dict[str, Optional[Union[int, bool, str, float]]]] = Field( + {}, description="Custom runtime properties.", title="Custom" + ) + + +class CrsCountResponse(BaseModel): + num_compute_resource_sets: Optional[int] = Field(0, title="Num Compute Resource Sets") + + +class TaskDirectoryCleanupEnum(Enum): + always = "always" + on_success = "on_success" + never = "never" + + +class EvaluatorRegistration(BaseModel): + id: Optional[str] = Field(None, description="Unique identifier for this worker", title="Id") + name: Optional[str] = Field(None, description="User defined name for this worker", title="Name") + last_modified: Optional[datetime] = Field( + None, + description="Date and time when the registration was last modified", + title="Last Modified", + ) + host_id: Optional[str] = Field( + None, description="Static, hardware and configuration based UUID", title="Host Id" + ) + host_name: Optional[str] = Field( + None, description="Name of the host on which the worker is running", title="Host Name" + ) + username: Optional[str] = Field( + None, description="Username the evaluator authenticated with", title="Username" + ) + platform: Optional[str] = Field( + None, description="OS the evaluator is running on", title="Platform" + ) + build_info: Optional[Dict[str, Any]] = Field( + {}, description="Detailed build information", title="Build Info" + ) + compute_resource_set_id: Optional[str] = Field( + None, + description="Identifier of the compute resource set the evaluator belongs to", + title="Compute Resource Set Id", + ) + change_requested: Optional[datetime] = Field( + None, + description="Date and time of the configuration's last modification request", + title="Change Requested", + ) + + +class EvaluatorsCountResponse(BaseModel): + num_evaluators: Optional[int] = Field(0, title="Num Evaluators") + + +class EvaluatorsRequest(BaseModel): + evaluators: List[EvaluatorRegistration] = Field( + ..., description="Evaluator details", title="Evaluators" + ) + + +class EvaluatorsResponse(BaseModel): + evaluators: List[EvaluatorRegistration] = Field( + ..., description="Evaluator details", title="Evaluators" + ) + + +class HpcResources(BaseModel): + num_cores_per_node: Optional[int] = Field( + None, description="Number of cores per node.", title="Num Cores Per Node" + ) + num_gpus_per_node: Optional[int] = Field( + None, description="Number of GPUs per node.", title="Num Gpus Per Node" + ) + exclusive: Optional[bool] = Field( + None, description="To not share nodes with other running jobs.", title="Exclusive" + ) + queue: Optional[str] = Field(None, description="Scheduler's queue.", title="Queue") + + +class KubernetesKedaBackend(BaseModel): + plugin_name: Literal["kubernetes"] = Field(..., title="Plugin Name") + debug: Optional[bool] = Field( + False, description="Enable additional debugging of the backend", title="Debug" + ) + job_script_template_path: Optional[str] = Field( + None, + description="Path to the job script template to use in the backend", + title="Job Script Template Path", + ) + working_dir: Optional[str] = Field( + None, description="Working directory to use in the backend", title="Working Dir" + ) + env: Optional[Dict[str, Any]] = Field( + None, description="Static environment variables needed for job execution", title="Env" + ) + cpu_limit: Optional[str] = Field( + "1.0", description="CPU limit applied to each evaluator instance", title="Cpu Limit" + ) + memory_limit: Optional[str] = Field( + "250M", description="Memory limit applied to each evaluator instance", title="Memory Limit" + ) + namespace: Optional[str] = Field( + "default", + description="Kubernetes namespace to be used to scale evaluators", + title="Namespace", + ) + target_resource_kind: Optional[str] = Field( + "job", + description="kubernetes resource kind rep scaler should scale, should be one of job, \ + deployment, statefulset", + title="Target Resource Kind", + ) + + +class KubernetesResourceScaling(BaseModel): + plugin_name: Literal["kubernetes_resource_scaling"] = Field(..., title="Plugin Name") + target_resource_kind: Optional[str] = Field( + "job", + description="kubernetes resource kind rep scaler should scale, should be one of job, \ + deployment, statefulset", + title="Target Resource Kind", + ) + + +class LocalBackend(BaseModel): + plugin_name: Literal["local"] = Field(..., title="Plugin Name") + debug: Optional[bool] = Field( + False, description="Enable additional debugging of the backend", title="Debug" + ) + working_dir: Optional[str] = Field( + None, description="Working directory to use in the backend", title="Working Dir" + ) + env: Optional[Dict[str, Any]] = Field( + None, description="Static environment variables needed for job execution", title="Env" + ) + + +class Machine(BaseModel): + name: str = Field(..., description="Name of the machine", title="Name") + num_cores: int = Field(..., description="Number of cores available", title="Num Cores") + + +class MaxAvailableResourceScaling(BaseModel): + plugin_name: Literal["max_available_resource_scaling"] = Field(..., title="Plugin Name") + match_all_requirements: Optional[bool] = Field( + False, + description="Whether scaling should work with available resource properties specified \ + in compute resource set (default) or require a match of all requirements of \ + the task definition.", + title="Match All Requirements", + ) + + +class MockupBackend(BaseModel): + plugin_name: Literal["mockup"] = Field(..., title="Plugin Name") + debug: Optional[bool] = Field( + False, description="Enable additional debugging of the backend", title="Debug" + ) + + +class Node(BaseModel): + name: Optional[str] = Field(None, description="Node name", title="Name") + total_memory_mb: Optional[int] = Field(..., description="Total memory", title="Total Memory Mb") + total_cores: Optional[int] = Field(..., description="Number of cores", title="Total Cores") + additional_props: Optional[Dict[str, Any]] = Field({}, title="Additional Props") + + +class NodeGroup(BaseModel): + node_names: List[str] = Field(..., title="Node Names") + total_memory_mb: Optional[int] = Field(..., description="Total memory", title="Total Memory Mb") + total_cores: Optional[int] = Field(..., description="Number of cores", title="Total Cores") + + +class PlatformEnum(Enum): + windows = "windows" + linux = "linux" + darwin = "darwin" + + +class ProblemDetail(BaseModel): + type: Optional[str] = Field(None, title="Type") + title: Optional[str] = Field(None, title="Title") + status: int = Field(..., title="Status") + detail: str = Field(..., title="Detail") + instance: Optional[str] = Field(None, title="Instance") + + +class ProcessLauncherProcessRunner(BaseModel): + plugin_name: Literal["process_launcher_module"] = Field(..., title="Plugin Name") + default_user: Optional[str] = Field( + None, description="The user to use when none is specified", title="Default User" + ) + timeout: Optional[int] = Field( + 30, description="Timeout in seconds before the request is aborted.", title="Timeout" + ) + allowed_users: Optional[List[str]] = Field( + None, description="Users allowed to launch processes", title="Allowed Users" + ) + disallowed_users: Optional[List[str]] = Field( + ["root"], description="Users not allowed to launch processes", title="Disallowed Users" + ) + user_mapping: Optional[Dict[str, str]] = Field( + {}, description="Map of calling user to system user", title="User Mapping" + ) + minimum_uid: Optional[int] = Field( + 1000, description="Minimum UID of users allowed to launch processes", title="Minimum Uid" + ) + minimum_gid: Optional[int] = Field( + 1000, description="Minimum GID of users allowed to launch processes", title="Minimum Gid" + ) + + +class Queue(BaseModel): + name: Optional[str] = Field(None, description="Queue name", title="Name") + node_groups: Optional[List[NodeGroup]] = Field( + None, + description="List of node groups associated with the queue (If available)", + title="Node Groups", + ) + additional_props: Optional[Dict[str, Any]] = Field({}, title="Additional Props") + + +class Resources(BaseModel): + num_cores: Optional[int] = Field(None, description="Number of cores", title="Num Cores") + platform: Optional[PlatformEnum] = Field( + None, description="Basic platform information: 'windows' or 'linux'" + ) + memory: Optional[int] = Field(None, description="Amount of RAM in bytes", title="Memory") + disk_space: Optional[int] = Field( + None, description="Amount of disk space in bytes", title="Disk Space" + ) + custom: Optional[Dict[str, Optional[Union[bool, int, str, float]]]] = Field( + {}, description="Custom resource properties.", title="Custom" + ) + num_instances: Optional[int] = Field( + None, + description="Number of instances/jobs that can be created on the compute resource set", + title="Num Instances", + ) + + +class RestLauncherProcessRunner(BaseModel): + plugin_name: Literal["process_launcher_service"] = Field(..., title="Plugin Name") + launcher_url: Optional[str] = Field( + "http://localhost:4911", + description="The url to use when none is specified", + title="Launcher Url", + ) + verify_ssl: Optional[bool] = Field( + True, description="Check the SSL certificate for HTTPS launchers", title="Verify Ssl" + ) + timeout: Optional[int] = Field( + 30, description="Timeout in seconds before the request is aborted.", title="Timeout" + ) + shell: Optional[bool] = Field( + True, description="Enable the shell interpretation on subprocess run", title="Shell" + ) + + +class ScalerApplicationInfo(BaseModel): + name: str = Field(..., description="Application name", title="Name") + version: str = Field(..., description="Application version", title="Version") + install_path: str = Field( + ..., description="Installation path of application", title="Install Path" + ) + executable: str = Field( + ..., description="Executable path to run application", title="Executable" + ) + environment: Optional[Dict[str, Any]] = Field( + None, description="Environment setup for the process", title="Environment" + ) + capabilities: Optional[List[str]] = Field( + None, description="Capabilities of this application", title="Capabilities" + ) + customization_hook: Optional[Dict[str, Any]] = Field( + None, + description="Details of a custom hook used to modify the configuration \ + before runs are performed", + title="Customization Hook", + ) + resource_name: Optional[str] = Field( + None, + description="Kubernetes object (deployment/statefulset) name to be used as \ + target resource by keda", + title="Resource Name", + ) + scaling_max_eval_instances: Optional[int] = Field( + 1, + description="Maximum number of instances that can be created when scaling up", + title="Scaling Max Eval Instances", + ) + scaling_min_eval_instances: Optional[int] = Field( + 0, + description="Minimum number of instances than can de terminated when scaling down", + title="Scaling Min Eval Instances", + ) + scaling_threshold: Optional[int] = Field( + 1, + description="Threshold value to determine when kubernetes deployments should be \ + scaled up/down", + title="Scaling Threshold", + ) + cool_down_period: Optional[int] = Field( + 60, + description="The period to wait after the last trigger reported active before \ + scaling the resource back to 0", + title="Cool Down Period", + ) + + +class ScalerRegistration(BaseModel): + id: Optional[str] = Field(None, description="Unique identifier for this worker", title="Id") + name: Optional[str] = Field(None, description="User defined name for this worker", title="Name") + last_modified: Optional[datetime] = Field( + None, + description="Date and time when the registration was last modified", + title="Last Modified", + ) + host_id: Optional[str] = Field( + None, description="Static, hardware and configuration based UUID", title="Host Id" + ) + host_name: Optional[str] = Field( + None, description="Name of the host on which the worker is running", title="Host Name" + ) + username: Optional[str] = Field( + None, description="Username the evaluator authenticated with", title="Username" + ) + platform: Optional[str] = Field( + None, description="OS the evaluator is running on", title="Platform" + ) + build_info: Optional[Dict[str, Any]] = Field( + {}, description="Detailed build information", title="Build Info" + ) + config_modified: Optional[datetime] = Field( + None, + description="Date and time of the configuration's last modification", + title="Config Modified", + ) + + +class ScalersCountResponse(BaseModel): + num_scalers: Optional[int] = Field(0, title="Num Scalers") + + +class ScalersRequest(BaseModel): + scalers: List[ScalerRegistration] = Field(..., description="Scaler details", title="Scalers") + + +class ScalersResponse(BaseModel): + scalers: List[ScalerRegistration] = Field(..., description="Scaler details", title="Scalers") + + +class ServiceUserProcessRunner(BaseModel): + plugin_name: Literal["service_user_module"] = Field(..., title="Plugin Name") + + +class Status(BaseModel): + time: str = Field(..., title="Time") + build: Dict[str, Any] = Field(..., title="Build") + + +class ClusterInfo(BaseModel): + id: Optional[str] = Field(None, description="Unique identifier for database", title="Id") + crs_id: Optional[str] = Field(None, description="Compute resource set ID", title="Crs Id") + name: Optional[str] = Field(None, description="Cluster name", title="Name") + queues: Optional[List[Queue]] = Field([], title="Queues") + nodes: Optional[List[Node]] = Field([], title="Nodes") + additional_props: Optional[Dict[str, Dict[str, Any]]] = Field({}, title="Additional Props") + + +class Context(BaseModel): + custom: Optional[Dict[str, Optional[Union[int, bool, str, float]]]] = Field( + {}, description="Custom runtime properties.", title="Custom" + ) + machines_list: Optional[List[Machine]] = Field( + None, + description="List of machines for distributed parallel processing.", + title="Machines List", + ) + + +class EvaluatorResources(BaseModel): + num_cores: Optional[int] = Field(None, description="Number of cores", title="Num Cores") + platform: Optional[PlatformEnum] = Field( + None, description="Basic platform information: 'windows' or 'linux'" + ) + memory: Optional[int] = Field(None, description="Amount of RAM in bytes", title="Memory") + disk_space: Optional[int] = Field( + None, description="Amount of disk space in bytes", title="Disk Space" + ) + custom: Optional[Dict[str, Optional[Union[bool, int, str, float]]]] = Field( + {}, description="Custom resource properties.", title="Custom" + ) + hpc_resources: Optional[HpcResources] = None + + +class OrchestrationInterfacesBackend(BaseModel): + plugin_name: Literal["orchestration_interfaces"] = Field(..., title="Plugin Name") + debug: Optional[bool] = Field( + False, description="Enable additional debugging of the backend", title="Debug" + ) + scheduler_type: Optional[str] = Field( + "slurm", + description="Job scheduler type to use in the backend (slurm, pbs, uge...)", + title="Scheduler Type", + ) + scheduler_queue_default: Optional[str] = Field( + None, + description="Job scheduler queue to be used for submission", + title="Scheduler Queue Default", + ) + scheduler_command_override: Optional[str] = Field( + None, + description="The path to the Json file with custom scheduler command definitions", + title="Scheduler Command Override", + ) + scheduler_script_override: Optional[str] = Field( + None, + description="The path to the shell script to template for the scheduler", + title="Scheduler Script Override", + ) + exclusive_default: Optional[bool] = Field( + False, + description="Request the scheduler to hold the node(s) exclusively for one request", + title="Exclusive Default", + ) + distributed_default: Optional[bool] = Field( + True, + description="Allow the scheduler to provide multiple machines to fulfill the request", + title="Distributed Default", + ) + num_cores_default: Optional[int] = Field( + 1, + description="The number of cores to request from the scheduler for a task", + title="Num Cores Default", + ) + working_dir: Optional[str] = Field( + None, description="Working directory to use in the backend", title="Working Dir" + ) + env: Optional[Dict[str, Any]] = Field( + None, description="Static environment variables needed for job execution", title="Env" + ) + process_runner: Optional[ + Union[ServiceUserProcessRunner, ProcessLauncherProcessRunner, RestLauncherProcessRunner] + ] = Field( + {"plugin_name": "service_user_module"}, + description="Process runner used to execute commands", + discriminator="plugin_name", + title="Process Runner", + ) + create_workdir: Optional[bool] = Field( + True, + description="Create base and/or user specific working directories at runtime", + title="Create Workdir", + ) + use_templates: Optional[bool] = Field( + True, + description="Use the templated versions of the scripts and write them to the workdir", + title="Use Templates", + ) + + +class ComputeResourceSet(BaseModel): + name: Optional[str] = Field( + "default", description="Name of the compute resource set", title="Name" + ) + id: Optional[str] = Field(None, description="Unique identifier for this set", title="Id") + scaler_id: Optional[str] = Field( + None, description="temporary. removed after transitioning to client_id", title="Scaler Id" + ) + last_modified: Optional[datetime] = Field( + None, description="Last modified time", title="Last Modified" + ) + backend: Optional[ + Union[KubernetesKedaBackend, OrchestrationInterfacesBackend, LocalBackend, MockupBackend] + ] = Field( + {"debug": False, "plugin_name": "local"}, + description="Backend to use in this compute resource set", + discriminator="plugin_name", + title="Backend", + ) + scaling_strategy: Optional[ + Union[MaxAvailableResourceScaling, KubernetesResourceScaling] + ] = Field( + {"match_all_requirements": False, "plugin_name": "max_available_resource_scaling"}, + description="Scaling strategy to use in this compute resource set", + discriminator="plugin_name", + title="Scaling Strategy", + ) + available_resources: Optional[Resources] = Field( + {"custom": {}}, description="Available resources in the compute resource set" + ) + available_applications: Optional[List[ScalerApplicationInfo]] = Field( + [], description="List of available applications", title="Available Applications" + ) + evaluator_requirements_matching: Optional[bool] = Field( + False, + description="Whether the evaluators should do matching of resource and \ + software requirements or not", + title="Evaluator Requirements Matching", + ) + evaluator_task_directory_cleanup: Optional[EvaluatorTaskDirectoryCleanup] = Field( + "always", + description="Cleanup policy for task directories passed to evaluators", + title="Evaluator Task Directory Cleanup", + ) + evaluator_auto_shutdown_time: Optional[int] = Field( + 20, + description="Time after which to shutdown the evaluator if not running any jobs.", + title="Evaluator Auto Shutdown Time", + ) + evaluator_loop_interval: Optional[int] = Field( + 5, + description="The main evaluator loop is repeated every loop_interval seconds", + title="Evaluator Loop Interval", + ) + + +class ComputeResourceSetsRequest(BaseModel): + compute_resource_sets: List[ComputeResourceSet] = Field( + ..., description="Compute resource set details", title="Compute Resource Sets" + ) + + +class ComputeResourceSetsResponse(BaseModel): + compute_resource_sets: List[ComputeResourceSet] = Field( + ..., description="Compute resource set details", title="Compute Resource Sets" + ) + + +class EvaluatorConfiguration(BaseModel): + id: Optional[str] = Field(None, description="Unique DB identifier (readonly)", title="Id") + evaluator_id: Optional[str] = Field( + None, description="Identifier of the parent evaluator (readonly)", title="Evaluator Id" + ) + last_modified: Optional[datetime] = Field( + None, description="Last modified time", title="Last Modified" + ) + working_directory: Optional[str] = Field(None, title="Working Directory") + local_file_cache_max_size: Optional[int] = Field( + None, + description="Maximum allowed cache size in bytes or None", + title="Local File Cache Max Size", + ) + max_num_parallel_tasks: Optional[int] = Field(None, title="Max Num Parallel Tasks") + task_directory_cleanup: Optional[TaskDirectoryCleanupEnum] = Field( + None, title="Task Directory Cleanup" + ) + resources: Optional[EvaluatorResources] = {"custom": {}} + task_manager_type: Optional[str] = Field(None, title="Task Manager Type") + loop_interval: Optional[float] = Field( + 5.0, + description="The main evaluator loop is repeated every loop_interval seconds", + title="Loop Interval", + ) + local_file_cache: Optional[bool] = Field( + True, + description="Whether to configure a local file cache in file tool or not", + title="Local File Cache", + ) + applications: Optional[List[ApplicationInfo]] = Field( + [], description="List of available applications", title="Applications" + ) + project_server_select: Optional[bool] = Field( + True, + description="Get project assignments from the server instead of using \ + the locally set values", + title="Project Server Select", + ) + project_list: Optional[List[str]] = Field( + [], + description="IDs of projects the evaluator should work on, in order", + title="Project List", + ) + project_assignment_mode: Optional[str] = Field( + "all_active", + description="Specifies how the evaluator selects projects to work on. \ + One of: disabled, all_active, list", + title="Project Assignment Mode", + ) + context: Optional[Context] = Field( + {"custom": {}}, description="Runtime properties to be passed to executed tasks" + ) + + +class EvaluatorConfigurationUpdate(BaseModel): + id: Optional[str] = Field(None, description="Unique DB identifier (readonly)", title="Id") + evaluator_id: Optional[str] = Field( + None, description="Identifier of the parent evaluator (readonly)", title="Evaluator Id" + ) + last_modified: Optional[datetime] = Field( + None, description="Last modified time", title="Last Modified" + ) + working_directory: Optional[str] = Field(None, title="Working Directory") + local_file_cache_max_size: Optional[int] = Field( + None, + description="Maximum allowed cache size in bytes or None", + title="Local File Cache Max Size", + ) + max_num_parallel_tasks: Optional[int] = Field(None, title="Max Num Parallel Tasks") + task_directory_cleanup: Optional[TaskDirectoryCleanupEnum] = Field( + None, title="Task Directory Cleanup" + ) + resources: Optional[EvaluatorResources] = {"custom": {}} + name: Optional[str] = Field( + None, description="Update the name of Evaluator (updating the registration)", title="Name" + ) + loop_interval: Optional[float] = Field( + None, + description="The main evaluator loop is repeated every loop_interval seconds", + title="Loop Interval", + ) + local_file_cache: Optional[bool] = Field( + None, + description="Whether to configure a local file cache in file tool or not", + title="Local File Cache", + ) + applications: Optional[List[ApplicationInfo]] = Field( + [], description="List of available applications", title="Applications" + ) + project_list: Optional[List[str]] = Field( + None, + description="IDs of projects the evaluator should work on, in order", + title="Project List", + ) + project_assignment_mode: Optional[str] = Field( + None, + description="Specifies how the evaluator selects projects to work on. \ + One of: disabled, all_active, list", + title="Project Assignment Mode", + ) + context: Optional[ContextUpdate] = Field( + {"custom": {}}, description="Runtime properties to be passed to executed tasks" + ) + + +class EvaluatorConfigurationUpdatesRequest(BaseModel): + configuration_updates: List[EvaluatorConfigurationUpdate] = Field( + ..., description="Configuration update details", title="Configuration Updates" + ) + + +class EvaluatorConfigurationUpdatesResponse(BaseModel): + configuration_updates: List[EvaluatorConfigurationUpdate] = Field( + ..., description="Configuration update details", title="Configuration Updates" + ) + + +class EvaluatorConfigurationsResponse(BaseModel): + configurations: List[EvaluatorConfiguration] = Field( + ..., description="Evaluator configurations", title="Configurations" + ) diff --git a/ansys/hps/client/warnings.py b/src/ansys/hps/client/warnings.py similarity index 100% rename from ansys/hps/client/warnings.py rename to src/ansys/hps/client/warnings.py diff --git a/tox.ini b/tox.ini index c622138e1..d2419df2b 100644 --- a/tox.ini +++ b/tox.ini @@ -19,8 +19,6 @@ setenv = noeval: PYTEST_MARKERS = -m "not requires_evaluator" witheval: PYTEST_MARKERS = -m "requires_evaluator" coverage: PYTEST_EXTRA_ARGS = --cov=ansys.rep --cov-report=term --cov-report=xml --cov-report=html -deps = - -r{toxinidir}/requirements/requirements_tests.txt commands = pytest {env:PYTEST_MARKERS:} {env:PYTEST_EXTRA_ARGS:} --junitxml test_results-{envname}.xml {posargs:-vv} @@ -35,8 +33,8 @@ commands = [testenv:doc] description = Check if documentation generates properly -deps = - -r{toxinidir}/requirements/requirements_doc.txt +passenv = * +extras = doc commands = python prepare_documentation.py python -m sphinx -b html doc/source build/sphinx/html From b670a28d12f2dcc367b6f7440852c0e9e82648e7 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 16 Jan 2024 16:04:24 -0500 Subject: [PATCH 07/61] remove requirements/ references in build.py --- build.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/build.py b/build.py index 66f4027f2..7f5ffa9ec 100644 --- a/build.py +++ b/build.py @@ -82,12 +82,8 @@ def _do_venv(context): subprocess.run(f"{context.python_binary} -m pip install --upgrade pip", shell=True, check=True) # Install requirements - build_reqs = os.path.join(os.path.dirname(__file__), "requirements", "requirements_build.txt") - subprocess.run( - f"{context.python_binary} -m pip install -r {build_reqs}", shell=True, check=True - ) - test_reqs = os.path.join(os.path.dirname(__file__), "requirements", "requirements_tests.txt") - subprocess.run(f"{context.python_binary} -m pip install -r {test_reqs}", shell=True, check=True) + subprocess.run(f"{context.python_binary} -m pip install -e .[build]", shell=True, check=True) + subprocess.run(f"{context.python_binary} -m pip install -e .[tests]", shell=True, check=True) # Install client subprocess.run(f"{context.python_binary} -m pip install -e .", shell=True, check=True) @@ -103,8 +99,7 @@ def _do_documentation(context): docs_directory = os.path.join(os.path.dirname(__file__), "doc", "source") target_directory = os.path.join(os.path.dirname(__file__), "build", "sphinx", "html") - doc_reqs = os.path.join(os.path.dirname(__file__), "requirements", "requirements_doc.txt") - subprocess.run(f"{context.python_binary} -m pip install -r {doc_reqs}", shell=True, check=True) + subprocess.run(f"{context.python_binary} -m pip install -e .[doc]", shell=True, check=True) subprocess.run(f"{context.python_binary} archive_examples.py", shell=True, check=True) subprocess.run( f"{context.python_binary} -m sphinx -b html {docs_directory} {target_directory}", From 133f415a077d4fd06910c9f8013f7f4aadac4267 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 16 Jan 2024 17:06:48 -0500 Subject: [PATCH 08/61] add wheelhouse build to workflow and comment out wheelhouse line in build.py --- .github/workflows/ci_cd.yml | 132 ++++++++++++++++++++---------------- build.py | 2 +- 2 files changed, 75 insertions(+), 59 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 877bb5516..abcd67280 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -11,7 +11,8 @@ on: env: MAIN_PYTHON_VERSION: '3.9' DOC_PYTHON_VERSION: '3.9' - DOCUMENTATION_CNAME: 'rep.docs.pyansys.com' + DOCUMENTATION_CNAME: 'hps.docs.pyansys.com' + PACKAGE_NAME: 'ansys-hps-client' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -144,71 +145,86 @@ jobs: cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} - build: - name: Build and publish library + smoke-tests: + name: Build and Smoke tests + 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 + with: + library-name: ${{ env.PACKAGE_NAME }} + operating-system: ${{ matrix.os }} + python-version: ${{ matrix.python-version }} + + package: + name: Package library + needs: [quick-tests, docs] runs-on: ubuntu-latest - outputs: - version: ${{ steps.build.outputs.version }} steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 + - name: Build library source and wheel artifacts + uses: ansys/actions/build-library@v5 with: + library-name: ${{ env.PACKAGE_NAME }} python-version: ${{ env.MAIN_PYTHON_VERSION }} - - name: Install dependencies and build the library - id: build - run: | - python -m pip install --upgrade pip setuptools - python -m pip install -e .[build] - python -m build venv wheel - python -m twine check dist/* - version=$(ls dist | grep ansys_pyhps | grep -E -o "[0-9]+.[0-9]+.[a-z0-9]+") - echo "version=$version" >> $GITHUB_OUTPUT - #- name: Upload to private PyPi - # if: github.ref == 'refs/heads/main' - # run: | - # python -m twine upload --verbose --skip-existing dist/*.whl - # env: - # TWINE_USERNAME: __token__ - # TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} - # TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: ansys-pyhps-package - path: | - dist/*.whl - retention-days: 5 release: - name: "Release" - if: startsWith(github.ref, 'refs/heads/main') || github.ref_type == 'tag' - needs: [build, docs] + name: Release project + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + needs: [package] runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v3 - with: - name: ansys-pyhps-package - path: /tmp/artifacts - - - name: List artifacts - run: ls -ltR /tmp/artifacts - - - name: Release for tag - if: github.ref_type == 'tag' - uses: softprops/action-gh-release@v1 + - name: Release to the public PyPI repository + uses: ansys/actions/release-pypi-public@v5 with: - generate_release_notes: true - files: | - /tmp/artifacts/*.whl + library-name: ${{ env.PACKAGE_NAME }} + twine-username: "__token__" + twine-token: ${{ secrets.PYPI_TOKEN }} - - name: Release to latest-dev - uses: "marvinpinto/action-automatic-releases@latest" - if: startsWith(github.ref, 'refs/heads/main') + - name: Release to GitHub + uses: ansys/actions/release-github@v5 with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - automatic_release_tag: "v${{needs.build.outputs.version}}" - prerelease: true - title: "v${{needs.build.outputs.version}}" - files: | - /tmp/artifacts/*.whl + library-name: ${{ env.PACKAGE_NAME }} + + # release: + # name: "Release" + # if: startsWith(github.ref, 'refs/heads/main') || github.ref_type == 'tag' + # needs: [smoke-tests, docs] + # runs-on: ubuntu-latest + # steps: + # - uses: actions/download-artifact@v3 + # with: + # name: ansys-pyhps-package + # path: /tmp/artifacts + + # - name: List artifacts + # run: ls -ltR /tmp/artifacts + + # - name: Release for tag + # if: github.ref_type == 'tag' + # uses: softprops/action-gh-release@v1 + # with: + # generate_release_notes: true + # files: | + # /tmp/artifacts/*.whl + + # - name: Release to latest-dev + # uses: "marvinpinto/action-automatic-releases@latest" + # if: startsWith(github.ref, 'refs/heads/main') + # with: + # repo_token: ${{ secrets.GITHUB_TOKEN }} + # automatic_release_tag: "v${{needs.build.outputs.version}}" + # prerelease: true + # title: "v${{needs.build.outputs.version}}" + # files: | + # /tmp/artifacts/*.whl diff --git a/build.py b/build.py index 7f5ffa9ec..4b172ecd8 100644 --- a/build.py +++ b/build.py @@ -118,7 +118,7 @@ def _run_tests(context): steps = [ ("venv", _do_venv), - ("wheel", _do_wheel), + # ("wheel", _do_wheel), ("documentation", _do_documentation), ("tests", _run_tests), ] From fed5cdf40d64f4b8663e0dcc728f5ae94bcbd10b Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 16 Jan 2024 17:09:47 -0500 Subject: [PATCH 09/61] change package name to ansys-pyhps --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index abcd67280..26fa6eb3c 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -12,7 +12,7 @@ env: MAIN_PYTHON_VERSION: '3.9' DOC_PYTHON_VERSION: '3.9' DOCUMENTATION_CNAME: 'hps.docs.pyansys.com' - PACKAGE_NAME: 'ansys-hps-client' + PACKAGE_NAME: 'ansys-pyhps' concurrency: group: ${{ github.workflow }}-${{ github.ref }} From c09906c82fa96274b70456821f289d4f179b4706 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 16 Jan 2024 17:22:30 -0500 Subject: [PATCH 10/61] add allowlist_externals to tox.ini file --- tox.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tox.ini b/tox.ini index 88292ac72..b688491ef 100644 --- a/tox.ini +++ b/tox.ini @@ -19,6 +19,7 @@ setenv = noeval: PYTEST_MARKERS = -m "not requires_evaluator" witheval: PYTEST_MARKERS = -m "requires_evaluator" coverage: PYTEST_EXTRA_ARGS = --cov=ansys.rep --cov-report=term --cov-report=xml --cov-report=html +allowlist_externals=* commands = pytest {env:PYTEST_MARKERS:} {env:PYTEST_EXTRA_ARGS:} --junitxml test_results-{envname}.xml {posargs:-vv} @@ -27,6 +28,7 @@ description = Checks project code style skip_install = true deps = pre-commit +allowlist_externals=* commands = pre-commit install pre-commit run --all-files --show-diff-on-failure @@ -35,6 +37,7 @@ commands = description = Check if documentation generates properly passenv = * extras = doc +allowlist_externals=* commands = python archive_examples.py python -m sphinx -b html doc/source build/sphinx/html From c3bcf70f3634b7d40959ec2cf7b1ae2f11a5e75a Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Wed, 17 Jan 2024 09:06:46 -0500 Subject: [PATCH 11/61] replace requirements txt files --- tox.ini | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tox.ini b/tox.ini index b688491ef..5693884b4 100644 --- a/tox.ini +++ b/tox.ini @@ -19,7 +19,8 @@ setenv = noeval: PYTEST_MARKERS = -m "not requires_evaluator" witheval: PYTEST_MARKERS = -m "requires_evaluator" coverage: PYTEST_EXTRA_ARGS = --cov=ansys.rep --cov-report=term --cov-report=xml --cov-report=html -allowlist_externals=* +deps = + -e .[tests] commands = pytest {env:PYTEST_MARKERS:} {env:PYTEST_EXTRA_ARGS:} --junitxml test_results-{envname}.xml {posargs:-vv} @@ -28,16 +29,14 @@ description = Checks project code style skip_install = true deps = pre-commit -allowlist_externals=* commands = pre-commit install pre-commit run --all-files --show-diff-on-failure [testenv:doc] description = Check if documentation generates properly -passenv = * -extras = doc -allowlist_externals=* +deps = + -e .[doc] commands = python archive_examples.py - python -m sphinx -b html doc/source build/sphinx/html + python -m sphinx -b html doc/source build/sphinx/html \ No newline at end of file From 235c15d6c512d66bd3b70ba89d2b3cf46a7615fe Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Wed, 17 Jan 2024 09:14:06 -0500 Subject: [PATCH 12/61] revert value to None --- src/ansys/hps/client/jms/resource/file.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ansys/hps/client/jms/resource/file.py b/src/ansys/hps/client/jms/resource/file.py index f062aac9f..5ef4884c7 100644 --- a/src/ansys/hps/client/jms/resource/file.py +++ b/src/ansys/hps/client/jms/resource/file.py @@ -1,6 +1,3 @@ -import io -from typing import Union - from marshmallow.utils import missing from ansys.hps.client.common import Object @@ -60,7 +57,7 @@ class Meta: def __init__( self, - src=Union[str, io.IOBase], + src=None, id=missing, name=missing, type=missing, From 42e5795c31de84e2df50269b91790629be43224c Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Wed, 17 Jan 2024 11:30:54 -0500 Subject: [PATCH 13/61] update workflow to use actions --- .github/workflows/ci_cd.yml | 74 +++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 26fa6eb3c..329c09e2d 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -172,20 +172,55 @@ jobs: needs: [quick-tests, docs] runs-on: ubuntu-latest steps: + - name: Install dependencies + run: | + python -m pip install -e .[build] + - name: Build library source and wheel artifacts uses: ansys/actions/build-library@v5 with: library-name: ${{ env.PACKAGE_NAME }} python-version: ${{ env.MAIN_PYTHON_VERSION }} + - name: Get version + id: build + run: | + version=$(ls dist | grep ansys_pyhps | grep -E -o "[0-9]+.[0-9]+.[a-z0-9]+") + echo "version=$version" >> $GITHUB_OUTPUT + + pre-release: + name: Pre-release project + if: startsWith(github.ref, 'refs/heads/main') + needs: [package] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v3 + with: + name: ansys-pyhps-package + path: /tmp/artifacts + + - name: List artifacts + run: ls -ltR /tmp/artifacts + + - name: Release to latest-dev + uses: "marvinpinto/action-automatic-releases@latest" + if: startsWith(github.ref, 'refs/heads/main') + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: "v${{needs.build.outputs.version}}" + prerelease: true + title: "v${{needs.build.outputs.version}}" + files: | + /tmp/artifacts/*.whl + release: name: Release project if: github.event_name == 'push' && contains(github.ref, 'refs/tags') needs: [package] runs-on: ubuntu-latest steps: - - name: Release to the public PyPI repository - uses: ansys/actions/release-pypi-public@v5 + - name: Release to the private PyPI repository + uses: ansys/actions/release-pypi-private@v5 with: library-name: ${{ env.PACKAGE_NAME }} twine-username: "__token__" @@ -194,37 +229,4 @@ jobs: - name: Release to GitHub uses: ansys/actions/release-github@v5 with: - library-name: ${{ env.PACKAGE_NAME }} - - # release: - # name: "Release" - # if: startsWith(github.ref, 'refs/heads/main') || github.ref_type == 'tag' - # needs: [smoke-tests, docs] - # runs-on: ubuntu-latest - # steps: - # - uses: actions/download-artifact@v3 - # with: - # name: ansys-pyhps-package - # path: /tmp/artifacts - - # - name: List artifacts - # run: ls -ltR /tmp/artifacts - - # - name: Release for tag - # if: github.ref_type == 'tag' - # uses: softprops/action-gh-release@v1 - # with: - # generate_release_notes: true - # files: | - # /tmp/artifacts/*.whl - - # - name: Release to latest-dev - # uses: "marvinpinto/action-automatic-releases@latest" - # if: startsWith(github.ref, 'refs/heads/main') - # with: - # repo_token: ${{ secrets.GITHUB_TOKEN }} - # automatic_release_tag: "v${{needs.build.outputs.version}}" - # prerelease: true - # title: "v${{needs.build.outputs.version}}" - # files: | - # /tmp/artifacts/*.whl + library-name: ${{ env.PACKAGE_NAME }} \ No newline at end of file From d5341ed1d3988f0721097b46234c8bbe00a1a109 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Wed, 17 Jan 2024 11:43:10 -0500 Subject: [PATCH 14/61] cd into pyhps dir for package lib --- .github/workflows/ci_cd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 329c09e2d..3309a2a9c 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -174,6 +174,7 @@ jobs: steps: - name: Install dependencies run: | + cd pyhps python -m pip install -e .[build] - name: Build library source and wheel artifacts From a106a9b2d3553495caba32794143a5ed8fd9be0e Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Wed, 17 Jan 2024 13:21:55 -0500 Subject: [PATCH 15/61] change build.py to save_build.py --- .github/workflows/ci_cd.yml | 5 ----- build.py => save_build.py | 0 2 files changed, 5 deletions(-) rename build.py => save_build.py (100%) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 3309a2a9c..a2c25e47a 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -172,11 +172,6 @@ jobs: needs: [quick-tests, docs] runs-on: ubuntu-latest steps: - - name: Install dependencies - run: | - cd pyhps - python -m pip install -e .[build] - - name: Build library source and wheel artifacts uses: ansys/actions/build-library@v5 with: diff --git a/build.py b/save_build.py similarity index 100% rename from build.py rename to save_build.py From ef7ad5802bb31ba5dd83659f9b7a853fff640975 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Wed, 17 Jan 2024 13:58:46 -0500 Subject: [PATCH 16/61] use pyproject.toml's version, delete build.py, and update workflow to use pyproject.toml version --- .github/workflows/ci_cd.yml | 50 ++++++- doc/source/conf.py | 11 +- save_build.py | 197 ---------------------------- src/ansys/hps/client/__version__.py | 13 +- 4 files changed, 56 insertions(+), 215 deletions(-) delete mode 100644 save_build.py diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index a2c25e47a..7129392fe 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -178,11 +178,47 @@ jobs: library-name: ${{ env.PACKAGE_NAME }} python-version: ${{ env.MAIN_PYTHON_VERSION }} - - name: Get version - id: build + library-version: + name: Get library version + runs-on: ubuntu-latest + steps: + - name: "Install the library" + shell: bash + run: | + python -m pip install -e . + + - name: "Verify if importlib-metadata needs to be installed" + shell: bash run: | - version=$(ls dist | grep ansys_pyhps | grep -E -o "[0-9]+.[0-9]+.[a-z0-9]+") - echo "version=$version" >> $GITHUB_OUTPUT + python_version="${{ env.MAIN_PYTHON_VERSION }}" + minor_python_version=$(echo "$python_version" | awk -F "." '{print $2}') + major_python_version=$(echo "$python_version" | awk -F "." '{print $1}') + if (( $(( $major_python_version == 3 )) )) && (( $(( $minor_python_version < 8 )) )); then + echo "needs_importlib_metadata=true" >> $GITHUB_ENV + elif (( $(( $major_python_version < 3 )) )); then + echo "needs_importlib_metadata=true" >> $GITHUB_ENV + else + echo "needs_importlib_metadata=false" >> $GITHUB_ENV + fi + + - name: "Verify library is properly installed and get its version number" + shell: bash + run: | + library_name=${{ env.PACKAGE_NAME }} + + if [ ${{ env.needs_importlib_metadata }} == 'true' ]; then + version=$(python -c "import importlib_metadata; print(importlib_metadata.version('$library_name'))") + else + version=$(python -c "import importlib.metadata as importlib_metadata; print(importlib_metadata.version('$library_name'))") + fi + + if [ -z "$version" ]; then + echo "Problem getting the library version" + exit 1; + else + echo "The library version is: $version"; + fi; + echo "library_version=$version" >> $GITHUB_ENV pre-release: name: Pre-release project @@ -203,11 +239,11 @@ jobs: if: startsWith(github.ref, 'refs/heads/main') with: repo_token: ${{ secrets.GITHUB_TOKEN }} - automatic_release_tag: "v${{needs.build.outputs.version}}" + automatic_release_tag: "v${{ env.library_version }}" prerelease: true - title: "v${{needs.build.outputs.version}}" + title: "v${{ env.library_version }}" files: | - /tmp/artifacts/*.whl + /tmp/artifacts/*.whl release: name: Release project diff --git a/doc/source/conf.py b/doc/source/conf.py index 4f273fd4f..1fcdf3e0f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -6,7 +6,7 @@ from ansys_sphinx_theme import get_version_match from ansys_sphinx_theme import pyansys_logo_black as logo -from ansys.hps.client import __ansys_apps_version__, __company__, __version__, __version_no_dots__ +from ansys.hps.client import __ansys_apps_version__, __version__ sys.path.append(os.path.abspath(os.path.dirname(__file__))) @@ -15,9 +15,8 @@ # General information about the project. project = "Ansys pyhps" copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved" -author = __company__ - -cname = os.getenv("DOCUMENTATION_CNAME", "rep.docs.pyansys.com") +author = "ANSYS Inc." +cname = os.getenv("DOCUMENTATION_CNAME", "hps.docs.pyansys.com") """The canonical name of the webpage hosting the documentation.""" # The short X.Y version @@ -120,7 +119,7 @@ # only for sphinx_rtd_theme html_theme_options = { - "github_url": "https://github.com/pyansys/pyhps", + "github_url": "https://github.com/ansys-internal/pyhps", "show_prev_next": False, "show_breadcrumbs": True, "additional_breadcrumbs": [ @@ -249,7 +248,7 @@ global_substitutions = { "client_version": __version__, - "version_no_dots": __version_no_dots__, + "version_no_dots": __version__.replace(".", ""), "external_version": __ansys_apps_version__, "ansys_version": __ansys_apps_version__, } diff --git a/save_build.py b/save_build.py deleted file mode 100644 index 8725b8709..000000000 --- a/save_build.py +++ /dev/null @@ -1,197 +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. - -import argparse -import logging -import os -import subprocess -import sys - -log = logging.getLogger(__name__) - -file_formatter = logging.Formatter("[%(asctime)s/%(levelname)5.5s] %(message)s") -stream_formatter = logging.Formatter( - "[%(asctime)s/%(levelname)5.5s] %(message)s", datefmt="%H:%M:%S" -) -file_handler = logging.FileHandler("bootstrap.log") -file_handler.setFormatter(file_formatter) -file_handler.setLevel(logging.DEBUG) - -stream_handler = logging.StreamHandler() -stream_handler.setFormatter(stream_formatter) -stream_handler.setLevel(logging.DEBUG) - -log.addHandler(file_handler) -log.addHandler(stream_handler) -log.setLevel(logging.DEBUG) - - -class Context(object): - pip_index_url = "https://pypi.python.org/simple" - pip_trusted_host = "pypi.python.org" - - def __init__(self, args): - self.args = args - self.venv_name = args.venv_name - self.using_docker = os.environ.get("DEFAULT_DOCKCROSS_IMAGE", None) is not None - - if sys.platform == "win32": - system_python_binary = f'"{sys.executable}"' - python_binary = os.path.join(self.args.venv_name, "Scripts", "python.exe") - else: - if self.using_docker: - # When running inside of our dockcross container python3 is actually Ansys python - log.info("Running inside dockcross container") - system_python_binary = "python3" - else: - system_python_binary = sys.executable - python_binary = os.path.join(self.args.venv_name, "bin", "python") - - self.system_python_binary = system_python_binary - self.python_binary = os.path.abspath(python_binary) - log.debug(f"Python at: {self.system_python_binary}") - log.debug(f"Virtual Env Python at: {self.python_binary}") - - -def _do_venv(context): - log.info("### Preparing venv %s" % context.venv_name) - - subprocess.run( - f"{context.system_python_binary} -m venv {context.venv_name}", shell=True, check=True - ) - - pip_conf_path = ( - os.path.join(context.venv_name, "pip.ini") - if sys.platform == "win32" - else os.path.join(context.venv_name, "pip.conf") - ) - - pip_conf = "[global]" - pip_conf += "\ntimeout = 60" - pip_conf += "\nindex-url = " + context.pip_index_url - pip_conf += "\ntrusted-host = " + context.pip_trusted_host - - log.debug("Writing %s" % pip_conf_path) - with open(pip_conf_path, "w") as f: - f.write(pip_conf) - - log.info("### Installing base modules") - - pip_options = [] - if context.args.verbose: - pip_options.append(" -v") - - log.info("### Updating pip") - subprocess.run(f"{context.python_binary} -m pip install --upgrade pip", shell=True, check=True) - - # Install requirements - subprocess.run(f"{context.python_binary} -m pip install -e .[build]", shell=True, check=True) - subprocess.run(f"{context.python_binary} -m pip install -e .[tests]", shell=True, check=True) - - # Install client - subprocess.run(f"{context.python_binary} -m pip install -e .", shell=True, check=True) - - -def _do_wheel(context): - log.info("### Build python client wheel") - subprocess.run(f"{context.python_binary} setup.py sdist bdist_wheel", shell=True, check=True) - - -def _do_documentation(context): - log.info("### Preparing python client documentation") - - docs_directory = os.path.join(os.path.dirname(__file__), "doc", "source") - target_directory = os.path.join(os.path.dirname(__file__), "build", "sphinx", "html") - subprocess.run(f"{context.python_binary} -m pip install -e .[doc]", shell=True, check=True) - subprocess.run(f"{context.python_binary} archive_examples.py", shell=True, check=True) - subprocess.run( - f"{context.python_binary} -m sphinx -b html {docs_directory} {target_directory}", - shell=True, - check=True, - ) - - -def _run_tests(context): - cmd = ( - f"{context.python_binary} -m pytest -v --junitxml test_results.xml " - + "--cov=ansys --cov-report=xml --cov-report=html" - ) - subprocess.run(f"{cmd}", shell=True, check=True) - - -steps = [ - ("venv", _do_venv), - # ("wheel", _do_wheel), - ("documentation", _do_documentation), - ("tests", _run_tests), -] - - -def main(context): - steps_to_run = set(context.args.selected_steps) - steps_to_run.difference_update(context.args.disabled_steps) - - ordered_steps_to_run = [v[0] for v in steps if v[0] in steps_to_run] - log.debug("Running steps: %s" % ", ".join(ordered_steps_to_run)) - for step_name, step_impl in steps: - if step_name not in steps_to_run: - continue - log.info(f"Running step: {step_name}") - step_impl(context) - - log.info(f"All done!") - - if "venv" in steps_to_run: - log.info("Remember to activate the venv ...") - - -if __name__ == "__main__": - step_names = [v[0] for v in steps] - - parser = argparse.ArgumentParser(description="Build") - parser.add_argument( - "selected_steps", - nargs="*", - default="all", - choices=step_names + ["all"], - help="Steps selected to run", - ) - parser.add_argument( - "-n", - "--no", - dest="disabled_steps", - action="append", - help="Disable selected steps", - default=[], - choices=step_names, - ) - parser.add_argument("-V", "--venv-name", default="dev_env", help="Name of venv to create") - parser.add_argument("-v", "--verbose", action="store_true", help="Increase verbosity") - - args = parser.parse_args() - - if args.selected_steps == "all": - args.selected_steps = list(step_names) - - context = Context(args) - - main(context) diff --git a/src/ansys/hps/client/__version__.py b/src/ansys/hps/client/__version__.py index c423cf25c..1927a8591 100644 --- a/src/ansys/hps/client/__version__.py +++ b/src/ansys/hps/client/__version__.py @@ -20,11 +20,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -__version__ = "0.6.dev0" -__version_no_dots__ = __version__.replace(".", "") -__company__ = "ANSYS, Inc." -__company_short__ = "Ansys" -__url__ = "https://github.com/ansys-internal/pyhps" +try: + import importlib.metadata as importlib_metadata +except ModuleNotFoundError: # pragma: no cover + import importlib_metadata + +# Read from the pyproject.toml +# major, minor, patch +__version__ = importlib_metadata.version("ansys-pyhps") # this is only a convenience to default the version # of Ansys simulation applications in pyhps examples From 55bdc0d178cbb6317831caac605f56bacbc25909 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Wed, 17 Jan 2024 14:09:19 -0500 Subject: [PATCH 17/61] remove obsolete vars & install repo for lib version --- .github/workflows/ci_cd.yml | 11 ++++++++++- src/ansys/hps/client/__init__.py | 9 +-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 7129392fe..fa3b5ce8d 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -182,6 +182,15 @@ jobs: name: Get library version runs-on: ubuntu-latest steps: + - name: "Install Git and clone project" + uses: actions/checkout@v4 + + - name: "Set up Python ${{ env.MAIN_PYTHON_VERSION }}" + uses: ansys/actions/_setup-python@main + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + use-cache: true + - name: "Install the library" shell: bash run: | @@ -223,7 +232,7 @@ jobs: pre-release: name: Pre-release project if: startsWith(github.ref, 'refs/heads/main') - needs: [package] + needs: [package, library-version] runs-on: ubuntu-latest steps: - uses: actions/download-artifact@v3 diff --git a/src/ansys/hps/client/__init__.py b/src/ansys/hps/client/__init__.py index 34c8deff8..be9cdedff 100644 --- a/src/ansys/hps/client/__init__.py +++ b/src/ansys/hps/client/__init__.py @@ -21,14 +21,7 @@ # SOFTWARE. -from .__version__ import ( - __ansys_apps_version__, - __company__, - __company_short__, - __url__, - __version__, - __version_no_dots__, -) +from .__version__ import __ansys_apps_version__, __version__ from .auth import AuthApi from .client import Client from .exceptions import APIError, ClientError, HPSError From aadf06d004539b8477cdad28917415a230144296 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Wed, 17 Jan 2024 14:48:23 -0500 Subject: [PATCH 18/61] update license header hook to 0.2.8 --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c4426e35d..787cd5a8f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,10 +31,10 @@ repos: args: [-I, .codespellignore] - repo: https://github.com/ansys/pre-commit-hooks - rev: v0.2.7 + rev: v0.2.8 hooks: - id: add-license-headers - files: '(ansys|examples|tests)/.*\.(py)|\.(proto)|generate_resources.py|build.py|archive_examples.py' + files: '(ansys|examples|tests)/.*\.(py)|\.(proto)|generate_resources.py|archive_examples.py' # For now we disable some of these checks, can be reenabled later # - repo: https://github.com/pycqa/pydocstyle From 1bb7c209f3f6eedf7fcad00d40a1d7dca786fa61 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Wed, 17 Jan 2024 15:35:27 -0500 Subject: [PATCH 19/61] update artifact name for pre-release --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index fa3b5ce8d..3bdb0d8a6 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -237,7 +237,7 @@ jobs: steps: - uses: actions/download-artifact@v3 with: - name: ansys-pyhps-package + name: ansys-pyhps-artifacts path: /tmp/artifacts - name: List artifacts From 87be642268cdae8d70d4b3d5a4b3df4efaea4bb3 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 18 Jan 2024 09:22:51 -0500 Subject: [PATCH 20/61] add doc-style check, generate pdf for docs, and upload dev & stable docs --- .github/workflows/ci_cd.yml | 83 ++++++++++++++++++++++--------------- doc/Makefile | 4 ++ doc/make.bat | 5 +++ tox.ini | 4 +- 4 files changed, 61 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 3bdb0d8a6..3be8c185b 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -35,6 +35,15 @@ jobs: - name: Test with tox run: tox -e style + doc-style: + name: Documentation Style Check + runs-on: ubuntu-latest + steps: + - name: PyAnsys documentation style checks + uses: ansys/actions/doc-style@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + quick-tests: name: Quick tests and coverage runs-on: ${{ matrix.os }} @@ -114,36 +123,35 @@ jobs: docs: name: Documentation runs-on: ubuntu-latest - # needs: docs-style + needs: [style, doc-style] steps: - uses: actions/checkout@v3 + - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ env.DOC_PYTHON_VERSION }} + - name: Install dependencies run: | python -m pip install --upgrade pip setuptools tox + - name: Generate the documentation with tox run: tox -e doc + - name: Upload HTML Documentation - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: documentation-html - path: build/sphinx/html + path: doc/_build/html retention-days: 7 - upload_dev_docs: - name: "Upload dev documentation" - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - needs: [docs] - steps: - - name: Deploy the latest documentation - uses: ansys/actions/doc-deploy-dev@v2 + - name: Upload PDF Documentation + uses: actions/upload-artifact@v4 with: - cname: ${{ env.DOCUMENTATION_CNAME }} - token: ${{ secrets.GITHUB_TOKEN }} + name: documentation-pdf + path: doc/_build/latex/*.pdf + retention-days: 7 smoke-tests: name: Build and Smoke tests @@ -196,30 +204,11 @@ jobs: run: | python -m pip install -e . - - name: "Verify if importlib-metadata needs to be installed" - shell: bash - run: | - python_version="${{ env.MAIN_PYTHON_VERSION }}" - minor_python_version=$(echo "$python_version" | awk -F "." '{print $2}') - major_python_version=$(echo "$python_version" | awk -F "." '{print $1}') - if (( $(( $major_python_version == 3 )) )) && (( $(( $minor_python_version < 8 )) )); then - echo "needs_importlib_metadata=true" >> $GITHUB_ENV - elif (( $(( $major_python_version < 3 )) )); then - echo "needs_importlib_metadata=true" >> $GITHUB_ENV - else - echo "needs_importlib_metadata=false" >> $GITHUB_ENV - fi - - name: "Verify library is properly installed and get its version number" shell: bash run: | library_name=${{ env.PACKAGE_NAME }} - - if [ ${{ env.needs_importlib_metadata }} == 'true' ]; then - version=$(python -c "import importlib_metadata; print(importlib_metadata.version('$library_name'))") - else - version=$(python -c "import importlib.metadata as importlib_metadata; print(importlib_metadata.version('$library_name'))") - fi + version=$(python -c "import importlib.metadata as importlib_metadata; print(importlib_metadata.version('$library_name'))") if [ -z "$version" ]; then echo "Problem getting the library version" @@ -254,6 +243,19 @@ jobs: files: | /tmp/artifacts/*.whl + upload_dev_docs: + name: "Upload dev documentation" + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + needs: [docs, pre-release] + steps: + - name: Deploy the latest documentation + uses: ansys/actions/doc-deploy-dev@v4 + with: + doc-artifact-name: 'documentation-html' + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} + release: name: Release project if: github.event_name == 'push' && contains(github.ref, 'refs/tags') @@ -270,4 +272,17 @@ jobs: - name: Release to GitHub uses: ansys/actions/release-github@v5 with: - library-name: ${{ env.PACKAGE_NAME }} \ No newline at end of file + library-name: ${{ env.PACKAGE_NAME }} + + doc-deploy-stable: + name: "Deploy stable documentation" + # Deploy release documentation when creating a new tag + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + runs-on: ubuntu-latest + needs: [docs, release] + steps: + - uses: ansys/actions/doc-deploy-stable@v4 + with: + doc-artifact-name: 'documentation-html' + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/doc/Makefile b/doc/Makefile index d5066f423..a676dbd6f 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -18,6 +18,10 @@ help: %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) +pdf: + @$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true + (test -f $(BUILDDIR)/latex/*.pdf && echo pdf exists) || exit 1 # Customized clean due to examples gallery clean: diff --git a/doc/make.bat b/doc/make.bat index fbf400507..c98a36031 100644 --- a/doc/make.bat +++ b/doc/make.bat @@ -29,6 +29,11 @@ if errorlevel 9009 ( %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% goto end +:pdf + %SPHINXBUILD% -M latex %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + cd "%BUILDDIR%\latex" + pdflatex \*.tex --interaction=nonstopmode + :clean rmdir /s /q %BUILDDIR% > /NUL 2>&1 for /d /r %SOURCEDIR% %%d in (_autosummary) do @if exist "%%d" rmdir /s /q "%%d" diff --git a/tox.ini b/tox.ini index 5693884b4..766cd4eec 100644 --- a/tox.ini +++ b/tox.ini @@ -37,6 +37,8 @@ commands = description = Check if documentation generates properly deps = -e .[doc] +allowlist_externals = make commands = python archive_examples.py - python -m sphinx -b html doc/source build/sphinx/html \ No newline at end of file + make -C doc html + make -C doc pdf \ No newline at end of file From 5fdd5d720953bb1e5ef809e75d0e2afcb00a3ad3 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 18 Jan 2024 09:58:16 -0500 Subject: [PATCH 21/61] update docs for doc check --- doc/.vale.ini | 3 ++ doc/source/api/auth.rst | 12 ++--- doc/source/api/exceptions.rst | 4 +- doc/source/api/jms.rst | 52 +++++++++---------- doc/source/api/rms.rst | 30 +++++------ doc/source/examples/ex_cfx_static_mixer.rst | 6 +-- .../examples/ex_fluent_2d_heat_exchanger.rst | 4 +- doc/source/examples/ex_fluent_nozzle.rst | 2 +- doc/source/examples/ex_lsdyna_job.rst | 4 +- .../examples/ex_mapdl_linked_analyses.rst | 4 +- .../examples/ex_mapdl_tire_performance.rst | 2 +- doc/source/examples/ex_motorbike_frame.rst | 8 +-- .../examples/ex_motorbike_frame_query.rst | 6 +-- doc/source/examples/ex_python_two_bar.rst | 8 +-- doc/source/index.rst | 4 +- doc/source/install.rst | 4 +- doc/source/quickstart.rst | 18 +++---- doc/styles/Vocab/ANSYS/accept.txt | 15 ++++++ tests/test_examples.py | 4 +- 19 files changed, 104 insertions(+), 86 deletions(-) diff --git a/doc/.vale.ini b/doc/.vale.ini index 4f0b67098..790db5c3a 100644 --- a/doc/.vale.ini +++ b/doc/.vale.ini @@ -24,5 +24,8 @@ Vocab = ANSYS [*.{md,rst}] +# By default, `class`, `func`, and `exc` are ignored +TokenIgnores = (:class:`.*`|:func:`.*`|:exc:`.*`) + # Apply the following styles BasedOnStyles = Vale, Google diff --git a/doc/source/api/auth.rst b/doc/source/api/auth.rst index eeaeda59d..7ba80a52e 100644 --- a/doc/source/api/auth.rst +++ b/doc/source/api/auth.rst @@ -1,25 +1,25 @@ -Authentication Service -=========================== +Authentication service +====================== --TODO Review-- -The REP Authentication Service processes all REP sign ins following OAuth 2.0 resource owner password credentials flow. +The REP Authentication Service processes all REP sign ins following Open Authorization (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``. Authentication function ------------------------------------------- +----------------------- .. autofunction:: ansys.hps.client.auth.authenticate Auth API ------------------------------------------- +-------- .. autoclass:: ansys.hps.client.auth.AuthApi :members: User --------------------------------------- +---- .. autoclass:: ansys.hps.client.auth.User :members: \ No newline at end of file diff --git a/doc/source/api/exceptions.rst b/doc/source/api/exceptions.rst index 48bbf8dee..56ccb632f 100644 --- a/doc/source/api/exceptions.rst +++ b/doc/source/api/exceptions.rst @@ -3,8 +3,8 @@ Exceptions HTTP requests returning an unsuccessful status code will raise: -* :exc:`ansys.hps.client.ClientError` for client errors (4xx status code, e.g. bad syntax or not found) -* :exc:`ansys.hps.client.APIError` for server errors (5xx status code, e.g. internal server error or not implemented) +* :exc:`ansys.hps.client.ClientError` for client errors (4xx status code. For example, bad syntax or not found) +* :exc:`ansys.hps.client.APIError` for server errors (5xx status code. For example, internal server error or not implemented) All exceptions that the Ansys REP clients explicitly raise inherit from :exc:`ansys.hps.client.HPSError`. diff --git a/doc/source/api/jms.rst b/doc/source/api/jms.rst index 44f091288..afaa79586 100644 --- a/doc/source/api/jms.rst +++ b/doc/source/api/jms.rst @@ -1,45 +1,45 @@ -Job Management Service -=========================== +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``. APIs --------------------------------------- +---- -JMS Api -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +JMS API +^^^^^^^ .. autoclass:: ansys.hps.client.jms.JmsApi :members: :undoc-members: -Project Api -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Project API +^^^^^^^^^^^ .. autoclass:: ansys.hps.client.jms.ProjectApi :members: :undoc-members: Resources --------------------------------------- +--------- File -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^ .. autoclass:: ansys.hps.client.jms.File :members: Project -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^ .. autoclass:: ansys.hps.client.jms.Project :members: :undoc-members: :exclude-members: Meta -Fitness Definition -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Fitness definition +^^^^^^^^^^^^^^^^^^ .. autoclass:: ansys.hps.client.jms.FitnessTermDefinition :members: @@ -49,7 +49,7 @@ Fitness Definition Parameters -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^ .. autoclass:: ansys.hps.client.jms.FloatParameterDefinition :members: @@ -66,8 +66,8 @@ Parameters .. autoclass:: ansys.hps.client.jms.ParameterMapping :members: -Task Definition -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Task definition +^^^^^^^^^^^^^^^ .. autoclass:: ansys.hps.client.jms.Software :members: @@ -85,8 +85,8 @@ Task Definition :members: -Job Definition -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Job definition +^^^^^^^^^^^^^^ .. autoclass:: ansys.hps.client.jms.JobDefinition :members: @@ -94,42 +94,42 @@ Job Definition :exclude-members: Meta Task -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^ .. autoclass:: ansys.hps.client.jms.Task :members: Job -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^ .. autoclass:: ansys.hps.client.jms.Job :members: -Job Selection -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Job selection +^^^^^^^^^^^^^ .. autoclass:: ansys.hps.client.jms.JobSelection :members: -Design Exploration Algorithm -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Design exploration algorithm +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. autoclass:: ansys.hps.client.jms.Algorithm :members: Evaluator -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^ .. autoclass:: ansys.hps.client.jms.Evaluator :members: -Task Definition Template -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Task definition template +^^^^^^^^^^^^^^^^^^^^^^^^ .. autoclass:: ansys.hps.client.jms.TemplateProperty :members: diff --git a/doc/source/api/rms.rst b/doc/source/api/rms.rst index c8f49defb..3b51973ef 100644 --- a/doc/source/api/rms.rst +++ b/doc/source/api/rms.rst @@ -1,44 +1,44 @@ -Resource Management Service +Resource management service =========================== -Ansys REP includes the Resource Management Service (JMS), which is the main service for managing heterogeneous compute resources. +Ansys REP includes the Resource Management Service (RMS), 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``. APIs -------------------------------------- -RMS Api -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +RMS API +^^^^^^^ .. autoclass:: ansys.hps.client.rms.RmsApi :members: :undoc-members: Resources --------------------------------------- +--------- -Evaluator Registration -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Evaluator registration +^^^^^^^^^^^^^^^^^^^^^^ .. autopydantic_model:: ansys.hps.client.rms.EvaluatorRegistration -Evaluator Configuration -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Evaluator configuration +^^^^^^^^^^^^^^^^^^^^^^^ .. autopydantic_model:: ansys.hps.client.rms.EvaluatorConfiguration -Evaluator Configuration Update -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Evaluator configuration update +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. autopydantic_model:: ansys.hps.client.rms.EvaluatorConfigurationUpdate -Scaler Configuration -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Scaler configuration +^^^^^^^^^^^^^^^^^^^^ .. autopydantic_model:: ansys.hps.client.rms.ScalerRegistration -Compute Resource Set -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Compute resource set +^^^^^^^^^^^^^^^^^^^^ .. autopydantic_model:: ansys.hps.client.rms.ComputeResourceSet diff --git a/doc/source/examples/ex_cfx_static_mixer.rst b/doc/source/examples/ex_cfx_static_mixer.rst index 6df8313c2..18ec5e6ff 100644 --- a/doc/source/examples/ex_cfx_static_mixer.rst +++ b/doc/source/examples/ex_cfx_static_mixer.rst @@ -1,13 +1,13 @@ .. _example_cfx_static_mixer: -CFX Static Mixer +CFX static mixer ================ -This example shows how to submit a CFX Static Mixer model to be solved on HPS. +This example shows how to submit a CFX static mixer model to be solved on HPS. .. only:: builder_html - The project setup script as well as the data files can be downloaded here :download:`CFX Static Mixer Example <../../../build/cfx_static_mixer.zip>`. + The project setup script as well as the data files can be downloaded here :download:`CFX static mixer example <../../../build/cfx_static_mixer.zip>`. The project uses an execution script `exec_cfx.py` instead of a solver command line. diff --git a/doc/source/examples/ex_fluent_2d_heat_exchanger.rst b/doc/source/examples/ex_fluent_2d_heat_exchanger.rst index fd70854ec..1e59c5e59 100644 --- a/doc/source/examples/ex_fluent_2d_heat_exchanger.rst +++ b/doc/source/examples/ex_fluent_2d_heat_exchanger.rst @@ -1,13 +1,13 @@ .. _example_fluent_2d_heat_exchanger: -Fluent 2d Heat Exchanger +Fluent 2D heat exchanger ======================== This example shows how to submit a simple Fluent solve job to HPS. The model consists of a 2D heat exchanger. .. only:: builder_html - The project setup script as well as the data files can be downloaded here :download:`Fluent 2d Heat Exchanger Example <../../../build/fluent_2d_heat_exchanger.zip>`. + The project setup script as well as the data files can be downloaded here :download:`Fluent 2D heat exchanger example <../../../build/fluent_2d_heat_exchanger.zip>`. .. literalinclude:: ../../../examples/fluent_2d_heat_exchanger/project_setup.py :language: python diff --git a/doc/source/examples/ex_fluent_nozzle.rst b/doc/source/examples/ex_fluent_nozzle.rst index 33c29ed3b..d1bda8ea7 100644 --- a/doc/source/examples/ex_fluent_nozzle.rst +++ b/doc/source/examples/ex_fluent_nozzle.rst @@ -1,6 +1,6 @@ .. _example_fluent_nozzle: -Fluent Nozzle +Fluent nozzle ============= This example shows how to submit a Fluent nozzle model to be solved on REP. diff --git a/doc/source/examples/ex_lsdyna_job.rst b/doc/source/examples/ex_lsdyna_job.rst index 4b649fa97..de81a2dc8 100644 --- a/doc/source/examples/ex_lsdyna_job.rst +++ b/doc/source/examples/ex_lsdyna_job.rst @@ -1,10 +1,10 @@ .. _example_lsdyna_job: -LS-DYNA Job Submission +LS-DYNA job submission ====================== This example shows how to submit an LS-DYNA job to HPS. Once submitted, minimal job information are serialized to a JSON file ``rep_job.json``. -This mimics what an application would need to store in order to subsequently monitor the job and download results. +This mimics what an app would need to store to subsequently monitor the job and download results. The job consists of two tasks: diff --git a/doc/source/examples/ex_mapdl_linked_analyses.rst b/doc/source/examples/ex_mapdl_linked_analyses.rst index 4fb599348..91dbcc8f3 100644 --- a/doc/source/examples/ex_mapdl_linked_analyses.rst +++ b/doc/source/examples/ex_mapdl_linked_analyses.rst @@ -1,7 +1,7 @@ .. _example_mapdl_linked_analyses: -MAPDL Linked Analyses Example -========================================= +MAPDL linked analyses example +============================= This example shows how to submit an MAPDL linked analysis workflow (prestress-modal-harmonic) as a multi-task job to REP. The script shows two possible ways to submit the individual tasks: diff --git a/doc/source/examples/ex_mapdl_tire_performance.rst b/doc/source/examples/ex_mapdl_tire_performance.rst index 9c92703e7..d573bc3bc 100644 --- a/doc/source/examples/ex_mapdl_tire_performance.rst +++ b/doc/source/examples/ex_mapdl_tire_performance.rst @@ -1,6 +1,6 @@ .. _example_mapdl_tire_performance: -MAPDL Tire Performance +MAPDL tire performance ======================= This example shows how to submit an MAPDL solver job to REP. The MAPDL model is the Tire-Performance Simulation example included diff --git a/doc/source/examples/ex_motorbike_frame.rst b/doc/source/examples/ex_motorbike_frame.rst index 9caac9e48..8ab28da0f 100644 --- a/doc/source/examples/ex_motorbike_frame.rst +++ b/doc/source/examples/ex_motorbike_frame.rst @@ -1,11 +1,11 @@ .. _example_mapdl_motorbike_frame: -MAPDL Motorbike Frame - Project Creation +MAPDL motorbike frame - project creation ========================================= This example shows how to create from scratch a REP project consisting of an Ansys APDL beam model of a tubular steel trellis motorbike-frame. -After creating the project job_definition, 10 design points with randomly +After creating the project job definition, 10 design points with randomly chosen parameter values are created and set to pending. .. image:: ../_static/motorbike_frame.jpg @@ -17,7 +17,7 @@ The model is parametrized as follows: - three custom tube types are defined whose radius and thickness can vary in a certain range; - for each tube in the frame there is a string parameter specifying which custom type it should be made of; -- output parameters of interest are the weight, the torsion stiffness and the maximum von Mises stress for a breaking load case. +- output parameters of interest are the weight, the torsion stiffness and the maximum Von Mises stress for a breaking load case. For further details about the finite element model and its parametrization, see "Using Evolutionary Methods with a Heterogeneous Genotype Representation @@ -26,7 +26,7 @@ by U. M. Fasel, O. Koenig, M. Wintermantel and P. Ermanni. .. only:: builder_html - The project setup script as well as the data files can be downloaded here :download:`MAPDL Motorbike Frame Project <../../../build/mapdl_motorbike_frame.zip>`. + The project setup script as well as the data files can be downloaded here :download:`MAPDL motorbike frame project <../../../build/mapdl_motorbike_frame.zip>`. .. literalinclude:: ../../../examples/mapdl_motorbike_frame/project_setup.py :language: python diff --git a/doc/source/examples/ex_motorbike_frame_query.rst b/doc/source/examples/ex_motorbike_frame_query.rst index 04ad36240..2e45ff198 100644 --- a/doc/source/examples/ex_motorbike_frame_query.rst +++ b/doc/source/examples/ex_motorbike_frame_query.rst @@ -1,13 +1,13 @@ .. _example_mapdl_motorbike_frame_query: -MAPDL Motorbike Frame - Project Query -========================================= +MAPDL motorbike frame - project query +===================================== This example builds upon the example :ref:`example_mapdl_motorbike_frame`. It shows how to query resources of an existing project and how to download output files. .. only:: builder_html - The project setup script as well as the data files can be downloaded here :download:`MAPDL Motorbike Frame Project <../../../build/mapdl_motorbike_frame.zip>`. + The project setup script as well as the data files can be downloaded here :download:`MAPDL motorbike frame project <../../../build/mapdl_motorbike_frame.zip>`. .. literalinclude:: ../../../examples/mapdl_motorbike_frame/project_query.py diff --git a/doc/source/examples/ex_python_two_bar.rst b/doc/source/examples/ex_python_two_bar.rst index 9dcd54839..2e4f7e9c1 100644 --- a/doc/source/examples/ex_python_two_bar.rst +++ b/doc/source/examples/ex_python_two_bar.rst @@ -1,16 +1,16 @@ .. _example_python_two_bar: -Python Two-Bar Truss Example -========================================= +Python two-bar truss example +============================ This example shows how to create a REP project solving a Two-Bar Truss problem with Python. For the original problem descriptions you can refer to R.L. Fox, *Optimization Methods in Engineering Design*, Addison Wesley, 1971. -See e.g. https://apmonitor.com/me575/uploads/Main/optimization_book.pdf +See https://apmonitor.com/me575/uploads/Main/optimization_book.pdf .. only:: builder_html - The project setup script as well as the data files can be downloaded here :download:`Python Two-Bar Truss Example <../../../build/python_two_bar_truss_problem.zip>`. + The project setup script as well as the data files can be downloaded here :download:`Python two-bar truss example <../../../build/python_two_bar_truss_problem.zip>`. .. literalinclude:: ../../../examples/python_two_bar_truss_problem/project_setup.py :language: python diff --git a/doc/source/index.rst b/doc/source/index.rst index bd85c4149..b2cb7e475 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,5 +1,5 @@ -PyHPS Documentation |version| -================================= +PyHPS documentation |version| +============================= .. toctree:: :hidden: diff --git a/doc/source/install.rst b/doc/source/install.rst index 8b41aabcd..954548474 100644 --- a/doc/source/install.rst +++ b/doc/source/install.rst @@ -3,7 +3,7 @@ Installation ============ -Make sure you have ``Python 3`` and that the expected version is available from your command line. You can check this by running: +Make sure you have ``Python 3`` and that the expected version is available from your command line. You can check your python version by running: .. code:: @@ -11,7 +11,7 @@ Make sure you have ``Python 3`` and that the expected version is available from If you do not have Python, please install the latest 3.x version from `python.org `_. -Additionally, make sure you have ``pip`` available. You can check this by running: +Additionally, make sure you have ``pip`` available. You can check your pip version by running: .. code:: diff --git a/doc/source/quickstart.rst b/doc/source/quickstart.rst index 08eba37e3..96e7078c4 100644 --- a/doc/source/quickstart.rst +++ b/doc/source/quickstart.rst @@ -3,19 +3,19 @@ Quickstart ========== -This guide will walk you through the basics of interacting with Ansys HPC Platform Services. More elaborated examples are available in the :ref:`Examples ` chapter, -while detailed documentation can be found in the :ref:`Code Documentation `. +This guide walks you through the basics of interacting with Ansys HPC Platform Services. More elaborated examples are available in the :ref:`Examples ` section, +while detailed documentation can be found in the :ref:`Code documentation `. -To reproduce the code samples provided below, you will need: +To reproduce the code samples provided below, you need: - A running HPS installation, go to the `REP repository `_ for instructions. - A Python shell with ``ansys-pyhps`` installed. If you haven't installed it yet, please refer to the :ref:`Installation ` guide. -Connect to HPC Platform Services +Connect to HPC platform services -------------------------------- -Let's start by connecting to an HPS deployment running on the localhost with default username and password. +Start by connecting to an HPS deployment running on the localhost with default username and password. .. code-block:: python @@ -154,8 +154,8 @@ You can use the ``offset`` and ``limit`` query parameters to paginate items in a eval_status="evaluated", limit=10, offset=5) -Objects vs dictionaries ------------------------------------ +Objects vs. dictionaries +------------------------ Most ``get``, ``create`` and ``update`` functions can optionally return dictionaries rather than class objects by setting ``as_objects=False``. This is especially useful when the returned data needs to be further manipulated by popular packages @@ -314,7 +314,7 @@ Exception handling All exceptions that the Ansys REP client explicitly raise inherit from :exc:`ansys.hps.client.HPSError`. Client Errors are raised for 4xx HTTP status codes, while API Errors are raised for 5xx HTTP status codes (server side errors). -For example, instantiating a client with invalid credentials will return a 401 Client Error. +For example, instantiating a client with invalid credentials returns a 401 Client Error. .. code-block:: python @@ -329,7 +329,7 @@ For example, instantiating a client with invalid credentials will return a 401 C # 401 Client Error: invalid_grant for: POST https://localhost:8443/rep/auth/realms/rep/protocol/openid-connect/token # Invalid user credentials -A *get* call on a non-existing resource will return a 404 Client Error. +A *get* call on a non-existing resource returns a 404 Client Error. .. code-block:: python diff --git a/doc/styles/Vocab/ANSYS/accept.txt b/doc/styles/Vocab/ANSYS/accept.txt index f59f77121..c36065ec9 100644 --- a/doc/styles/Vocab/ANSYS/accept.txt +++ b/doc/styles/Vocab/ANSYS/accept.txt @@ -1,3 +1,18 @@ ANSYS Ansys ansys +OAuth +subpackage +API +APIs +HPC +MAPDL +Keycloak +marshmallow_oneofschema +pydantic +cnd +Von Mises stress +U. M. Fasel +O. Koenig +M. Wintermantel +P. Ermanni \ No newline at end of file diff --git a/tests/test_examples.py b/tests/test_examples.py index 923606733..8f47660c1 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -256,7 +256,7 @@ def test_cfx_static_mixer(self): from examples.cfx_static_mixer.project_setup import create_project project = create_project( - self.client, name="CFX Static Mixer Test", num_jobs=1, version=ansys_version + self.client, name="CFX static mixer test", num_jobs=1, version=ansys_version ) self.assertIsNotNone(project) @@ -264,7 +264,7 @@ def test_cfx_static_mixer(self): project_api = ProjectApi(self.client, project.id) self.assertEqual(len(project_api.get_jobs()), 1) - self.assertEqual(jms_api.get_project(id=project.id).name, "CFX Static Mixer Test") + self.assertEqual(jms_api.get_project(id=project.id).name, "CFX static mixer test") jms_api.delete_project(project) From c389fc529c82bad24d22dc009695b5f0c2f25b78 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 18 Jan 2024 10:10:35 -0500 Subject: [PATCH 22/61] doc style updates --- README.rst | 6 +++--- doc/source/api/exceptions.rst | 2 +- doc/source/api/index.rst | 4 ++-- doc/styles/Vocab/ANSYS/accept.txt | 25 ++++++++++++++++--------- generate_resources.py | 2 +- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/README.rst b/README.rst index 8ad49bfcd..619569285 100644 --- a/README.rst +++ b/README.rst @@ -55,8 +55,8 @@ Contribute ---------- Before contributing to the project, ensure that you are thoroughly -familiar with the `PyAnsys Developer's guide`_. You will -need to follow these steps: +familiar with the `PyAnsys Developer's guide`_. To contribute, +follow these steps: #. Clone this repository: @@ -178,7 +178,7 @@ Then, run the datamodel generator: Documentation, Issues, and Support ---------------------------------- Documentation for the latest stable release of PyHPS is hosted at `PyHPS documentation -`_. +`_. On the `PyHPS Issues `_ page, you can create issues to report bugs and request new features. On the `PyHPS Discussions diff --git a/doc/source/api/exceptions.rst b/doc/source/api/exceptions.rst index 56ccb632f..9abb82310 100644 --- a/doc/source/api/exceptions.rst +++ b/doc/source/api/exceptions.rst @@ -1,7 +1,7 @@ Exceptions =========================== -HTTP requests returning an unsuccessful status code will raise: +HTTP requests returning an unsuccessful status code raise: * :exc:`ansys.hps.client.ClientError` for client errors (4xx status code. For example, bad syntax or not found) * :exc:`ansys.hps.client.APIError` for server errors (5xx status code. For example, internal server error or not implemented) diff --git a/doc/source/api/index.rst b/doc/source/api/index.rst index b9adf3f87..87e56f403 100644 --- a/doc/source/api/index.rst +++ b/doc/source/api/index.rst @@ -1,7 +1,7 @@ .. _api_reference: -Code Documentation -=========================== +Code documentation +================== If you are looking for information on a specific function, class, or method, this part of the documentation is for you. diff --git a/doc/styles/Vocab/ANSYS/accept.txt b/doc/styles/Vocab/ANSYS/accept.txt index c36065ec9..0a4a1d984 100644 --- a/doc/styles/Vocab/ANSYS/accept.txt +++ b/doc/styles/Vocab/ANSYS/accept.txt @@ -1,18 +1,25 @@ +2D ANSYS Ansys ansys -OAuth -subpackage API APIs +CFX +cnd +Ermanni +Fasel HPC -MAPDL +JMS API Keycloak +keycloak +Koenig +LS-DYNA +MAPDL marshmallow_oneofschema +Mises +OAuth pydantic -cnd -Von Mises stress -U. M. Fasel -O. Koenig -M. Wintermantel -P. Ermanni \ No newline at end of file +PyHPS +subpackage +Von +Wintermantel \ No newline at end of file diff --git a/generate_resources.py b/generate_resources.py index e0edd89a7..75ca5bdd8 100644 --- a/generate_resources.py +++ b/generate_resources.py @@ -377,7 +377,7 @@ def _extract_field_type(v, resources) -> str: def declared_fields(schema, resources): """ - Helper function to retrieve the fields that will be defined as class members for an object + Helper function to retrieve the fields that is defined as class members for an object """ fields = [] fields_doc = [] From 2924e2596c7b5ad35d0ac7ffe54ccf8abdeea645 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 18 Jan 2024 10:15:24 -0500 Subject: [PATCH 23/61] add latexmk installs --- .github/workflows/ci_cd.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 3be8c185b..f2fc21434 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -136,6 +136,10 @@ jobs: run: | python -m pip install --upgrade pip setuptools tox + # Necessary for creating PDF + sudo apt-get -y install latexmk + sudo apt install texlive-latex-extra + - name: Generate the documentation with tox run: tox -e doc From 57b8fa2c1cbb623fe240615155fda04a60ae88fc Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 18 Jan 2024 13:48:56 -0500 Subject: [PATCH 24/61] matrix tests --- .github/workflows/ci_cd.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index f2fc21434..fce4a7139 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -49,17 +49,17 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest] - cfg: - - {python-version: "3.10", toxenv: "py310"} + os: [ubuntu-latest, windows-latest] + python-version: ['3.9', '3.10', '3.11', '3.12'] + toxenv: ['py39', 'py310', 'py311', 'py312'] fail-fast: false steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.cfg.python-version }} + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: - python-version: ${{ matrix.cfg.python-version }} + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip setuptools tox tox-gh-actions @@ -99,7 +99,7 @@ jobs: working-directory: ./docker-compose-artifact - name: Test with tox - run: tox -e ${{ matrix.cfg.toxenv }}-noeval-coverage + run: tox -e ${{ matrix.toxenv }}-noeval-coverage env: REP_TEST_URL: https://localhost:8443/rep REP_TEST_USERNAME: repadmin @@ -271,7 +271,7 @@ jobs: with: library-name: ${{ env.PACKAGE_NAME }} twine-username: "__token__" - twine-token: ${{ secrets.PYPI_TOKEN }} + twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} - name: Release to GitHub uses: ansys/actions/release-github@v5 From 59674f11c8f4bc4d0c714c46c6e26005a190d8ae Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 18 Jan 2024 13:53:08 -0500 Subject: [PATCH 25/61] dictionary for tests --- .github/workflows/ci_cd.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index fce4a7139..a6491a60d 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -50,16 +50,20 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - python-version: ['3.9', '3.10', '3.11', '3.12'] - toxenv: ['py39', 'py310', 'py311', 'py312'] + cfg: [ + { python-version: '3.9', toxenv: 'py39' }, + { python-version: '3.10', toxenv: 'py310' }, + { python-version: '3.11', toxenv: 'py311' }, + { python-version: '3.12', toxenv: 'py312' }, + ] fail-fast: false steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python ${{ matrix.cfg.python-version }} uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.cfg.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip setuptools tox tox-gh-actions @@ -99,7 +103,7 @@ jobs: working-directory: ./docker-compose-artifact - name: Test with tox - run: tox -e ${{ matrix.toxenv }}-noeval-coverage + run: tox -e ${{ matrix.cfg.toxenv }}-noeval-coverage env: REP_TEST_URL: https://localhost:8443/rep REP_TEST_USERNAME: repadmin From 284dd7b6e550a24a1491794c3dc7952bcfe5275d Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 18 Jan 2024 13:57:06 -0500 Subject: [PATCH 26/61] remove windows from tests --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index a6491a60d..aabd5ba09 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -49,7 +49,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest] cfg: [ { python-version: '3.9', toxenv: 'py39' }, { python-version: '3.10', toxenv: 'py310' }, From 92d53a720141b8866e7bc9745f0b9b643c6adfa4 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 18 Jan 2024 15:36:09 -0500 Subject: [PATCH 27/61] update urls and comment out python3.12 for now --- .github/workflows/ci_cd.yml | 2 +- .github/workflows/label.yml | 12 ++++++------ README.rst | 22 +++++++++++----------- doc/source/quickstart.rst | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index aabd5ba09..da6f4a011 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -54,7 +54,7 @@ jobs: { python-version: '3.9', toxenv: 'py39' }, { python-version: '3.10', toxenv: 'py310' }, { python-version: '3.11', toxenv: 'py311' }, - { python-version: '3.12', toxenv: 'py312' }, + # { python-version: '3.12', toxenv: 'py312' }, # ignore 3.12 for time being ] fail-fast: false diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 596446d76..c8f362ab5 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -76,9 +76,9 @@ jobs: issue-number: ${{ github.event.pull_request.number }} body: | Please add one of the following labels to add this contribution to the Release Notes :point_down: - - [bug]([https://github.com/pyansys/pyhps/pulls?q=label%3Abug+) - - [documentation]([https://github.com/pyansys/pyhps/pulls?q=label%3Adocumentation+) - - [enhancement]([https://github.com/pyansys/pyhps/pulls?q=label%3Aenhancement+) - - [good first issue]([https://github.com/pyansys/pyhps/pulls?q=label%3Agood+first+issue) - - [maintenance]([https://github.com/pyansys/pyhps/pulls?q=label%3Amaintenance+) - - [release]([https://github.com/pyansys/pyhps/pulls?q=label%3Arelease+) + - [bug]([https://github.com/ansys-internal/pyhps/pulls?q=label%3Abug+) + - [documentation]([https://github.com/ansys-internal/pyhps/pulls?q=label%3Adocumentation+) + - [enhancement]([https://github.com/ansys-internal/pyhps/pulls?q=label%3Aenhancement+) + - [good first issue]([https://github.com/ansys-internal/pyhps/pulls?q=label%3Agood+first+issue) + - [maintenance]([https://github.com/ansys-internal/pyhps/pulls?q=label%3Amaintenance+) + - [release]([https://github.com/ansys-internal/pyhps/pulls?q=label%3Arelease+) diff --git a/README.rst b/README.rst index 619569285..ddd11929d 100644 --- a/README.rst +++ b/README.rst @@ -6,20 +6,20 @@ PyHPS :target: https://docs.pyansys.com/ :alt: PyAnsys -.. |python| image:: https://img.shields.io/badge/Python-%3E%3D3.7-blue - :target: https://pypi.org/project/ansys-rep/ +.. |python| image:: https://img.shields.io/pypi/pyversions/ansys-pyhps?logo=pypi + :target: https://pypi.org/project/ansys-pyhps :alt: Python -.. |pypi| image:: https://img.shields.io/pypi/v/ansys-rep.svg?logo=python&logoColor=white - :target: https://pypi.org/project/ansys-rep +.. |pypi| image:: https://img.shields.io/pypi/v/ansys-pyhps.svg?logo=python&logoColor=white + :target: https://pypi.org/project/ansys-pyhps :alt: PyPI -.. |codecov| image:: https://codecov.io/gh/pyansys/pyhps/branch/main/graph/badge.svg - :target: https://codecov.io/gh/pyansys/pyhps +.. |codecov| image:: https://codecov.io/gh/ansys-internal/pyhps/branch/main/graph/badge.svg + :target: https://codecov.io/gh/ansys-internal/ansys-pyhps :alt: Codecov -.. |GH-CI| image:: https://github.com/pyansys/pyhps/actions/workflows/ci_cd.yml/badge.svg - :target: https://github.com/pyansys/pyhps/actions/workflows/ci_cd.yml +.. |GH-CI| image:: https://github.com/ansys-internal/pyhps/actions/workflows/ci_cd.yml/badge.svg + :target: https://github.com/ansys-internal/pyhps/actions/workflows/ci_cd.yml :alt: GH-CI .. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg @@ -47,7 +47,7 @@ Then, as long as PyHPS is a private pyAnsys module not published to pypi yet, yo .. code:: bash - python -m pip install git+https://github.com/pyansys/pyhps + python -m pip install git+https://github.com/ansys-internal/pyhps .. TODO: Enable this once pyhps is published: python -m pip install ansys-pyhps @@ -180,9 +180,9 @@ Documentation, Issues, and Support Documentation for the latest stable release of PyHPS is hosted at `PyHPS documentation `_. -On the `PyHPS Issues `_ page, +On the `PyHPS Issues `_ page, you can create issues to report bugs and request new features. On the `PyHPS Discussions -`_ page or the `Discussions `_ +`_ page or the `Discussions `_ page on the Ansys Developer portal, you can post questions, share ideas, and get community feedback. To reach the project support team, email `pyansys.core@ansys.com `_. diff --git a/doc/source/quickstart.rst b/doc/source/quickstart.rst index 96e7078c4..95d6971d9 100644 --- a/doc/source/quickstart.rst +++ b/doc/source/quickstart.rst @@ -8,7 +8,7 @@ while detailed documentation can be found in the :ref:`Code documentation `_ for instructions. +- A running HPS installation, go to the `REP repository `_ for instructions. - A Python shell with ``ansys-pyhps`` installed. If you haven't installed it yet, please refer to the :ref:`Installation ` guide. From c754d76959597914e0acc205934f6cfa4fe142f9 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Fri, 19 Jan 2024 10:31:34 -0500 Subject: [PATCH 28/61] keycloak dep dependent on python version & url updates --- .github/workflows/ci_cd.yml | 2 +- pyproject.toml | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index da6f4a011..aabd5ba09 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -54,7 +54,7 @@ jobs: { python-version: '3.9', toxenv: 'py39' }, { python-version: '3.10', toxenv: 'py310' }, { python-version: '3.11', toxenv: 'py311' }, - # { python-version: '3.12', toxenv: 'py312' }, # ignore 3.12 for time being + { python-version: '3.12', toxenv: 'py312' }, ] fail-fast: false diff --git a/pyproject.toml b/pyproject.toml index be73be452..a9a45a283 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,8 @@ dependencies = [ "requests>=2.21.0", "marshmallow>=3.0.0", "marshmallow_oneofschema>=2.0.1", - "python-keycloak>=1.5.0,<=2.12.0", + "python-keycloak>=1.5.0,<=2.12.0;python_version<=3.11", + "python-keycloak>=3.6.1;python_version >=3.12" "backoff>=2.0.0", "pydantic>=1.10.0", ] @@ -65,9 +66,9 @@ build = [ [project.urls] Documentation = "https://hps.docs.pyansys.com" -Source = "https://github.com/ansys/pyhps" -Homepage = "https://github.com/ansys/pyhps" -Tracker = "https://github.com/ansys/pyhps/issues" +Source = "https://github.com/ansys-internal/pyhps" +Homepage = "https://github.com/ansys-internal/pyhps" +Tracker = "https://github.com/ansys-internal/pyhps/issues" [tool.flit.module] name = "ansys.hps.client" From abf0979da14efd8210a0e8a7c466cc20073d7f45 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Fri, 19 Jan 2024 10:33:16 -0500 Subject: [PATCH 29/61] add missing comma --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a9a45a283..d6c7a452f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ "marshmallow>=3.0.0", "marshmallow_oneofschema>=2.0.1", "python-keycloak>=1.5.0,<=2.12.0;python_version<=3.11", - "python-keycloak>=3.6.1;python_version >=3.12" + "python-keycloak>=3.6.1;python_version >=3.12", "backoff>=2.0.0", "pydantic>=1.10.0", ] From be5fc3ea9e5ef4bd246c6850934b393151a3035f Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Fri, 19 Jan 2024 10:36:11 -0500 Subject: [PATCH 30/61] add quotes around python version --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d6c7a452f..555c408de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,8 +33,8 @@ dependencies = [ "requests>=2.21.0", "marshmallow>=3.0.0", "marshmallow_oneofschema>=2.0.1", - "python-keycloak>=1.5.0,<=2.12.0;python_version<=3.11", - "python-keycloak>=3.6.1;python_version >=3.12", + "python-keycloak>=1.5.0,<=2.12.0;python_version<='3.11'", + "python-keycloak>=3.6.1;python_version>='3.12'", "backoff>=2.0.0", "pydantic>=1.10.0", ] From adb99156e5f2585633d69c415468116c801d37ac Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Fri, 19 Jan 2024 14:48:27 -0500 Subject: [PATCH 31/61] upload coverage results --- .github/workflows/ci_cd.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index aabd5ba09..86cb3e366 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -54,7 +54,7 @@ jobs: { python-version: '3.9', toxenv: 'py39' }, { python-version: '3.10', toxenv: 'py310' }, { python-version: '3.11', toxenv: 'py311' }, - { python-version: '3.12', toxenv: 'py312' }, + # { python-version: '3.12', toxenv: 'py312' }, ] fail-fast: false @@ -109,6 +109,14 @@ jobs: REP_TEST_USERNAME: repadmin REP_TEST_PASSWORD: repadmin + - name: "Upload coverage results" + uses: actions/upload-artifact@v4 + if: matrix.cfg.python-version == ${{ env.MAIN_PYTHON_VERSION }} + with: + name: coverage-html + path: .cov/html + retention-days: 7 + - name: Publish Test Report uses: mikepenz/action-junit-report@v3 if: always() From 900d2eba7992dd0f7995a23aa58307315c7e42b9 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Mon, 22 Jan 2024 08:21:26 -0500 Subject: [PATCH 32/61] change python-keycloak to original dep --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 555c408de..7ff528c26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,8 +33,7 @@ dependencies = [ "requests>=2.21.0", "marshmallow>=3.0.0", "marshmallow_oneofschema>=2.0.1", - "python-keycloak>=1.5.0,<=2.12.0;python_version<='3.11'", - "python-keycloak>=3.6.1;python_version>='3.12'", + "python-keycloak>=1.5.0,<=2.12.0", "backoff>=2.0.0", "pydantic>=1.10.0", ] From 07079a6c9ae71a9fc4064583e5a4fffb33b7606d Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Mon, 22 Jan 2024 08:22:35 -0500 Subject: [PATCH 33/61] add python3.12 to workflow --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 86cb3e366..1004c0425 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -54,7 +54,7 @@ jobs: { python-version: '3.9', toxenv: 'py39' }, { python-version: '3.10', toxenv: 'py310' }, { python-version: '3.11', toxenv: 'py311' }, - # { python-version: '3.12', toxenv: 'py312' }, + { python-version: '3.12', toxenv: 'py312' }, ] fail-fast: false From 0ac8795f0093e75d252ea06955901d2e7c1b86fe Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Mon, 22 Jan 2024 08:30:26 -0500 Subject: [PATCH 34/61] remove filterwarnings --- pyproject.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7ff528c26..72d0b9576 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -96,9 +96,4 @@ log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(linen log_cli_date_format = "%Y-%m-%d %H:%M:%S" markers = [ "requires_evaluator: marks tests as end-to-end requiring a running evaluator (deselect with '-m \"not requires_evaluator\"')", -] -filterwarnings = [ - "ignore::urllib3.exceptions.InsecureRequestWarning", - "ignore::DeprecationWarning:pkg_resources.*", - "ignore::ansys.hps.client.UnverifiedHTTPSRequestsWarning", ] \ No newline at end of file From 73a7a6f7fc05e0aa499901dc5cbfe97cbac800c4 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Mon, 22 Jan 2024 08:40:39 -0500 Subject: [PATCH 35/61] add setuptools for python 3.12 --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 72d0b9576..8dc9bba9d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ dependencies = [ "marshmallow>=3.0.0", "marshmallow_oneofschema>=2.0.1", "python-keycloak>=1.5.0,<=2.12.0", + "setuptools;python_version>=3.12", # Python3.12 doesn't include setuptools automatically "backoff>=2.0.0", "pydantic>=1.10.0", ] @@ -96,4 +97,9 @@ log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(linen log_cli_date_format = "%Y-%m-%d %H:%M:%S" markers = [ "requires_evaluator: marks tests as end-to-end requiring a running evaluator (deselect with '-m \"not requires_evaluator\"')", +] +filterwarnings = [ + "ignore::urllib3.exceptions.InsecureRequestWarning", + "ignore::DeprecationWarning:pkg_resources.*", + "ignore::ansys.hps.client.UnverifiedHTTPSRequestsWarning", ] \ No newline at end of file From ceedd078e107107886edcface0041b85123a5b75 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Mon, 22 Jan 2024 08:42:00 -0500 Subject: [PATCH 36/61] add quotes around python version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8dc9bba9d..8ea64587d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ "marshmallow>=3.0.0", "marshmallow_oneofschema>=2.0.1", "python-keycloak>=1.5.0,<=2.12.0", - "setuptools;python_version>=3.12", # Python3.12 doesn't include setuptools automatically + "setuptools;python_version>='3.12'", # Python3.12 doesn't include setuptools automatically "backoff>=2.0.0", "pydantic>=1.10.0", ] From fa15119c6b1d86c83389e4604444bc52ad250458 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Mon, 22 Jan 2024 08:58:09 -0500 Subject: [PATCH 37/61] test updates --- .github/workflows/ci_cd.yml | 6 +++--- tox.ini | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 1004c0425..0b97f1cea 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -44,8 +44,8 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} - quick-tests: - name: Quick tests and coverage + tests: + name: Tests and coverage runs-on: ${{ matrix.os }} strategy: matrix: @@ -193,7 +193,7 @@ jobs: package: name: Package library - needs: [quick-tests, docs] + needs: [tests, docs] runs-on: ubuntu-latest steps: - name: Build library source and wheel artifacts diff --git a/tox.ini b/tox.ini index 766cd4eec..73264683e 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ setenv = PYTHONUNBUFFERED = yes noeval: PYTEST_MARKERS = -m "not requires_evaluator" witheval: PYTEST_MARKERS = -m "requires_evaluator" - coverage: PYTEST_EXTRA_ARGS = --cov=ansys.rep --cov-report=term --cov-report=xml --cov-report=html + coverage: PYTEST_EXTRA_ARGS = --cov=ansys.rep --cov-report xml:.cov/xml --cov-report html:.cov/html --cov-report term -vv deps = -e .[tests] commands = From 6ae2e02acadbdac44caddea5d93dab60416dc61c Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Mon, 22 Jan 2024 13:25:07 -0500 Subject: [PATCH 38/61] show missing coverage in pytest --- pyproject.toml | 10 +++++++++- tox.ini | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8ea64587d..6d67def9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,16 +85,24 @@ src_paths = ["doc", "src", "tests"] [tool.coverage.run] relative_files = true -source = ["ansys.rep"] +source = ["ansys.hps"] [tool.coverage.report] show_missing = true +[tool.coverage.html] +directory = ".cov/html" + +[tool.coverage.xml] +output = ".cov/coverage.xml" + [tool.pytest.ini_options] log_cli = true log_cli_level = "INFO" log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)" log_cli_date_format = "%Y-%m-%d %H:%M:%S" +addopts = """-ra -s --durations=0 --cov=ansys.hps --cov-report html:.cov/html \ + --cov-report xml:.cov/xml --cov-report term -vv""" markers = [ "requires_evaluator: marks tests as end-to-end requiring a running evaluator (deselect with '-m \"not requires_evaluator\"')", ] diff --git a/tox.ini b/tox.ini index 73264683e..27b6f68d8 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ setenv = PYTHONUNBUFFERED = yes noeval: PYTEST_MARKERS = -m "not requires_evaluator" witheval: PYTEST_MARKERS = -m "requires_evaluator" - coverage: PYTEST_EXTRA_ARGS = --cov=ansys.rep --cov-report xml:.cov/xml --cov-report html:.cov/html --cov-report term -vv + coverage: PYTEST_EXTRA_ARGS = -ra -s --durations=0 --cov=ansys.hps --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term -vv deps = -e .[tests] commands = From e92b7368c5f5cb3161e142ae5bb4971e04b48a4b Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Mon, 22 Jan 2024 13:38:24 -0500 Subject: [PATCH 39/61] change coverage-html upload --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 0b97f1cea..f823b6a45 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -111,7 +111,7 @@ jobs: - name: "Upload coverage results" uses: actions/upload-artifact@v4 - if: matrix.cfg.python-version == ${{ env.MAIN_PYTHON_VERSION }} + if: matrix.cfg.python-version == env.MAIN_PYTHON_VERSION with: name: coverage-html path: .cov/html From 94bb56340e7a27e984e7632e3c5753c41d37a974 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 23 Jan 2024 11:43:28 -0500 Subject: [PATCH 40/61] change src/ansys/hps/client to src/ansys/hps/core --- .github/workflows/ci_cd.yml | 4 +- README.rst | 12 ++-- doc/source/api/auth.rst | 8 +-- doc/source/api/client.rst | 4 +- doc/source/api/exceptions.rst | 12 ++-- doc/source/api/jms.rst | 58 +++++++++---------- doc/source/api/rms.rst | 14 ++--- doc/source/conf.py | 10 ++-- doc/source/examples/index.rst | 2 +- doc/source/index.rst | 2 +- doc/source/quickstart.rst | 16 ++--- examples/cfx_static_mixer/project_setup.py | 4 +- .../fluent_2d_heat_exchanger/project_setup.py | 4 +- examples/fluent_nozzle/project_setup.py | 4 +- examples/lsdyna_cylinder_plate/lsdyna_job.py | 4 +- .../mapdl_linked_analyses/project_setup.py | 4 +- .../mapdl_motorbike_frame/project_query.py | 4 +- .../mapdl_motorbike_frame/project_setup.py | 4 +- examples/mapdl_motorbike_frame/task_files.py | 4 +- .../mapdl_tyre_performance/project_setup.py | 4 +- .../python_linked_multi_process_step/eval.py | 1 - .../project_setup.py | 4 +- examples/python_multi_process_step/eval.py | 1 - .../project_setup.py | 4 +- .../python_multi_process_step/task_files.py | 3 +- .../project_setup.py | 4 +- generate_resources.py | 12 ++-- pyproject.toml | 6 +- src/ansys/hps/{client => core}/__init__.py | 0 src/ansys/hps/{client => core}/__version__.py | 2 +- .../hps/{client => core}/auth/__init__.py | 0 .../hps/{client => core}/auth/api/__init__.py | 0 .../hps/{client => core}/auth/api/auth_api.py | 12 ++-- .../hps/{client => core}/auth/authenticate.py | 0 .../auth/resource/__init__.py | 0 .../{client => core}/auth/resource/user.py | 2 +- .../{client => core}/auth/schema/__init__.py | 0 .../hps/{client => core}/auth/schema/user.py | 2 +- src/ansys/hps/{client => core}/client.py | 2 +- .../hps/{client => core}/common/__init__.py | 0 .../{client => core}/common/base_resource.py | 0 .../{client => core}/common/base_schema.py | 0 .../common/restricted_value.py | 0 src/ansys/hps/{client => core}/connection.py | 2 +- src/ansys/hps/{client => core}/exceptions.py | 4 +- .../hps/{client => core}/jms/__init__.py | 0 .../hps/{client => core}/jms/api/__init__.py | 0 .../hps/{client => core}/jms/api/base.py | 4 +- .../hps/{client => core}/jms/api/jms_api.py | 20 +++---- .../{client => core}/jms/api/project_api.py | 24 ++++---- src/ansys/hps/{client => core}/jms/keys.py | 0 .../{client => core}/jms/resource/.gitignore | 0 .../{client => core}/jms/resource/__init__.py | 0 .../jms/resource/algorithm.py | 2 +- .../jms/resource/evaluator.py | 2 +- .../hps/{client => core}/jms/resource/file.py | 2 +- .../jms/resource/fitness_definition.py | 4 +- .../hps/{client => core}/jms/resource/job.py | 2 +- .../jms/resource/job_definition.py | 2 +- .../jms/resource/license_context.py | 2 +- .../jms/resource/operation.py | 2 +- .../jms/resource/parameter_definition.py | 2 +- .../jms/resource/parameter_mapping.py | 2 +- .../jms/resource/permission.py | 2 +- .../{client => core}/jms/resource/project.py | 2 +- .../jms/resource/selection.py | 2 +- .../hps/{client => core}/jms/resource/task.py | 2 +- .../jms/resource/task_definition.py | 2 +- .../jms/resource/task_definition_template.py | 2 +- .../{client => core}/jms/schema/__init__.py | 0 .../{client => core}/jms/schema/algorithm.py | 2 +- .../{client => core}/jms/schema/evaluator.py | 2 +- .../hps/{client => core}/jms/schema/file.py | 2 +- .../jms/schema/fitness_definition.py | 2 +- .../hps/{client => core}/jms/schema/job.py | 2 +- .../jms/schema/job_definition.py | 2 +- .../jms/schema/license_context.py | 3 +- .../jms/schema/object_reference.py | 0 .../{client => core}/jms/schema/operation.py | 2 +- .../jms/schema/parameter_definition.py | 2 +- .../jms/schema/parameter_mapping.py | 2 +- .../{client => core}/jms/schema/permission.py | 2 +- .../{client => core}/jms/schema/project.py | 2 +- .../{client => core}/jms/schema/selection.py | 2 +- .../hps/{client => core}/jms/schema/task.py | 2 +- .../jms/schema/task_definition.py | 2 +- .../jms/schema/task_definition_template.py | 3 +- .../hps/{client => core}/rms/__init__.py | 0 .../hps/{client => core}/rms/api/base.py | 2 +- .../hps/{client => core}/rms/api/rms_api.py | 8 +-- src/ansys/hps/{client => core}/rms/models.py | 0 src/ansys/hps/{client => core}/warnings.py | 0 tests/auth/test_api.py | 4 +- tests/auth/test_authenticate.py | 2 +- tests/jms/test_algorithms.py | 4 +- tests/jms/test_files.py | 4 +- tests/jms/test_fitness_definition.py | 11 ++-- tests/jms/test_jms_api.py | 14 ++--- tests/jms/test_job_definitions.py | 4 +- tests/jms/test_jobs.py | 6 +- tests/jms/test_parameter_definitions.py | 6 +- tests/jms/test_project_permissions.py | 11 ++-- tests/jms/test_projects.py | 8 +-- tests/jms/test_resources.py | 2 +- tests/jms/test_task_definition.py | 6 +- tests/jms/test_task_definition_templates.py | 11 ++-- tests/jms/test_task_files.py | 5 +- tests/jms/test_tasks.py | 6 +- tests/rep_test.py | 6 +- tests/rms/test_api.py | 2 +- tests/rms/test_compute_resource_sets.py | 2 +- tests/rms/test_evaluators.py | 4 +- tests/rms/test_serialization.py | 4 +- tests/test_client.py | 2 +- tests/test_connection.py | 4 +- tests/test_examples.py | 9 +-- tests/test_exceptions.py | 4 +- 117 files changed, 246 insertions(+), 260 deletions(-) rename src/ansys/hps/{client => core}/__init__.py (100%) rename src/ansys/hps/{client => core}/__version__.py (96%) rename src/ansys/hps/{client => core}/auth/__init__.py (100%) rename src/ansys/hps/{client => core}/auth/api/__init__.py (100%) rename src/ansys/hps/{client => core}/auth/api/auth_api.py (94%) rename src/ansys/hps/{client => core}/auth/authenticate.py (100%) rename src/ansys/hps/{client => core}/auth/resource/__init__.py (100%) rename src/ansys/hps/{client => core}/auth/resource/user.py (98%) rename src/ansys/hps/{client => core}/auth/schema/__init__.py (100%) rename src/ansys/hps/{client => core}/auth/schema/user.py (96%) rename src/ansys/hps/{client => core}/client.py (99%) rename src/ansys/hps/{client => core}/common/__init__.py (100%) rename src/ansys/hps/{client => core}/common/base_resource.py (100%) rename src/ansys/hps/{client => core}/common/base_schema.py (100%) rename src/ansys/hps/{client => core}/common/restricted_value.py (100%) rename src/ansys/hps/{client => core}/connection.py (97%) rename src/ansys/hps/{client => core}/exceptions.py (97%) rename src/ansys/hps/{client => core}/jms/__init__.py (100%) rename src/ansys/hps/{client => core}/jms/api/__init__.py (100%) rename src/ansys/hps/{client => core}/jms/api/base.py (98%) rename src/ansys/hps/{client => core}/jms/api/jms_api.py (95%) rename src/ansys/hps/{client => core}/jms/api/project_api.py (96%) rename src/ansys/hps/{client => core}/jms/keys.py (100%) rename src/ansys/hps/{client => core}/jms/resource/.gitignore (100%) rename src/ansys/hps/{client => core}/jms/resource/__init__.py (100%) rename src/ansys/hps/{client => core}/jms/resource/algorithm.py (98%) rename src/ansys/hps/{client => core}/jms/resource/evaluator.py (99%) rename src/ansys/hps/{client => core}/jms/resource/file.py (99%) rename src/ansys/hps/{client => core}/jms/resource/fitness_definition.py (97%) rename src/ansys/hps/{client => core}/jms/resource/job.py (99%) rename src/ansys/hps/{client => core}/jms/resource/job_definition.py (98%) rename src/ansys/hps/{client => core}/jms/resource/license_context.py (97%) rename src/ansys/hps/{client => core}/jms/resource/operation.py (98%) rename src/ansys/hps/{client => core}/jms/resource/parameter_definition.py (99%) rename src/ansys/hps/{client => core}/jms/resource/parameter_mapping.py (98%) rename src/ansys/hps/{client => core}/jms/resource/permission.py (97%) rename src/ansys/hps/{client => core}/jms/resource/project.py (98%) rename src/ansys/hps/{client => core}/jms/resource/selection.py (98%) rename src/ansys/hps/{client => core}/jms/resource/task.py (99%) rename src/ansys/hps/{client => core}/jms/resource/task_definition.py (99%) rename src/ansys/hps/{client => core}/jms/resource/task_definition_template.py (99%) rename src/ansys/hps/{client => core}/jms/schema/__init__.py (100%) rename src/ansys/hps/{client => core}/jms/schema/algorithm.py (96%) rename src/ansys/hps/{client => core}/jms/schema/evaluator.py (98%) rename src/ansys/hps/{client => core}/jms/schema/file.py (97%) rename src/ansys/hps/{client => core}/jms/schema/fitness_definition.py (98%) rename src/ansys/hps/{client => core}/jms/schema/job.py (98%) rename src/ansys/hps/{client => core}/jms/schema/job_definition.py (97%) rename src/ansys/hps/{client => core}/jms/schema/license_context.py (95%) rename src/ansys/hps/{client => core}/jms/schema/object_reference.py (100%) rename src/ansys/hps/{client => core}/jms/schema/operation.py (97%) rename src/ansys/hps/{client => core}/jms/schema/parameter_definition.py (98%) rename src/ansys/hps/{client => core}/jms/schema/parameter_mapping.py (97%) rename src/ansys/hps/{client => core}/jms/schema/permission.py (97%) rename src/ansys/hps/{client => core}/jms/schema/project.py (97%) rename src/ansys/hps/{client => core}/jms/schema/selection.py (96%) rename src/ansys/hps/{client => core}/jms/schema/task.py (98%) rename src/ansys/hps/{client => core}/jms/schema/task_definition.py (98%) rename src/ansys/hps/{client => core}/jms/schema/task_definition_template.py (98%) rename src/ansys/hps/{client => core}/rms/__init__.py (100%) rename src/ansys/hps/{client => core}/rms/api/base.py (99%) rename src/ansys/hps/{client => core}/rms/api/rms_api.py (96%) rename src/ansys/hps/{client => core}/rms/models.py (100%) rename src/ansys/hps/{client => core}/warnings.py (100%) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index f823b6a45..e6f51f080 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -12,7 +12,7 @@ env: MAIN_PYTHON_VERSION: '3.9' DOC_PYTHON_VERSION: '3.9' DOCUMENTATION_CNAME: 'hps.docs.pyansys.com' - PACKAGE_NAME: 'ansys-pyhps' + PACKAGE_NAME: 'ansys-hps-core' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -242,7 +242,7 @@ jobs: steps: - uses: actions/download-artifact@v3 with: - name: ansys-pyhps-artifacts + name: ansys-hps-core-artifacts path: /tmp/artifacts - name: List artifacts diff --git a/README.rst b/README.rst index ddd11929d..7b7e2b4e1 100644 --- a/README.rst +++ b/README.rst @@ -6,16 +6,16 @@ PyHPS :target: https://docs.pyansys.com/ :alt: PyAnsys -.. |python| image:: https://img.shields.io/pypi/pyversions/ansys-pyhps?logo=pypi - :target: https://pypi.org/project/ansys-pyhps +.. |python| image:: https://img.shields.io/pypi/pyversions/ansys-hps-core?logo=pypi + :target: https://pypi.org/project/ansys-hps-core :alt: Python -.. |pypi| image:: https://img.shields.io/pypi/v/ansys-pyhps.svg?logo=python&logoColor=white - :target: https://pypi.org/project/ansys-pyhps +.. |pypi| image:: https://img.shields.io/pypi/v/ansys-hps-core.svg?logo=python&logoColor=white + :target: https://pypi.org/project/ansys-hps-core :alt: PyPI .. |codecov| image:: https://codecov.io/gh/ansys-internal/pyhps/branch/main/graph/badge.svg - :target: https://codecov.io/gh/ansys-internal/ansys-pyhps + :target: https://codecov.io/gh/ansys-internal/ansys-hps-core :alt: Codecov .. |GH-CI| image:: https://github.com/ansys-internal/pyhps/actions/workflows/ci_cd.yml/badge.svg @@ -49,7 +49,7 @@ Then, as long as PyHPS is a private pyAnsys module not published to pypi yet, yo python -m pip install git+https://github.com/ansys-internal/pyhps -.. TODO: Enable this once pyhps is published: python -m pip install ansys-pyhps +.. TODO: Enable this once pyhps is published: python -m pip install ansys-hps-core Contribute ---------- diff --git a/doc/source/api/auth.rst b/doc/source/api/auth.rst index 7ba80a52e..c30fbe12d 100644 --- a/doc/source/api/auth.rst +++ b/doc/source/api/auth.rst @@ -6,20 +6,20 @@ Authentication service The REP Authentication Service processes all REP sign ins following Open Authorization (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.core.auth`` subpackage wraps around the Authentication Service REST API available at ``https://hostname:port/rep/auth/api``. Authentication function ----------------------- -.. autofunction:: ansys.hps.client.auth.authenticate +.. autofunction:: ansys.hps.core.auth.authenticate Auth API -------- -.. autoclass:: ansys.hps.client.auth.AuthApi +.. autoclass:: ansys.hps.core.auth.AuthApi :members: User ---- -.. autoclass:: ansys.hps.client.auth.User +.. autoclass:: ansys.hps.core.auth.User :members: \ No newline at end of file diff --git a/doc/source/api/client.rst b/doc/source/api/client.rst index 5db948005..d95d0467f 100644 --- a/doc/source/api/client.rst +++ b/doc/source/api/client.rst @@ -4,11 +4,11 @@ Client Connection module ------------------------------------------ -.. automodule:: ansys.hps.client.connection +.. automodule:: ansys.hps.core.connection :members: Client object ------------------------------------ -.. autoclass:: ansys.hps.client.Client +.. autoclass:: ansys.hps.core.Client :members: \ No newline at end of file diff --git a/doc/source/api/exceptions.rst b/doc/source/api/exceptions.rst index 9abb82310..eead18b4e 100644 --- a/doc/source/api/exceptions.rst +++ b/doc/source/api/exceptions.rst @@ -3,13 +3,13 @@ Exceptions HTTP requests returning an unsuccessful status code raise: -* :exc:`ansys.hps.client.ClientError` for client errors (4xx status code. For example, bad syntax or not found) -* :exc:`ansys.hps.client.APIError` for server errors (5xx status code. For example, internal server error or not implemented) +* :exc:`ansys.hps.core.ClientError` for client errors (4xx status code. For example, bad syntax or not found) +* :exc:`ansys.hps.core.APIError` for server errors (5xx status code. For example, internal server error or not implemented) -All exceptions that the Ansys REP clients explicitly raise inherit from :exc:`ansys.hps.client.HPSError`. +All exceptions that the Ansys REP clients explicitly raise inherit from :exc:`ansys.hps.core.HPSError`. -.. autoexception:: ansys.hps.client.HPSError +.. autoexception:: ansys.hps.core.HPSError :members: -.. autoexception:: ansys.hps.client.APIError -.. autoexception:: ansys.hps.client.ClientError \ No newline at end of file +.. autoexception:: ansys.hps.core.APIError +.. autoexception:: ansys.hps.core.ClientError \ No newline at end of file diff --git a/doc/source/api/jms.rst b/doc/source/api/jms.rst index afaa79586..05e864d6f 100644 --- a/doc/source/api/jms.rst +++ b/doc/source/api/jms.rst @@ -3,20 +3,20 @@ 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.core.jms`` wraps around the JMS service REST API available at ``https://hostname:port/rep/jms/api``. APIs ---- JMS API ^^^^^^^ -.. autoclass:: ansys.hps.client.jms.JmsApi +.. autoclass:: ansys.hps.core.jms.JmsApi :members: :undoc-members: Project API ^^^^^^^^^^^ -.. autoclass:: ansys.hps.client.jms.ProjectApi +.. autoclass:: ansys.hps.core.jms.ProjectApi :members: :undoc-members: @@ -27,13 +27,13 @@ Resources File ^^^^ -.. autoclass:: ansys.hps.client.jms.File +.. autoclass:: ansys.hps.core.jms.File :members: Project ^^^^^^^ -.. autoclass:: ansys.hps.client.jms.Project +.. autoclass:: ansys.hps.core.jms.Project :members: :undoc-members: :exclude-members: Meta @@ -41,54 +41,54 @@ Project Fitness definition ^^^^^^^^^^^^^^^^^^ -.. autoclass:: ansys.hps.client.jms.FitnessTermDefinition +.. autoclass:: ansys.hps.core.jms.FitnessTermDefinition :members: -.. autoclass:: ansys.hps.client.jms.FitnessDefinition +.. autoclass:: ansys.hps.core.jms.FitnessDefinition :members: Parameters ^^^^^^^^^^ -.. autoclass:: ansys.hps.client.jms.FloatParameterDefinition +.. autoclass:: ansys.hps.core.jms.FloatParameterDefinition :members: -.. autoclass:: ansys.hps.client.jms.BoolParameterDefinition +.. autoclass:: ansys.hps.core.jms.BoolParameterDefinition :members: -.. autoclass:: ansys.hps.client.jms.IntParameterDefinition +.. autoclass:: ansys.hps.core.jms.IntParameterDefinition :members: -.. autoclass:: ansys.hps.client.jms.StringParameterDefinition +.. autoclass:: ansys.hps.core.jms.StringParameterDefinition :members: -.. autoclass:: ansys.hps.client.jms.ParameterMapping +.. autoclass:: ansys.hps.core.jms.ParameterMapping :members: Task definition ^^^^^^^^^^^^^^^ -.. autoclass:: ansys.hps.client.jms.Software +.. autoclass:: ansys.hps.core.jms.Software :members: -.. autoclass:: ansys.hps.client.jms.ResourceRequirements +.. autoclass:: ansys.hps.core.jms.ResourceRequirements :members: -.. autoclass:: ansys.hps.client.jms.SuccessCriteria +.. autoclass:: ansys.hps.core.jms.SuccessCriteria :members: -.. autoclass:: ansys.hps.client.jms.Licensing +.. autoclass:: ansys.hps.core.jms.Licensing :members: -.. autoclass:: ansys.hps.client.jms.TaskDefinition +.. autoclass:: ansys.hps.core.jms.TaskDefinition :members: Job definition ^^^^^^^^^^^^^^ -.. autoclass:: ansys.hps.client.jms.JobDefinition +.. autoclass:: ansys.hps.core.jms.JobDefinition :members: :undoc-members: :exclude-members: Meta @@ -96,58 +96,58 @@ Job definition Task ^^^^ -.. autoclass:: ansys.hps.client.jms.Task +.. autoclass:: ansys.hps.core.jms.Task :members: Job ^^^ -.. autoclass:: ansys.hps.client.jms.Job +.. autoclass:: ansys.hps.core.jms.Job :members: Job selection ^^^^^^^^^^^^^ -.. autoclass:: ansys.hps.client.jms.JobSelection +.. autoclass:: ansys.hps.core.jms.JobSelection :members: Design exploration algorithm ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. autoclass:: ansys.hps.client.jms.Algorithm +.. autoclass:: ansys.hps.core.jms.Algorithm :members: Evaluator ^^^^^^^^^ -.. autoclass:: ansys.hps.client.jms.Evaluator +.. autoclass:: ansys.hps.core.jms.Evaluator :members: Task definition template ^^^^^^^^^^^^^^^^^^^^^^^^ -.. autoclass:: ansys.hps.client.jms.TemplateProperty +.. autoclass:: ansys.hps.core.jms.TemplateProperty :members: -.. autoclass:: ansys.hps.client.jms.TemplateResourceRequirements +.. autoclass:: ansys.hps.core.jms.TemplateResourceRequirements :members: -.. autoclass:: ansys.hps.client.jms.TemplateInputFile +.. autoclass:: ansys.hps.core.jms.TemplateInputFile :members: -.. autoclass:: ansys.hps.client.jms.TemplateOutputFile +.. autoclass:: ansys.hps.core.jms.TemplateOutputFile :members: -.. autoclass:: ansys.hps.client.jms.TaskDefinitionTemplate +.. autoclass:: ansys.hps.core.jms.TaskDefinitionTemplate :members: Permissions ^^^^^^^^^^^ -.. autoclass:: ansys.hps.client.jms.Permission +.. autoclass:: ansys.hps.core.jms.Permission :members: \ No newline at end of file diff --git a/doc/source/api/rms.rst b/doc/source/api/rms.rst index 3b51973ef..86a0c2e82 100644 --- a/doc/source/api/rms.rst +++ b/doc/source/api/rms.rst @@ -3,14 +3,14 @@ Resource management service Ansys REP includes the Resource Management Service (RMS), 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.core.rms`` wraps around the RMS service REST API available at ``https://hostname:port/rep/rms/api``. APIs -------------------------------------- RMS API ^^^^^^^ -.. autoclass:: ansys.hps.client.rms.RmsApi +.. autoclass:: ansys.hps.core.rms.RmsApi :members: :undoc-members: @@ -21,24 +21,24 @@ Resources Evaluator registration ^^^^^^^^^^^^^^^^^^^^^^ -.. autopydantic_model:: ansys.hps.client.rms.EvaluatorRegistration +.. autopydantic_model:: ansys.hps.core.rms.EvaluatorRegistration Evaluator configuration ^^^^^^^^^^^^^^^^^^^^^^^ -.. autopydantic_model:: ansys.hps.client.rms.EvaluatorConfiguration +.. autopydantic_model:: ansys.hps.core.rms.EvaluatorConfiguration Evaluator configuration update ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. autopydantic_model:: ansys.hps.client.rms.EvaluatorConfigurationUpdate +.. autopydantic_model:: ansys.hps.core.rms.EvaluatorConfigurationUpdate Scaler configuration ^^^^^^^^^^^^^^^^^^^^ -.. autopydantic_model:: ansys.hps.client.rms.ScalerRegistration +.. autopydantic_model:: ansys.hps.core.rms.ScalerRegistration Compute resource set ^^^^^^^^^^^^^^^^^^^^ -.. autopydantic_model:: ansys.hps.client.rms.ComputeResourceSet +.. autopydantic_model:: ansys.hps.core.rms.ComputeResourceSet diff --git a/doc/source/conf.py b/doc/source/conf.py index 1fcdf3e0f..3e8b4f231 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -6,7 +6,7 @@ from ansys_sphinx_theme import get_version_match from ansys_sphinx_theme import pyansys_logo_black as logo -from ansys.hps.client import __ansys_apps_version__, __version__ +from ansys.hps.core import __ansys_apps_version__, __version__ sys.path.append(os.path.abspath(os.path.dirname(__file__))) @@ -179,7 +179,7 @@ latex_documents = [ ( "index", - "ansys-pyhps.tex", + "ansys-hps-core.tex", "Ansys HPS Python Client Documentation", author, "manual", @@ -211,7 +211,9 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [("index", "ansys-pyhps", "Ansys HPS Python Client Documentation", ["ANSYS, Inc."], 1)] +man_pages = [ + ("index", "ansys-hps-core", "Ansys HPS Python Client Documentation", ["ANSYS, Inc."], 1) +] # If true, show URL addresses after external links. # man_show_urls = False @@ -225,7 +227,7 @@ # texinfo_documents = [ # ( # "index", -# "ansys-pyhps", +# "ansys-hps-core", # "Ansys HPS Python Client Documentation", # "ANSYS, Inc.", # "JMS", diff --git a/doc/source/examples/index.rst b/doc/source/examples/index.rst index 5bda0982e..853552c21 100644 --- a/doc/source/examples/index.rst +++ b/doc/source/examples/index.rst @@ -3,7 +3,7 @@ Examples ======== -Here you can find some examples showing how to interact with a REP server in Python using the ``ansys-pyhps``. +Here you can find some examples showing how to interact with a REP server in Python using the ``ansys-hps-core``. Examples consist of a Python script plus some data files (e.g. solver input files). Many of the Python scripts can be executed with the following command line arguments: diff --git a/doc/source/index.rst b/doc/source/index.rst index b2cb7e475..0a73a061f 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -15,7 +15,7 @@ Introduction Ansys HPC Platform Services (HPS) is a set of technology components designed to help you manage the execution of simulations while making use of your full range of computing assets. -``ansys-pyhps`` brings Ansys HPS to your Python application. +``ansys-hps-core`` brings Ansys HPS to your Python application. Wrapping around the HPS REST APIs, it allows you to: * create new projects and modify existing ones diff --git a/doc/source/quickstart.rst b/doc/source/quickstart.rst index 95d6971d9..9a18a8e3c 100644 --- a/doc/source/quickstart.rst +++ b/doc/source/quickstart.rst @@ -9,7 +9,7 @@ while detailed documentation can be found in the :ref:`Code documentation `_ for instructions. -- A Python shell with ``ansys-pyhps`` installed. If you haven't installed it yet, please refer to the :ref:`Installation ` guide. +- A Python shell with ``ansys-hps-core`` installed. If you haven't installed it yet, please refer to the :ref:`Installation ` guide. Connect to HPC platform services @@ -19,8 +19,8 @@ Start by connecting to an HPS deployment running on the localhost with default u .. code-block:: python - from ansys.hps.client import Client - from ansys.hps.client.jms import JmsApi, ProjectApi + from ansys.hps.core import Client + from ansys.hps.core.jms import JmsApi, ProjectApi client = Client(url="https://localhost:8443/rep", username="repuser", password="repuser") @@ -283,8 +283,8 @@ Admin users with the Keycloak "manage-users" role can create new users as well a .. code-block:: python - from ansys.hps.client import Client - from ansys.hps.client.auth import AuthApi, User + from ansys.hps.core import Client + from ansys.hps.core.auth import AuthApi, User client = Client(url="https://localhost:8443/rep/", username="repadmin", password="repadmin") auth_api = AuthApi(client) @@ -311,14 +311,14 @@ Admin users with the Keycloak "manage-users" role can create new users as well a Exception handling ------------------------------------------ -All exceptions that the Ansys REP client explicitly raise inherit from :exc:`ansys.hps.client.HPSError`. +All exceptions that the Ansys REP client explicitly raise inherit from :exc:`ansys.hps.core.HPSError`. Client Errors are raised for 4xx HTTP status codes, while API Errors are raised for 5xx HTTP status codes (server side errors). For example, instantiating a client with invalid credentials returns a 401 Client Error. .. code-block:: python - from ansys.hps.client import Client, HPSError + from ansys.hps.core import Client, HPSError try: client = Client(url="https://localhost:8443/rep/", username="repuser", password="wrong_psw") @@ -333,7 +333,7 @@ A *get* call on a non-existing resource returns a 404 Client Error. .. code-block:: python - from ansys.hps.client.jms import JmsApi + from ansys.hps.core.jms import JmsApi jms_api = JmsApi(client) try: diff --git a/examples/cfx_static_mixer/project_setup.py b/examples/cfx_static_mixer/project_setup.py index 8413044a8..a5f8a47d4 100644 --- a/examples/cfx_static_mixer/project_setup.py +++ b/examples/cfx_static_mixer/project_setup.py @@ -27,8 +27,8 @@ import logging import os -from ansys.hps.client import Client, HPSError, __ansys_apps_version__ -from ansys.hps.client.jms import ( +from ansys.hps.core import Client, HPSError, __ansys_apps_version__ +from ansys.hps.core.jms import ( File, JmsApi, Job, diff --git a/examples/fluent_2d_heat_exchanger/project_setup.py b/examples/fluent_2d_heat_exchanger/project_setup.py index 71ca335fd..aa4ec3cbf 100644 --- a/examples/fluent_2d_heat_exchanger/project_setup.py +++ b/examples/fluent_2d_heat_exchanger/project_setup.py @@ -28,8 +28,8 @@ import logging import os -from ansys.hps.client import Client, HPSError, __ansys_apps_version__ -from ansys.hps.client.jms import ( +from ansys.hps.core import Client, HPSError, __ansys_apps_version__ +from ansys.hps.core.jms import ( File, JmsApi, Job, diff --git a/examples/fluent_nozzle/project_setup.py b/examples/fluent_nozzle/project_setup.py index 6d8e6e2c9..403efe3fc 100644 --- a/examples/fluent_nozzle/project_setup.py +++ b/examples/fluent_nozzle/project_setup.py @@ -27,8 +27,8 @@ import logging import os -from ansys.hps.client import Client, HPSError, __ansys_apps_version__ -from ansys.hps.client.jms import ( +from ansys.hps.core import Client, HPSError, __ansys_apps_version__ +from ansys.hps.core.jms import ( File, JmsApi, Job, diff --git a/examples/lsdyna_cylinder_plate/lsdyna_job.py b/examples/lsdyna_cylinder_plate/lsdyna_job.py index 4edde6b38..cf27e9324 100644 --- a/examples/lsdyna_cylinder_plate/lsdyna_job.py +++ b/examples/lsdyna_cylinder_plate/lsdyna_job.py @@ -45,8 +45,8 @@ import os import time -from ansys.hps.client import Client, HPSError -from ansys.hps.client.jms import ( +from ansys.hps.core import Client, HPSError +from ansys.hps.core.jms import ( File, JmsApi, Job, diff --git a/examples/mapdl_linked_analyses/project_setup.py b/examples/mapdl_linked_analyses/project_setup.py index 8c36bb0c2..dbec5b8a2 100644 --- a/examples/mapdl_linked_analyses/project_setup.py +++ b/examples/mapdl_linked_analyses/project_setup.py @@ -46,8 +46,8 @@ import os from typing import List, Tuple -from ansys.hps.client import Client, HPSError, __ansys_apps_version__ -from ansys.hps.client.jms import ( +from ansys.hps.core import Client, HPSError, __ansys_apps_version__ +from ansys.hps.core.jms import ( File, JmsApi, Job, diff --git a/examples/mapdl_motorbike_frame/project_query.py b/examples/mapdl_motorbike_frame/project_query.py index 78bc33356..ed832f077 100644 --- a/examples/mapdl_motorbike_frame/project_query.py +++ b/examples/mapdl_motorbike_frame/project_query.py @@ -32,8 +32,8 @@ import os from statistics import mean, stdev -from ansys.hps.client import Client, HPSError -from ansys.hps.client.jms import JmsApi, ProjectApi +from ansys.hps.core import Client, HPSError +from ansys.hps.core.jms import JmsApi, ProjectApi log = logging.getLogger(__name__) diff --git a/examples/mapdl_motorbike_frame/project_setup.py b/examples/mapdl_motorbike_frame/project_setup.py index 9b28dca12..c0dce02fc 100644 --- a/examples/mapdl_motorbike_frame/project_setup.py +++ b/examples/mapdl_motorbike_frame/project_setup.py @@ -31,8 +31,8 @@ import os import random -from ansys.hps.client import Client, HPSError, __ansys_apps_version__ -from ansys.hps.client.jms import ( +from ansys.hps.core import Client, HPSError, __ansys_apps_version__ +from ansys.hps.core.jms import ( File, FitnessDefinition, FloatParameterDefinition, diff --git a/examples/mapdl_motorbike_frame/task_files.py b/examples/mapdl_motorbike_frame/task_files.py index 9215d3fa9..18396a312 100644 --- a/examples/mapdl_motorbike_frame/task_files.py +++ b/examples/mapdl_motorbike_frame/task_files.py @@ -25,8 +25,8 @@ import logging import os -from ansys.hps.client import HPSError -from ansys.hps.client.jms import Client, File +from ansys.hps.core import HPSError +from ansys.hps.core.jms import Client, File log = logging.getLogger(__name__) diff --git a/examples/mapdl_tyre_performance/project_setup.py b/examples/mapdl_tyre_performance/project_setup.py index 9d4001b29..82b10a378 100644 --- a/examples/mapdl_tyre_performance/project_setup.py +++ b/examples/mapdl_tyre_performance/project_setup.py @@ -32,8 +32,8 @@ import os import random -from ansys.hps.client import Client, HPSError, __ansys_apps_version__ -from ansys.hps.client.jms import ( +from ansys.hps.core import Client, HPSError, __ansys_apps_version__ +from ansys.hps.core.jms import ( File, FloatParameterDefinition, JmsApi, diff --git a/examples/python_linked_multi_process_step/eval.py b/examples/python_linked_multi_process_step/eval.py index 2b5eab204..76d1d506b 100644 --- a/examples/python_linked_multi_process_step/eval.py +++ b/examples/python_linked_multi_process_step/eval.py @@ -1,4 +1,3 @@ -# Copyright (C) 2021 by # Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # diff --git a/examples/python_linked_multi_process_step/project_setup.py b/examples/python_linked_multi_process_step/project_setup.py index 1c958bd14..a57e3ab94 100644 --- a/examples/python_linked_multi_process_step/project_setup.py +++ b/examples/python_linked_multi_process_step/project_setup.py @@ -30,8 +30,8 @@ import os import random -from ansys.hps.client import Client, HPSError -from ansys.hps.client.jms import ( +from ansys.hps.core import Client, HPSError +from ansys.hps.core.jms import ( File, FloatParameterDefinition, JmsApi, diff --git a/examples/python_multi_process_step/eval.py b/examples/python_multi_process_step/eval.py index b7fb25b3f..bd6958076 100644 --- a/examples/python_multi_process_step/eval.py +++ b/examples/python_multi_process_step/eval.py @@ -1,4 +1,3 @@ -# Copyright (C) 2021 by # Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # diff --git a/examples/python_multi_process_step/project_setup.py b/examples/python_multi_process_step/project_setup.py index 2a33295ca..b950285b8 100644 --- a/examples/python_multi_process_step/project_setup.py +++ b/examples/python_multi_process_step/project_setup.py @@ -47,8 +47,8 @@ import os import random -from ansys.hps.client import Client, HPSError -from ansys.hps.client.jms import ( +from ansys.hps.core import Client, HPSError +from ansys.hps.core.jms import ( File, IntParameterDefinition, JmsApi, diff --git a/examples/python_multi_process_step/task_files.py b/examples/python_multi_process_step/task_files.py index 2e544f13c..e966545a9 100644 --- a/examples/python_multi_process_step/task_files.py +++ b/examples/python_multi_process_step/task_files.py @@ -1,4 +1,3 @@ -# Copyright (C) 2021 by # Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # @@ -33,7 +32,7 @@ import os from tempfile import NamedTemporaryFile -from ansys.hps.client.jms import File +from ansys.hps.core.jms import File log = logging.getLogger(__name__) diff --git a/examples/python_two_bar_truss_problem/project_setup.py b/examples/python_two_bar_truss_problem/project_setup.py index 7614e128d..0db1872f5 100644 --- a/examples/python_two_bar_truss_problem/project_setup.py +++ b/examples/python_two_bar_truss_problem/project_setup.py @@ -29,8 +29,8 @@ import os import random -from ansys.hps.client import Client, HPSError -from ansys.hps.client.jms import ( +from ansys.hps.core import Client, HPSError +from ansys.hps.core.jms import ( File, FitnessDefinition, FloatParameterDefinition, diff --git a/generate_resources.py b/generate_resources.py index 75ca5bdd8..aea43d59b 100644 --- a/generate_resources.py +++ b/generate_resources.py @@ -31,8 +31,8 @@ import marshmallow -from ansys.hps.client.common.restricted_value import RestrictedValue -from ansys.hps.client.jms.schema.object_reference import IdReference, IdReferenceList +from ansys.hps.core.common.restricted_value import RestrictedValue +from ansys.hps.core.jms.schema.object_reference import IdReference, IdReferenceList # we define here which resources to auto-generate # some are excluded or done only partially (e.g. File) @@ -394,7 +394,7 @@ def get_resource_imports(resource, base_class): imports = [ "from marshmallow.utils import missing", - "from ansys.hps.client.common import Object", + "from ansys.hps.core.common import Object", # f"from {base_class['path']}.{base_class['filename']} import {base_class['name']}", f"from ..schema.{resource['schema_filename']} import {resource['schema']}", ] @@ -438,7 +438,7 @@ def __init__(self, return code -def process_resources(subpackage, resources, base_class_path="ansys.hps.client"): +def process_resources(subpackage, resources, base_class_path="ansys.hps.core"): target_folder = os.path.join("ansys", "hps", "client", subpackage, "resource") resources_code = {} @@ -447,7 +447,7 @@ def process_resources(subpackage, resources, base_class_path="ansys.hps.client") # dynamically load resource schema module = importlib.import_module( - f"ansys.hps.client.{subpackage}.schema.{resource['schema_filename']}" + f"ansys.hps.core.{subpackage}.schema.{resource['schema_filename']}" ) resource_class = getattr(module, resource["schema"]) @@ -465,7 +465,7 @@ def process_resources(subpackage, resources, base_class_path="ansys.hps.client") base_class = {"name": "Object", "filename": "common", "path": base_class_path} if resource.get("base_class", None): base_class["name"] = resource["base_class"] - base_class["path"] = "ansys.hps.client.jms.resource" + base_class["path"] = "ansys.hps.core.jms.resource" base_class["filename"] = next( (r["resource_filename"] for r in resources if r["class"] == resource["base_class"]), None, diff --git a/pyproject.toml b/pyproject.toml index 6d67def9b..fb3d0051f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi" [project] # Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections -name = "ansys-pyhps" +name = "ansys-hps-core" version = "0.6.dev0" description = "A python client for Ansys HPC Platform Services" readme = "README.rst" @@ -71,7 +71,7 @@ Homepage = "https://github.com/ansys-internal/pyhps" Tracker = "https://github.com/ansys-internal/pyhps/issues" [tool.flit.module] -name = "ansys.hps.client" +name = "ansys.hps.core" [tool.black] line-length = 100 @@ -109,5 +109,5 @@ markers = [ filterwarnings = [ "ignore::urllib3.exceptions.InsecureRequestWarning", "ignore::DeprecationWarning:pkg_resources.*", - "ignore::ansys.hps.client.UnverifiedHTTPSRequestsWarning", + "ignore::ansys.hps.core.UnverifiedHTTPSRequestsWarning", ] \ No newline at end of file diff --git a/src/ansys/hps/client/__init__.py b/src/ansys/hps/core/__init__.py similarity index 100% rename from src/ansys/hps/client/__init__.py rename to src/ansys/hps/core/__init__.py diff --git a/src/ansys/hps/client/__version__.py b/src/ansys/hps/core/__version__.py similarity index 96% rename from src/ansys/hps/client/__version__.py rename to src/ansys/hps/core/__version__.py index 1927a8591..b75fb6a39 100644 --- a/src/ansys/hps/client/__version__.py +++ b/src/ansys/hps/core/__version__.py @@ -27,7 +27,7 @@ # Read from the pyproject.toml # major, minor, patch -__version__ = importlib_metadata.version("ansys-pyhps") +__version__ = importlib_metadata.version("ansys-hps-core") # this is only a convenience to default the version # of Ansys simulation applications in pyhps examples diff --git a/src/ansys/hps/client/auth/__init__.py b/src/ansys/hps/core/auth/__init__.py similarity index 100% rename from src/ansys/hps/client/auth/__init__.py rename to src/ansys/hps/core/auth/__init__.py diff --git a/src/ansys/hps/client/auth/api/__init__.py b/src/ansys/hps/core/auth/api/__init__.py similarity index 100% rename from src/ansys/hps/client/auth/api/__init__.py rename to src/ansys/hps/core/auth/api/__init__.py diff --git a/src/ansys/hps/client/auth/api/auth_api.py b/src/ansys/hps/core/auth/api/auth_api.py similarity index 94% rename from src/ansys/hps/client/auth/api/auth_api.py rename to src/ansys/hps/core/auth/api/auth_api.py index 442c98327..eaad96b47 100644 --- a/src/ansys/hps/client/auth/api/auth_api.py +++ b/src/ansys/hps/core/auth/api/auth_api.py @@ -46,8 +46,8 @@ class AuthApi: Get users whose first name contains "john": - >>> from ansys.hps.client import Client - >>> from ansys.hps.client.auth import AuthApi, User + >>> from ansys.hps.core import Client + >>> from ansys.hps.core.auth import AuthApi, User >>> cl = Client( ... url="https://127.0.0.1:8443/rep/", username="repadmin", password="repadmin" ... ) @@ -111,7 +111,7 @@ def get_user_realm_roles(self, id: str) -> List[str]: def user_is_admin(self, id: str) -> bool: """Check whether the user is system admin""" - from ansys.hps.client.jms import JmsApi + from ansys.hps.core.jms import JmsApi # the admin keys are configurable settings of JMS # they need to be queried, can't be hardcoded @@ -134,7 +134,7 @@ def create_user(self, user: User, as_objects=True) -> User: """Create a new user. Args: - user (:class:`ansys.hps.client.auth.User`): A User object. Defaults to None. + user (:class:`ansys.hps.core.auth.User`): A User object. Defaults to None. as_objects (bool, optional): Defaults to True. """ return create_user(self.keycloak_admin_client, user, as_objects=as_objects) @@ -143,7 +143,7 @@ def update_user(self, user: User, as_objects=True) -> User: """Modify an existing user. Args: - user (:class:`ansys.hps.client.auth.User`): A User object. Defaults to None. + user (:class:`ansys.hps.core.auth.User`): A User object. Defaults to None. as_objects (bool, optional): Defaults to True. """ return update_user(self.keycloak_admin_client, user, as_objects=as_objects) @@ -152,7 +152,7 @@ def delete_user(self, user: User) -> None: """Delete an existing user. Args: - user (:class:`ansys.hps.client.auth.User`): A User object. Defaults to None. + user (:class:`ansys.hps.core.auth.User`): A User object. Defaults to None. """ return self.keycloak_admin_client.delete_user(user.id) diff --git a/src/ansys/hps/client/auth/authenticate.py b/src/ansys/hps/core/auth/authenticate.py similarity index 100% rename from src/ansys/hps/client/auth/authenticate.py rename to src/ansys/hps/core/auth/authenticate.py diff --git a/src/ansys/hps/client/auth/resource/__init__.py b/src/ansys/hps/core/auth/resource/__init__.py similarity index 100% rename from src/ansys/hps/client/auth/resource/__init__.py rename to src/ansys/hps/core/auth/resource/__init__.py diff --git a/src/ansys/hps/client/auth/resource/user.py b/src/ansys/hps/core/auth/resource/user.py similarity index 98% rename from src/ansys/hps/client/auth/resource/user.py rename to src/ansys/hps/core/auth/resource/user.py index fe5f6dfa4..00c64e929 100644 --- a/src/ansys/hps/client/auth/resource/user.py +++ b/src/ansys/hps/core/auth/resource/user.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.user import UserSchema diff --git a/src/ansys/hps/client/auth/schema/__init__.py b/src/ansys/hps/core/auth/schema/__init__.py similarity index 100% rename from src/ansys/hps/client/auth/schema/__init__.py rename to src/ansys/hps/core/auth/schema/__init__.py diff --git a/src/ansys/hps/client/auth/schema/user.py b/src/ansys/hps/core/auth/schema/user.py similarity index 96% rename from src/ansys/hps/client/auth/schema/user.py rename to src/ansys/hps/core/auth/schema/user.py index a2bcbc278..e39d79e2b 100644 --- a/src/ansys/hps/client/auth/schema/user.py +++ b/src/ansys/hps/core/auth/schema/user.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.client.common.base_schema import BaseSchema +from ansys.hps.core.common.base_schema import BaseSchema class UserSchema(BaseSchema): diff --git a/src/ansys/hps/client/client.py b/src/ansys/hps/core/client.py similarity index 99% rename from src/ansys/hps/client/client.py rename to src/ansys/hps/core/client.py index cbbd205ca..140994ea4 100644 --- a/src/ansys/hps/client/client.py +++ b/src/ansys/hps/core/client.py @@ -83,7 +83,7 @@ class Client(object): Create client object and connect to HPS with username and password - >>> from ansys.hps.client import Client + >>> from ansys.hps.core import Client >>> cl = Client( ... url="https://localhost:8443/rep", ... username="repuser", diff --git a/src/ansys/hps/client/common/__init__.py b/src/ansys/hps/core/common/__init__.py similarity index 100% rename from src/ansys/hps/client/common/__init__.py rename to src/ansys/hps/core/common/__init__.py diff --git a/src/ansys/hps/client/common/base_resource.py b/src/ansys/hps/core/common/base_resource.py similarity index 100% rename from src/ansys/hps/client/common/base_resource.py rename to src/ansys/hps/core/common/base_resource.py diff --git a/src/ansys/hps/client/common/base_schema.py b/src/ansys/hps/core/common/base_schema.py similarity index 100% rename from src/ansys/hps/client/common/base_schema.py rename to src/ansys/hps/core/common/base_schema.py diff --git a/src/ansys/hps/client/common/restricted_value.py b/src/ansys/hps/core/common/restricted_value.py similarity index 100% rename from src/ansys/hps/client/common/restricted_value.py rename to src/ansys/hps/core/common/restricted_value.py diff --git a/src/ansys/hps/client/connection.py b/src/ansys/hps/core/connection.py similarity index 97% rename from src/ansys/hps/client/connection.py rename to src/ansys/hps/core/connection.py index 69264cb34..402e6fc29 100644 --- a/src/ansys/hps/client/connection.py +++ b/src/ansys/hps/core/connection.py @@ -39,7 +39,7 @@ def create_session( Parameters ---------- access_token : str - The access token provided by :meth:`ansys.hps.client.auth.authenticate` + The access token provided by :meth:`ansys.hps.core.auth.authenticate` verify: Union[bool, str], optional Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be diff --git a/src/ansys/hps/client/exceptions.py b/src/ansys/hps/core/exceptions.py similarity index 97% rename from src/ansys/hps/client/exceptions.py rename to src/ansys/hps/core/exceptions.py index e8b915dca..3f893b053 100644 --- a/src/ansys/hps/client/exceptions.py +++ b/src/ansys/hps/core/exceptions.py @@ -30,8 +30,8 @@ def __init__(self, *args, **kwargs): Derives from :class:`requests.exceptions.RequestException`. Example: - >>> from ansys.hps.client import HPSError - >>> from ansys.hps.client.jms import Client + >>> from ansys.hps.core import HPSError + >>> from ansys.hps.core.jms import Client >>> try: >>> client = Client(url="https://127.0.0.1:8443/rep/", username="repadmin", diff --git a/src/ansys/hps/client/jms/__init__.py b/src/ansys/hps/core/jms/__init__.py similarity index 100% rename from src/ansys/hps/client/jms/__init__.py rename to src/ansys/hps/core/jms/__init__.py diff --git a/src/ansys/hps/client/jms/api/__init__.py b/src/ansys/hps/core/jms/api/__init__.py similarity index 100% rename from src/ansys/hps/client/jms/api/__init__.py rename to src/ansys/hps/core/jms/api/__init__.py diff --git a/src/ansys/hps/client/jms/api/base.py b/src/ansys/hps/core/jms/api/base.py similarity index 98% rename from src/ansys/hps/client/jms/api/base.py rename to src/ansys/hps/core/jms/api/base.py index e36e79bc9..fbc253e0d 100644 --- a/src/ansys/hps/client/jms/api/base.py +++ b/src/ansys/hps/core/jms/api/base.py @@ -26,8 +26,8 @@ from requests import Session -from ansys.hps.client.common import Object -from ansys.hps.client.exceptions import ClientError +from ansys.hps.core.common import Object +from ansys.hps.core.exceptions import ClientError log = logging.getLogger(__name__) diff --git a/src/ansys/hps/client/jms/api/jms_api.py b/src/ansys/hps/core/jms/api/jms_api.py similarity index 95% rename from src/ansys/hps/client/jms/api/jms_api.py rename to src/ansys/hps/core/jms/api/jms_api.py index 4386e48b3..1553be6e9 100644 --- a/src/ansys/hps/client/jms/api/jms_api.py +++ b/src/ansys/hps/core/jms/api/jms_api.py @@ -29,11 +29,11 @@ import backoff import requests -from ansys.hps.client.client import Client -from ansys.hps.client.common import Object -from ansys.hps.client.exceptions import HPSError -from ansys.hps.client.jms.resource import Operation, Permission, Project, TaskDefinitionTemplate -from ansys.hps.client.jms.schema.project import ProjectSchema +from ansys.hps.core.client import Client +from ansys.hps.core.common import Object +from ansys.hps.core.exceptions import HPSError +from ansys.hps.core.jms.resource import Operation, Permission, Project, TaskDefinitionTemplate +from ansys.hps.core.jms.schema.project import ProjectSchema from .base import copy_objects as base_copy_objects from .base import create_objects, delete_objects, get_object, get_objects, update_objects @@ -54,8 +54,8 @@ class JmsApi(object): Create a new project - >>> from ansys.hps.client import Client - >>> from ansys.hps.client.jms import JmsApi, Project + >>> from ansys.hps.core import Client + >>> from ansys.hps.core.jms import JmsApi, Project >>> cl = Client( ... url="https://127.0.0.1:8443/rep", username="repadmin", password="repadmin" ... ) @@ -148,7 +148,7 @@ def create_task_definition_templates( """Create new task definition templates Args: - templates (list of :class:`ansys.hps.client.jms.TaskDefinitionTemplate`): + templates (list of :class:`ansys.hps.core.jms.TaskDefinitionTemplate`): A list of task definition templates """ return create_objects( @@ -166,7 +166,7 @@ def update_task_definition_templates( """Update existing task definition templates Args: - templates (list of :class:`ansys.hps.client.jms.TaskDefinitionTemplate`): + templates (list of :class:`ansys.hps.core.jms.TaskDefinitionTemplate`): A list of task definition templates """ return update_objects( @@ -182,7 +182,7 @@ def delete_task_definition_templates(self, templates: List[TaskDefinitionTemplat """Delete existing task definition templates Args: - templates (list of :class:`ansys.hps.client.jms.TaskDefinitionTemplate`): + templates (list of :class:`ansys.hps.core.jms.TaskDefinitionTemplate`): A list of task definition templates """ return delete_objects(self.client.session, self.url, templates, TaskDefinitionTemplate) diff --git a/src/ansys/hps/client/jms/api/project_api.py b/src/ansys/hps/core/jms/api/project_api.py similarity index 96% rename from src/ansys/hps/client/jms/api/project_api.py rename to src/ansys/hps/core/jms/api/project_api.py index 7770191c7..71b85c736 100644 --- a/src/ansys/hps/client/jms/api/project_api.py +++ b/src/ansys/hps/core/jms/api/project_api.py @@ -29,10 +29,10 @@ import requests -from ansys.hps.client.client import Client -from ansys.hps.client.common import Object -from ansys.hps.client.exceptions import HPSError -from ansys.hps.client.jms.resource import ( +from ansys.hps.core.client import Client +from ansys.hps.core.common import Object +from ansys.hps.core.exceptions import HPSError +from ansys.hps.core.jms.resource import ( Algorithm, File, Job, @@ -66,8 +66,8 @@ class ProjectApi: Examples -------- - >>> from ansys.hps.client import Client - >>> from ansys.hps.client.jms import JmsApi, Project, ProjectApi + >>> from ansys.hps.core import Client + >>> from ansys.hps.core.jms import JmsApi, Project, ProjectApi >>> cl = Client( ... url="https://127.0.0.1:8443/rep", username="repadmin", password="repadmin" ... ) @@ -150,7 +150,7 @@ def get_files(self, as_objects=True, content=False, **query_params) -> List[File """ Return a list of file resources, optionally filtered by given query parameters. If content=True, each files content is downloaded as well and stored in memory - as :attr:`ansys.hps.client.jms.File.content`. + as :attr:`ansys.hps.core.jms.File.content`. """ return get_files(self, as_objects=as_objects, content=content, **query_params) @@ -306,11 +306,11 @@ def create_jobs(self, jobs: List[Job], as_objects=True) -> List[Job]: """Create new jobs Args: - jobs (list of :class:`ansys.hps.client.jms.Job`): A list of Job objects + jobs (list of :class:`ansys.hps.core.jms.Job`): A list of Job objects as_objects (bool): Whether to return jobs as objects or dictionaries Returns: - List of :class:`ansys.hps.client.jms.Job` or list of dict if `as_objects` is False + List of :class:`ansys.hps.core.jms.Job` or list of dict if `as_objects` is False """ return self._create_objects(jobs, Job, as_objects=as_objects) @@ -339,11 +339,11 @@ def update_jobs(self, jobs: List[Job], as_objects=True) -> List[Job]: """Update existing jobs Args: - jobs (list of :class:`ansys.hps.client.jms.Job`): A list of job objects + jobs (list of :class:`ansys.hps.core.jms.Job`): A list of job objects as_objects (bool): Whether to return jobs as objects or dictionaries Returns: - List of :class:`ansys.hps.client.jms.Job` or list of dict if `as_objects` is True + List of :class:`ansys.hps.core.jms.Job` or list of dict if `as_objects` is True """ return self._update_objects(jobs, Job, as_objects=as_objects) @@ -351,7 +351,7 @@ def delete_jobs(self, jobs: List[Job]): """Delete existing jobs Args: - jobs (list of :class:`ansys.hps.client.jms.Job`): A list of Job objects + jobs (list of :class:`ansys.hps.core.jms.Job`): A list of Job objects Note that only the ``id`` field of the Job objects need to be filled; the other fields can be empty. diff --git a/src/ansys/hps/client/jms/keys.py b/src/ansys/hps/core/jms/keys.py similarity index 100% rename from src/ansys/hps/client/jms/keys.py rename to src/ansys/hps/core/jms/keys.py diff --git a/src/ansys/hps/client/jms/resource/.gitignore b/src/ansys/hps/core/jms/resource/.gitignore similarity index 100% rename from src/ansys/hps/client/jms/resource/.gitignore rename to src/ansys/hps/core/jms/resource/.gitignore diff --git a/src/ansys/hps/client/jms/resource/__init__.py b/src/ansys/hps/core/jms/resource/__init__.py similarity index 100% rename from src/ansys/hps/client/jms/resource/__init__.py rename to src/ansys/hps/core/jms/resource/__init__.py diff --git a/src/ansys/hps/client/jms/resource/algorithm.py b/src/ansys/hps/core/jms/resource/algorithm.py similarity index 98% rename from src/ansys/hps/client/jms/resource/algorithm.py rename to src/ansys/hps/core/jms/resource/algorithm.py index 015d77a79..bf6a47498 100644 --- a/src/ansys/hps/client/jms/resource/algorithm.py +++ b/src/ansys/hps/core/jms/resource/algorithm.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.algorithm import AlgorithmSchema diff --git a/src/ansys/hps/client/jms/resource/evaluator.py b/src/ansys/hps/core/jms/resource/evaluator.py similarity index 99% rename from src/ansys/hps/client/jms/resource/evaluator.py rename to src/ansys/hps/core/jms/resource/evaluator.py index 765f40ecd..c710ca8c1 100644 --- a/src/ansys/hps/client/jms/resource/evaluator.py +++ b/src/ansys/hps/core/jms/resource/evaluator.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.evaluator import EvaluatorConfigurationUpdateSchema, EvaluatorSchema diff --git a/src/ansys/hps/client/jms/resource/file.py b/src/ansys/hps/core/jms/resource/file.py similarity index 99% rename from src/ansys/hps/client/jms/resource/file.py rename to src/ansys/hps/core/jms/resource/file.py index a8d8ef2d6..23b52e988 100644 --- a/src/ansys/hps/client/jms/resource/file.py +++ b/src/ansys/hps/core/jms/resource/file.py @@ -22,7 +22,7 @@ from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.file import FileSchema diff --git a/src/ansys/hps/client/jms/resource/fitness_definition.py b/src/ansys/hps/core/jms/resource/fitness_definition.py similarity index 97% rename from src/ansys/hps/client/jms/resource/fitness_definition.py rename to src/ansys/hps/core/jms/resource/fitness_definition.py index 189216871..f0b85a9d1 100644 --- a/src/ansys/hps/client/jms/resource/fitness_definition.py +++ b/src/ansys/hps/core/jms/resource/fitness_definition.py @@ -24,7 +24,7 @@ from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.fitness_definition import FitnessDefinitionSchema, FitnessTermDefinitionSchema @@ -105,7 +105,7 @@ class FitnessDefinition(Object): id : str, optional Unique ID to access the resource, generated internally by the server on creation. fitness_term_definitions - List of :class:`ansys.hps.client.jms.FitnessTermDefinition`. + List of :class:`ansys.hps.core.jms.FitnessTermDefinition`. error_fitness : float The default fitness value assigned to failed jobs. diff --git a/src/ansys/hps/client/jms/resource/job.py b/src/ansys/hps/core/jms/resource/job.py similarity index 99% rename from src/ansys/hps/client/jms/resource/job.py rename to src/ansys/hps/core/jms/resource/job.py index 8db30ccbc..1b5b470e3 100644 --- a/src/ansys/hps/client/jms/resource/job.py +++ b/src/ansys/hps/core/jms/resource/job.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.job import JobSchema diff --git a/src/ansys/hps/client/jms/resource/job_definition.py b/src/ansys/hps/core/jms/resource/job_definition.py similarity index 98% rename from src/ansys/hps/client/jms/resource/job_definition.py rename to src/ansys/hps/core/jms/resource/job_definition.py index c8774f454..234cdaf63 100644 --- a/src/ansys/hps/client/jms/resource/job_definition.py +++ b/src/ansys/hps/core/jms/resource/job_definition.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.job_definition import JobDefinitionSchema diff --git a/src/ansys/hps/client/jms/resource/license_context.py b/src/ansys/hps/core/jms/resource/license_context.py similarity index 97% rename from src/ansys/hps/client/jms/resource/license_context.py rename to src/ansys/hps/core/jms/resource/license_context.py index beeac74be..a71af41ac 100644 --- a/src/ansys/hps/client/jms/resource/license_context.py +++ b/src/ansys/hps/core/jms/resource/license_context.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.license_context import LicenseContextSchema diff --git a/src/ansys/hps/client/jms/resource/operation.py b/src/ansys/hps/core/jms/resource/operation.py similarity index 98% rename from src/ansys/hps/client/jms/resource/operation.py rename to src/ansys/hps/core/jms/resource/operation.py index 76724121e..b175da99d 100644 --- a/src/ansys/hps/client/jms/resource/operation.py +++ b/src/ansys/hps/core/jms/resource/operation.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.operation import OperationSchema diff --git a/src/ansys/hps/client/jms/resource/parameter_definition.py b/src/ansys/hps/core/jms/resource/parameter_definition.py similarity index 99% rename from src/ansys/hps/client/jms/resource/parameter_definition.py rename to src/ansys/hps/core/jms/resource/parameter_definition.py index 1357cd29c..7febc2e97 100644 --- a/src/ansys/hps/client/jms/resource/parameter_definition.py +++ b/src/ansys/hps/core/jms/resource/parameter_definition.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.parameter_definition import ( BoolParameterDefinitionSchema, diff --git a/src/ansys/hps/client/jms/resource/parameter_mapping.py b/src/ansys/hps/core/jms/resource/parameter_mapping.py similarity index 98% rename from src/ansys/hps/client/jms/resource/parameter_mapping.py rename to src/ansys/hps/core/jms/resource/parameter_mapping.py index d61542c34..dc8ee3054 100644 --- a/src/ansys/hps/client/jms/resource/parameter_mapping.py +++ b/src/ansys/hps/core/jms/resource/parameter_mapping.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.parameter_mapping import ParameterMappingSchema diff --git a/src/ansys/hps/client/jms/resource/permission.py b/src/ansys/hps/core/jms/resource/permission.py similarity index 97% rename from src/ansys/hps/client/jms/resource/permission.py rename to src/ansys/hps/core/jms/resource/permission.py index edeaf2e33..cc0b20133 100644 --- a/src/ansys/hps/client/jms/resource/permission.py +++ b/src/ansys/hps/core/jms/resource/permission.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.permission import PermissionSchema diff --git a/src/ansys/hps/client/jms/resource/project.py b/src/ansys/hps/core/jms/resource/project.py similarity index 98% rename from src/ansys/hps/client/jms/resource/project.py rename to src/ansys/hps/core/jms/resource/project.py index 241be2a1a..a47bf4c3b 100644 --- a/src/ansys/hps/client/jms/resource/project.py +++ b/src/ansys/hps/core/jms/resource/project.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.project import ProjectSchema diff --git a/src/ansys/hps/client/jms/resource/selection.py b/src/ansys/hps/core/jms/resource/selection.py similarity index 98% rename from src/ansys/hps/client/jms/resource/selection.py rename to src/ansys/hps/core/jms/resource/selection.py index 2b12d0972..f78e802fa 100644 --- a/src/ansys/hps/client/jms/resource/selection.py +++ b/src/ansys/hps/core/jms/resource/selection.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.selection import JobSelectionSchema diff --git a/src/ansys/hps/client/jms/resource/task.py b/src/ansys/hps/core/jms/resource/task.py similarity index 99% rename from src/ansys/hps/client/jms/resource/task.py rename to src/ansys/hps/core/jms/resource/task.py index bce789f5f..3cb932900 100644 --- a/src/ansys/hps/client/jms/resource/task.py +++ b/src/ansys/hps/core/jms/resource/task.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.task import TaskSchema diff --git a/src/ansys/hps/client/jms/resource/task_definition.py b/src/ansys/hps/core/jms/resource/task_definition.py similarity index 99% rename from src/ansys/hps/client/jms/resource/task_definition.py rename to src/ansys/hps/core/jms/resource/task_definition.py index 0414d9fab..26c38be97 100644 --- a/src/ansys/hps/client/jms/resource/task_definition.py +++ b/src/ansys/hps/core/jms/resource/task_definition.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.task_definition import ( HpcResourcesSchema, diff --git a/src/ansys/hps/client/jms/resource/task_definition_template.py b/src/ansys/hps/core/jms/resource/task_definition_template.py similarity index 99% rename from src/ansys/hps/client/jms/resource/task_definition_template.py rename to src/ansys/hps/core/jms/resource/task_definition_template.py index c904d5386..bf12fb6f0 100644 --- a/src/ansys/hps/client/jms/resource/task_definition_template.py +++ b/src/ansys/hps/core/jms/resource/task_definition_template.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.client.common import Object +from ansys.hps.core.common import Object from ..schema.task_definition_template import ( TaskDefinitionTemplateSchema, diff --git a/src/ansys/hps/client/jms/schema/__init__.py b/src/ansys/hps/core/jms/schema/__init__.py similarity index 100% rename from src/ansys/hps/client/jms/schema/__init__.py rename to src/ansys/hps/core/jms/schema/__init__.py diff --git a/src/ansys/hps/client/jms/schema/algorithm.py b/src/ansys/hps/core/jms/schema/algorithm.py similarity index 96% rename from src/ansys/hps/client/jms/schema/algorithm.py rename to src/ansys/hps/core/jms/schema/algorithm.py index 75b153d75..0836b83c6 100644 --- a/src/ansys/hps/client/jms/schema/algorithm.py +++ b/src/ansys/hps/core/jms/schema/algorithm.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.client.common import ObjectSchemaWithModificationInfo +from ansys.hps.core.common import ObjectSchemaWithModificationInfo from .object_reference import IdReferenceList diff --git a/src/ansys/hps/client/jms/schema/evaluator.py b/src/ansys/hps/core/jms/schema/evaluator.py similarity index 98% rename from src/ansys/hps/client/jms/schema/evaluator.py rename to src/ansys/hps/core/jms/schema/evaluator.py index 11e07e997..cc1d34133 100644 --- a/src/ansys/hps/client/jms/schema/evaluator.py +++ b/src/ansys/hps/core/jms/schema/evaluator.py @@ -25,7 +25,7 @@ from marshmallow import fields from marshmallow.validate import OneOf -from ansys.hps.client.common import ObjectSchema, RestrictedValue +from ansys.hps.core.common import ObjectSchema, RestrictedValue project_assignment_modes = ["disabled", "all_active", "project_list"] diff --git a/src/ansys/hps/client/jms/schema/file.py b/src/ansys/hps/core/jms/schema/file.py similarity index 97% rename from src/ansys/hps/client/jms/schema/file.py rename to src/ansys/hps/core/jms/schema/file.py index 565f8fff7..b5671980f 100644 --- a/src/ansys/hps/client/jms/schema/file.py +++ b/src/ansys/hps/core/jms/schema/file.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.client.common import ObjectSchemaWithModificationInfo +from ansys.hps.core.common import ObjectSchemaWithModificationInfo from .object_reference import IdReference diff --git a/src/ansys/hps/client/jms/schema/fitness_definition.py b/src/ansys/hps/core/jms/schema/fitness_definition.py similarity index 98% rename from src/ansys/hps/client/jms/schema/fitness_definition.py rename to src/ansys/hps/core/jms/schema/fitness_definition.py index 2a2780f63..52b8f5852 100644 --- a/src/ansys/hps/client/jms/schema/fitness_definition.py +++ b/src/ansys/hps/core/jms/schema/fitness_definition.py @@ -24,7 +24,7 @@ from marshmallow import fields from marshmallow.validate import OneOf -from ansys.hps.client.common import ObjectSchema +from ansys.hps.core.common import ObjectSchema fitness_term_types = ["design_objective", "limit_constraint", "target_constraint"] diff --git a/src/ansys/hps/client/jms/schema/job.py b/src/ansys/hps/core/jms/schema/job.py similarity index 98% rename from src/ansys/hps/client/jms/schema/job.py rename to src/ansys/hps/core/jms/schema/job.py index 099312015..2f69c0ee9 100644 --- a/src/ansys/hps/client/jms/schema/job.py +++ b/src/ansys/hps/core/jms/schema/job.py @@ -24,7 +24,7 @@ from marshmallow import fields from marshmallow.validate import OneOf -from ansys.hps.client.common import ObjectSchemaWithModificationInfo +from ansys.hps.core.common import ObjectSchemaWithModificationInfo from .object_reference import IdReference, IdReferenceList diff --git a/src/ansys/hps/client/jms/schema/job_definition.py b/src/ansys/hps/core/jms/schema/job_definition.py similarity index 97% rename from src/ansys/hps/client/jms/schema/job_definition.py rename to src/ansys/hps/core/jms/schema/job_definition.py index da8a7a5b7..42cf88183 100644 --- a/src/ansys/hps/client/jms/schema/job_definition.py +++ b/src/ansys/hps/core/jms/schema/job_definition.py @@ -24,7 +24,7 @@ from marshmallow import fields -from ansys.hps.client.common import ObjectSchemaWithModificationInfo +from ansys.hps.core.common import ObjectSchemaWithModificationInfo from .fitness_definition import FitnessDefinitionSchema from .object_reference import IdReferenceList diff --git a/src/ansys/hps/client/jms/schema/license_context.py b/src/ansys/hps/core/jms/schema/license_context.py similarity index 95% rename from src/ansys/hps/client/jms/schema/license_context.py rename to src/ansys/hps/core/jms/schema/license_context.py index 0ca54beb7..dc5e1d6bb 100644 --- a/src/ansys/hps/client/jms/schema/license_context.py +++ b/src/ansys/hps/core/jms/schema/license_context.py @@ -1,4 +1,3 @@ -# Copyright (C) 2021 by # Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # @@ -23,7 +22,7 @@ from marshmallow import fields -from ansys.hps.client.common import BaseSchema +from ansys.hps.core.common import BaseSchema class LicenseContextSchema(BaseSchema): diff --git a/src/ansys/hps/client/jms/schema/object_reference.py b/src/ansys/hps/core/jms/schema/object_reference.py similarity index 100% rename from src/ansys/hps/client/jms/schema/object_reference.py rename to src/ansys/hps/core/jms/schema/object_reference.py diff --git a/src/ansys/hps/client/jms/schema/operation.py b/src/ansys/hps/core/jms/schema/operation.py similarity index 97% rename from src/ansys/hps/client/jms/schema/operation.py rename to src/ansys/hps/core/jms/schema/operation.py index 36798681a..5a0760c12 100644 --- a/src/ansys/hps/client/jms/schema/operation.py +++ b/src/ansys/hps/core/jms/schema/operation.py @@ -22,7 +22,7 @@ from marshmallow import fields -from ansys.hps.client.common import ObjectSchema +from ansys.hps.core.common import ObjectSchema class OperationSchema(ObjectSchema): diff --git a/src/ansys/hps/client/jms/schema/parameter_definition.py b/src/ansys/hps/core/jms/schema/parameter_definition.py similarity index 98% rename from src/ansys/hps/client/jms/schema/parameter_definition.py rename to src/ansys/hps/core/jms/schema/parameter_definition.py index 81a354298..1ec432d7a 100644 --- a/src/ansys/hps/client/jms/schema/parameter_definition.py +++ b/src/ansys/hps/core/jms/schema/parameter_definition.py @@ -25,7 +25,7 @@ from marshmallow import fields from marshmallow_oneofschema import OneOfSchema -from ansys.hps.client.common import ObjectSchemaWithModificationInfo +from ansys.hps.core.common import ObjectSchemaWithModificationInfo log = logging.getLogger(__name__) diff --git a/src/ansys/hps/client/jms/schema/parameter_mapping.py b/src/ansys/hps/core/jms/schema/parameter_mapping.py similarity index 97% rename from src/ansys/hps/client/jms/schema/parameter_mapping.py rename to src/ansys/hps/core/jms/schema/parameter_mapping.py index 9eb51e97c..5fcd93724 100644 --- a/src/ansys/hps/client/jms/schema/parameter_mapping.py +++ b/src/ansys/hps/core/jms/schema/parameter_mapping.py @@ -24,7 +24,7 @@ from marshmallow import fields -from ansys.hps.client.common import ObjectSchemaWithModificationInfo +from ansys.hps.core.common import ObjectSchemaWithModificationInfo from .object_reference import IdReference diff --git a/src/ansys/hps/client/jms/schema/permission.py b/src/ansys/hps/core/jms/schema/permission.py similarity index 97% rename from src/ansys/hps/client/jms/schema/permission.py rename to src/ansys/hps/core/jms/schema/permission.py index bdaf9b1a5..b711e68ce 100644 --- a/src/ansys/hps/client/jms/schema/permission.py +++ b/src/ansys/hps/core/jms/schema/permission.py @@ -22,7 +22,7 @@ from marshmallow import fields -from ansys.hps.client.common import BaseSchema +from ansys.hps.core.common import BaseSchema class PermissionSchema(BaseSchema): diff --git a/src/ansys/hps/client/jms/schema/project.py b/src/ansys/hps/core/jms/schema/project.py similarity index 97% rename from src/ansys/hps/client/jms/schema/project.py rename to src/ansys/hps/core/jms/schema/project.py index 2cb80a591..3bbb6c4f1 100644 --- a/src/ansys/hps/client/jms/schema/project.py +++ b/src/ansys/hps/core/jms/schema/project.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.client.common import BaseSchema +from ansys.hps.core.common import BaseSchema class ProjectSchema(BaseSchema): diff --git a/src/ansys/hps/client/jms/schema/selection.py b/src/ansys/hps/core/jms/schema/selection.py similarity index 96% rename from src/ansys/hps/client/jms/schema/selection.py rename to src/ansys/hps/core/jms/schema/selection.py index 4830ab5de..46a83f93f 100644 --- a/src/ansys/hps/client/jms/schema/selection.py +++ b/src/ansys/hps/core/jms/schema/selection.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.client.common import ObjectSchemaWithModificationInfo +from ansys.hps.core.common import ObjectSchemaWithModificationInfo from .object_reference import IdReference, IdReferenceList diff --git a/src/ansys/hps/client/jms/schema/task.py b/src/ansys/hps/core/jms/schema/task.py similarity index 98% rename from src/ansys/hps/client/jms/schema/task.py rename to src/ansys/hps/core/jms/schema/task.py index 033fe8a57..d3cebfe95 100644 --- a/src/ansys/hps/client/jms/schema/task.py +++ b/src/ansys/hps/core/jms/schema/task.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.client.common import ObjectSchemaWithModificationInfo +from ansys.hps.core.common import ObjectSchemaWithModificationInfo from .object_reference import IdReference, IdReferenceList from .task_definition import TaskDefinitionSchema diff --git a/src/ansys/hps/client/jms/schema/task_definition.py b/src/ansys/hps/core/jms/schema/task_definition.py similarity index 98% rename from src/ansys/hps/client/jms/schema/task_definition.py rename to src/ansys/hps/core/jms/schema/task_definition.py index 5537a3064..b3077c51b 100644 --- a/src/ansys/hps/client/jms/schema/task_definition.py +++ b/src/ansys/hps/core/jms/schema/task_definition.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.client.common import BaseSchema, ObjectSchemaWithModificationInfo, RestrictedValue +from ansys.hps.core.common import BaseSchema, ObjectSchemaWithModificationInfo, RestrictedValue from .object_reference import IdReference, IdReferenceList diff --git a/src/ansys/hps/client/jms/schema/task_definition_template.py b/src/ansys/hps/core/jms/schema/task_definition_template.py similarity index 98% rename from src/ansys/hps/client/jms/schema/task_definition_template.py rename to src/ansys/hps/core/jms/schema/task_definition_template.py index 4918c3a4e..3d074495e 100644 --- a/src/ansys/hps/client/jms/schema/task_definition_template.py +++ b/src/ansys/hps/core/jms/schema/task_definition_template.py @@ -1,4 +1,3 @@ -# Copyright (C) 2021 by # Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # @@ -23,7 +22,7 @@ from marshmallow import fields, validate -from ansys.hps.client.common import BaseSchema, ObjectSchema +from ansys.hps.core.common import BaseSchema, ObjectSchema from .task_definition import HpcResourcesSchema, SoftwareSchema diff --git a/src/ansys/hps/client/rms/__init__.py b/src/ansys/hps/core/rms/__init__.py similarity index 100% rename from src/ansys/hps/client/rms/__init__.py rename to src/ansys/hps/core/rms/__init__.py diff --git a/src/ansys/hps/client/rms/api/base.py b/src/ansys/hps/core/rms/api/base.py similarity index 99% rename from src/ansys/hps/client/rms/api/base.py rename to src/ansys/hps/core/rms/api/base.py index f417e232e..e8e4e8a72 100644 --- a/src/ansys/hps/client/rms/api/base.py +++ b/src/ansys/hps/core/rms/api/base.py @@ -29,7 +29,7 @@ from pydantic import create_model from requests import Session -from ansys.hps.client.exceptions import ClientError +from ansys.hps.core.exceptions import ClientError from ..models import ( ComputeResourceSet, diff --git a/src/ansys/hps/client/rms/api/rms_api.py b/src/ansys/hps/core/rms/api/rms_api.py similarity index 96% rename from src/ansys/hps/client/rms/api/rms_api.py rename to src/ansys/hps/core/rms/api/rms_api.py index 93c1164db..9b12c26a9 100644 --- a/src/ansys/hps/client/rms/api/rms_api.py +++ b/src/ansys/hps/core/rms/api/rms_api.py @@ -23,8 +23,8 @@ import logging from typing import List -from ansys.hps.client.client import Client -from ansys.hps.client.rms.models import ( +from ansys.hps.core.client import Client +from ansys.hps.core.rms.models import ( ClusterInfo, ComputeResourceSet, EvaluatorConfiguration, @@ -100,8 +100,8 @@ def update_evaluator_configuration( on a Linux evaluator that was active in the past 60 seconds. >>> import datetime - >>> from ansys.hps.client import Client - >>> from ansys.hps.client.jms import RmsApi, EvaluatorConfigurationUpdate + >>> from ansys.hps.core import Client + >>> from ansys.hps.core.jms import RmsApi, EvaluatorConfigurationUpdate >>> cl = Client( ... url="https://localhost:8443/rep", username="repuser", password="repuser" ... ) diff --git a/src/ansys/hps/client/rms/models.py b/src/ansys/hps/core/rms/models.py similarity index 100% rename from src/ansys/hps/client/rms/models.py rename to src/ansys/hps/core/rms/models.py diff --git a/src/ansys/hps/client/warnings.py b/src/ansys/hps/core/warnings.py similarity index 100% rename from src/ansys/hps/client/warnings.py rename to src/ansys/hps/core/warnings.py diff --git a/tests/auth/test_api.py b/tests/auth/test_api.py index 6cbc6004c..7ab7c0701 100644 --- a/tests/auth/test_api.py +++ b/tests/auth/test_api.py @@ -26,8 +26,8 @@ from keycloak import KeycloakOpenID from keycloak.exceptions import KeycloakError -from ansys.hps.client import Client, HPSError -from ansys.hps.client.auth import AuthApi, User, authenticate +from ansys.hps.core import Client, HPSError +from ansys.hps.core.auth import AuthApi, User, authenticate from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/auth/test_authenticate.py b/tests/auth/test_authenticate.py index 131b27b4b..018487da4 100644 --- a/tests/auth/test_authenticate.py +++ b/tests/auth/test_authenticate.py @@ -24,7 +24,7 @@ import requests -from ansys.hps.client.auth import authenticate +from ansys.hps.core.auth import authenticate from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_algorithms.py b/tests/jms/test_algorithms.py index 698ae49d1..bc53e2a89 100644 --- a/tests/jms/test_algorithms.py +++ b/tests/jms/test_algorithms.py @@ -25,8 +25,8 @@ from marshmallow.utils import missing -from ansys.hps.client.jms import JmsApi, ProjectApi -from ansys.hps.client.jms.resource import Algorithm, Job, JobDefinition, JobSelection, Project +from ansys.hps.core.jms import JmsApi, ProjectApi +from ansys.hps.core.jms.resource import Algorithm, Job, JobDefinition, JobSelection, Project from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_files.py b/tests/jms/test_files.py index a6f376dac..eb0cb30d9 100644 --- a/tests/jms/test_files.py +++ b/tests/jms/test_files.py @@ -28,8 +28,8 @@ from marshmallow.utils import missing -from ansys.hps.client.jms import JmsApi, ProjectApi -from ansys.hps.client.jms.resource import File, Project +from ansys.hps.core.jms import JmsApi, ProjectApi +from ansys.hps.core.jms.resource import File, Project from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_fitness_definition.py b/tests/jms/test_fitness_definition.py index 14c06ac85..b2b91ac97 100644 --- a/tests/jms/test_fitness_definition.py +++ b/tests/jms/test_fitness_definition.py @@ -25,13 +25,10 @@ from marshmallow.utils import missing -from ansys.hps.client.jms import JmsApi, ProjectApi -from ansys.hps.client.jms.resource import JobDefinition, Project -from ansys.hps.client.jms.resource.fitness_definition import ( - FitnessDefinition, - FitnessTermDefinition, -) -from ansys.hps.client.jms.schema.fitness_definition import ( +from ansys.hps.core.jms import JmsApi, ProjectApi +from ansys.hps.core.jms.resource import JobDefinition, Project +from ansys.hps.core.jms.resource.fitness_definition import FitnessDefinition, FitnessTermDefinition +from ansys.hps.core.jms.schema.fitness_definition import ( FitnessDefinitionSchema, FitnessTermDefinitionSchema, ) diff --git a/tests/jms/test_jms_api.py b/tests/jms/test_jms_api.py index 8aeaa625b..0f6eab726 100644 --- a/tests/jms/test_jms_api.py +++ b/tests/jms/test_jms_api.py @@ -26,9 +26,9 @@ from examples.mapdl_motorbike_frame.project_setup import create_project from marshmallow.utils import missing -from ansys.hps.client import Client, ClientError -from ansys.hps.client.jms import JmsApi, ProjectApi -from ansys.hps.client.jms.resource import ( +from ansys.hps.core import Client, ClientError +from ansys.hps.core.jms import JmsApi, ProjectApi +from ansys.hps.core.jms.resource import ( FloatParameterDefinition, IntParameterDefinition, Job, @@ -166,7 +166,7 @@ def test_objects_type_check(self): with self.assertRaises(ClientError) as context: _ = jms_api.create_task_definition_templates([job]) assert "Wrong object type" in str(context.exception) - assert "got " in str(context.exception) + assert "got " in str(context.exception) proj = jms_api.create_project(proj, replace=True) project_api = ProjectApi(client, proj.id) @@ -176,7 +176,7 @@ def test_objects_type_check(self): with self.assertRaises(ClientError) as context: _ = project_api.create_jobs([job_def]) assert "Wrong object type" in str(context.exception) - assert "got " in str( + assert "got " in str( context.exception ) @@ -192,9 +192,9 @@ def test_objects_type_check(self): ) msg = str(context.exception) assert "Wrong object type" in msg - assert "" in msg + assert "" in msg assert ( - "" + "" in msg ) diff --git a/tests/jms/test_job_definitions.py b/tests/jms/test_job_definitions.py index f10b1be09..f9f940343 100644 --- a/tests/jms/test_job_definitions.py +++ b/tests/jms/test_job_definitions.py @@ -25,8 +25,8 @@ from examples.mapdl_motorbike_frame.project_setup import create_project from marshmallow.utils import missing -from ansys.hps.client import AuthApi, JmsApi, ProjectApi -from ansys.hps.client.jms.resource import ( +from ansys.hps.core import AuthApi, JmsApi, ProjectApi +from ansys.hps.core.jms.resource import ( HpcResources, JobDefinition, Project, diff --git a/tests/jms/test_jobs.py b/tests/jms/test_jobs.py index 449fb4cd3..8303938d0 100644 --- a/tests/jms/test_jobs.py +++ b/tests/jms/test_jobs.py @@ -28,9 +28,9 @@ from examples.mapdl_motorbike_frame.project_setup import create_project from marshmallow.utils import missing -from ansys.hps.client import AuthApi, JmsApi, ProjectApi -from ansys.hps.client.jms.resource import Job, JobDefinition, Project -from ansys.hps.client.jms.schema.job import JobSchema +from ansys.hps.core import AuthApi, JmsApi, ProjectApi +from ansys.hps.core.jms.resource import Job, JobDefinition, Project +from ansys.hps.core.jms.schema.job import JobSchema from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_parameter_definitions.py b/tests/jms/test_parameter_definitions.py index 7422affa2..a1f90d65f 100644 --- a/tests/jms/test_parameter_definitions.py +++ b/tests/jms/test_parameter_definitions.py @@ -25,8 +25,8 @@ from marshmallow.utils import missing -from ansys.hps.client.jms import JmsApi, ProjectApi -from ansys.hps.client.jms.resource import ( +from ansys.hps.core.jms import JmsApi, ProjectApi +from ansys.hps.core.jms.resource import ( BoolParameterDefinition, FloatParameterDefinition, IntParameterDefinition, @@ -34,7 +34,7 @@ Project, StringParameterDefinition, ) -from ansys.hps.client.jms.schema.parameter_definition import ( +from ansys.hps.core.jms.schema.parameter_definition import ( BoolParameterDefinitionSchema, FloatParameterDefinitionSchema, IntParameterDefinitionSchema, diff --git a/tests/jms/test_project_permissions.py b/tests/jms/test_project_permissions.py index c914180fd..a677c65dd 100644 --- a/tests/jms/test_project_permissions.py +++ b/tests/jms/test_project_permissions.py @@ -1,4 +1,3 @@ -# Copyright (C) 2021 by # Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # @@ -26,11 +25,11 @@ import unittest import uuid -from ansys.hps.client import Client -from ansys.hps.client.auth import AuthApi, User -from ansys.hps.client.exceptions import ClientError -from ansys.hps.client.jms import JmsApi, ProjectApi -from ansys.hps.client.jms.resource import JobDefinition, Permission, Project +from ansys.hps.core import Client +from ansys.hps.core.auth import AuthApi, User +from ansys.hps.core.exceptions import ClientError +from ansys.hps.core.jms import JmsApi, ProjectApi +from ansys.hps.core.jms.resource import JobDefinition, Permission, Project from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_projects.py b/tests/jms/test_projects.py index 2e7d4e30c..ec1f3d50d 100644 --- a/tests/jms/test_projects.py +++ b/tests/jms/test_projects.py @@ -30,10 +30,10 @@ from examples.mapdl_motorbike_frame.project_setup import create_project as motorbike_create_project from marshmallow.utils import missing -from ansys.hps.client import __ansys_apps_version__ as ansys_version -from ansys.hps.client.jms import JmsApi, ProjectApi -from ansys.hps.client.jms.resource import JobDefinition, LicenseContext, Project -from ansys.hps.client.jms.schema.project import ProjectSchema +from ansys.hps.core import __ansys_apps_version__ as ansys_version +from ansys.hps.core.jms import JmsApi, ProjectApi +from ansys.hps.core.jms.resource import JobDefinition, LicenseContext, Project +from ansys.hps.core.jms.schema.project import ProjectSchema from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_resources.py b/tests/jms/test_resources.py index 64bbe7714..bcc9dacd3 100644 --- a/tests/jms/test_resources.py +++ b/tests/jms/test_resources.py @@ -26,7 +26,7 @@ from examples.mapdl_motorbike_frame.project_setup import create_project from marshmallow import missing -from ansys.hps.client.jms import ( +from ansys.hps.core.jms import ( FitnessDefinition, JmsApi, JobDefinition, diff --git a/tests/jms/test_task_definition.py b/tests/jms/test_task_definition.py index cfa33765f..826779168 100644 --- a/tests/jms/test_task_definition.py +++ b/tests/jms/test_task_definition.py @@ -23,14 +23,14 @@ from collections import OrderedDict import unittest -from ansys.hps.client.jms.resource import TaskDefinition -from ansys.hps.client.jms.resource.task_definition import ( +from ansys.hps.core.jms.resource import TaskDefinition +from ansys.hps.core.jms.resource.task_definition import ( HpcResources, Licensing, ResourceRequirements, SuccessCriteria, ) -from ansys.hps.client.jms.schema.task_definition import TaskDefinitionSchema +from ansys.hps.core.jms.schema.task_definition import TaskDefinitionSchema from tests.rep_test import REPTestCase diff --git a/tests/jms/test_task_definition_templates.py b/tests/jms/test_task_definition_templates.py index 6d253bf26..3618fa732 100644 --- a/tests/jms/test_task_definition_templates.py +++ b/tests/jms/test_task_definition_templates.py @@ -1,4 +1,3 @@ -# Copyright (C) 2021 by # Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # @@ -28,16 +27,16 @@ from marshmallow.utils import missing -from ansys.hps.client import HPSError -from ansys.hps.client.auth import AuthApi -from ansys.hps.client.jms import JmsApi -from ansys.hps.client.jms.resource import ( +from ansys.hps.core import HPSError +from ansys.hps.core.auth import AuthApi +from ansys.hps.core.jms import JmsApi +from ansys.hps.core.jms.resource import ( HpcResources, Permission, TaskDefinitionTemplate, TemplateResourceRequirements, ) -from ansys.hps.client.jms.schema.task_definition_template import TaskDefinitionTemplateSchema +from ansys.hps.core.jms.schema.task_definition_template import TaskDefinitionTemplateSchema from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_task_files.py b/tests/jms/test_task_files.py index be7ed8b75..770b610dc 100644 --- a/tests/jms/test_task_files.py +++ b/tests/jms/test_task_files.py @@ -1,4 +1,3 @@ -# Copyright (C) 2021 by # Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # @@ -30,8 +29,8 @@ from examples.mapdl_motorbike_frame.project_setup import create_project import pytest -from ansys.hps.client.jms import JmsApi, ProjectApi -from ansys.hps.client.jms.resource import File +from ansys.hps.core.jms import JmsApi, ProjectApi +from ansys.hps.core.jms.resource import File from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_tasks.py b/tests/jms/test_tasks.py index 4866ce27d..5f9ae15d1 100644 --- a/tests/jms/test_tasks.py +++ b/tests/jms/test_tasks.py @@ -30,9 +30,9 @@ from marshmallow.utils import missing import pytest -from ansys.hps.client.jms import JmsApi, ProjectApi -from ansys.hps.client.jms.resource import Job, JobDefinition, Project, Software, TaskDefinition -from ansys.hps.client.jms.schema.task import TaskSchema +from ansys.hps.core.jms import JmsApi, ProjectApi +from ansys.hps.core.jms.resource import Job, JobDefinition, Project, Software, TaskDefinition +from ansys.hps.core.jms.schema.task import TaskSchema from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/rep_test.py b/tests/rep_test.py index 27d8984ab..cc700e85f 100644 --- a/tests/rep_test.py +++ b/tests/rep_test.py @@ -29,9 +29,9 @@ from keycloak import KeycloakAdmin -from ansys.hps.client import Client -from ansys.hps.client.auth import AuthApi, User -from ansys.hps.client.auth.api.auth_api import create_user +from ansys.hps.core import Client +from ansys.hps.core.auth import AuthApi, User +from ansys.hps.core.auth.api.auth_api import create_user class REPTestCase(unittest.TestCase): diff --git a/tests/rms/test_api.py b/tests/rms/test_api.py index 491655b3e..ca53508da 100644 --- a/tests/rms/test_api.py +++ b/tests/rms/test_api.py @@ -23,7 +23,7 @@ import logging import unittest -from ansys.hps.client.rms import RmsApi +from ansys.hps.core.rms import RmsApi from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/rms/test_compute_resource_sets.py b/tests/rms/test_compute_resource_sets.py index 5de67bbd3..5c80e9cf6 100644 --- a/tests/rms/test_compute_resource_sets.py +++ b/tests/rms/test_compute_resource_sets.py @@ -23,7 +23,7 @@ import logging import unittest -from ansys.hps.client.rms import RmsApi +from ansys.hps.core.rms import RmsApi from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/rms/test_evaluators.py b/tests/rms/test_evaluators.py index 6a6ab93d9..0cdba700d 100644 --- a/tests/rms/test_evaluators.py +++ b/tests/rms/test_evaluators.py @@ -24,8 +24,8 @@ import logging import unittest -from ansys.hps.client.rms import RmsApi -from ansys.hps.client.rms.models import EvaluatorConfigurationUpdate, EvaluatorRegistration +from ansys.hps.core.rms import RmsApi +from ansys.hps.core.rms.models import EvaluatorConfigurationUpdate, EvaluatorRegistration from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/rms/test_serialization.py b/tests/rms/test_serialization.py index 93ab00424..752e22ae1 100644 --- a/tests/rms/test_serialization.py +++ b/tests/rms/test_serialization.py @@ -25,8 +25,8 @@ import logging import unittest -from ansys.hps.client.rms.api.base import objects_to_json -from ansys.hps.client.rms.models import EvaluatorRegistration +from ansys.hps.core.rms.api.base import objects_to_json +from ansys.hps.core.rms.models import EvaluatorRegistration from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/test_client.py b/tests/test_client.py index 90ad3fadf..35950badc 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -26,7 +26,7 @@ import requests -from ansys.hps.client import Client +from ansys.hps.core import Client from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/test_connection.py b/tests/test_connection.py index 9ca9314e6..2adf8c89b 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -22,8 +22,8 @@ import logging -from ansys.hps.client.auth import authenticate -from ansys.hps.client.connection import create_session, ping +from ansys.hps.core.auth import authenticate +from ansys.hps.core.connection import create_session, ping from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/test_examples.py b/tests/test_examples.py index 8f47660c1..e7aa8300b 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -23,13 +23,8 @@ import logging import unittest -from ansys.hps.client import __ansys_apps_version__ as ansys_version -from ansys.hps.client.jms import ( - IntParameterDefinition, - JmsApi, - ProjectApi, - StringParameterDefinition, -) +from ansys.hps.core import __ansys_apps_version__ as ansys_version +from ansys.hps.core.jms import IntParameterDefinition, JmsApi, ProjectApi, StringParameterDefinition from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index 947193aa0..135380106 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -23,8 +23,8 @@ import logging import unittest -from ansys.hps.client import APIError, Client, ClientError -from ansys.hps.client.jms import JmsApi +from ansys.hps.core import APIError, Client, ClientError +from ansys.hps.core.jms import JmsApi from tests.rep_test import REPTestCase log = logging.getLogger(__name__) From edc102ae0f50587e0aafc9808d412d0110db51c9 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 23 Jan 2024 12:10:25 -0500 Subject: [PATCH 41/61] use ansys_favicon --- doc/source/conf.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 3e8b4f231..d15bd9e9b 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -3,8 +3,7 @@ import os import sys -from ansys_sphinx_theme import get_version_match -from ansys_sphinx_theme import pyansys_logo_black as logo +from ansys_sphinx_theme import ansys_favicon, get_version_match, pyansys_logo_black from ansys.hps.core import __ansys_apps_version__, __version__ @@ -140,10 +139,10 @@ # The name of an image file (relative to this directory) to place at the top # of the sidebar. -html_logo = logo +html_logo = pyansys_logo_black # Favicon -html_favicon = "favicon.png" +html_favicon = ansys_favicon # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, From b71e9144629171fcef65fb7bf4177869bce3a1cf Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 23 Jan 2024 12:15:26 -0500 Subject: [PATCH 42/61] make documentation run for main python version --- .github/workflows/ci_cd.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index e6f51f080..8bff69311 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -10,7 +10,6 @@ on: env: MAIN_PYTHON_VERSION: '3.9' - DOC_PYTHON_VERSION: '3.9' DOCUMENTATION_CNAME: 'hps.docs.pyansys.com' PACKAGE_NAME: 'ansys-hps-core' @@ -142,7 +141,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: ${{ env.DOC_PYTHON_VERSION }} + python-version: ${{ env.MAIN_PYTHON_VERSION }} - name: Install dependencies run: | From 437d60c28f16afa31cb304a6f9d4041ff06c9dfd Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 23 Jan 2024 13:00:34 -0500 Subject: [PATCH 43/61] revert back to ansys-hps-client --- .github/workflows/ci_cd.yml | 4 +- README.rst | 12 ++-- doc/source/api/auth.rst | 8 +-- doc/source/api/client.rst | 4 +- doc/source/api/exceptions.rst | 12 ++-- doc/source/api/jms.rst | 58 +++++++++---------- doc/source/api/rms.rst | 14 ++--- doc/source/conf.py | 8 +-- doc/source/examples/index.rst | 2 +- doc/source/index.rst | 2 +- doc/source/quickstart.rst | 16 ++--- examples/cfx_static_mixer/project_setup.py | 4 +- .../fluent_2d_heat_exchanger/project_setup.py | 4 +- examples/fluent_nozzle/project_setup.py | 4 +- examples/lsdyna_cylinder_plate/lsdyna_job.py | 4 +- .../mapdl_linked_analyses/project_setup.py | 4 +- .../mapdl_motorbike_frame/project_query.py | 4 +- .../mapdl_motorbike_frame/project_setup.py | 4 +- examples/mapdl_motorbike_frame/task_files.py | 4 +- .../mapdl_tyre_performance/project_setup.py | 4 +- .../project_setup.py | 4 +- .../project_setup.py | 4 +- .../python_multi_process_step/task_files.py | 2 +- .../project_setup.py | 4 +- generate_resources.py | 12 ++-- pyproject.toml | 6 +- src/ansys/hps/{core => client}/__init__.py | 0 src/ansys/hps/{core => client}/__version__.py | 2 +- .../hps/{core => client}/auth/__init__.py | 0 .../hps/{core => client}/auth/api/__init__.py | 0 .../hps/{core => client}/auth/api/auth_api.py | 12 ++-- .../hps/{core => client}/auth/authenticate.py | 0 .../auth/resource/__init__.py | 0 .../{core => client}/auth/resource/user.py | 2 +- .../{core => client}/auth/schema/__init__.py | 0 .../hps/{core => client}/auth/schema/user.py | 2 +- src/ansys/hps/{core => client}/client.py | 2 +- .../hps/{core => client}/common/__init__.py | 0 .../{core => client}/common/base_resource.py | 0 .../{core => client}/common/base_schema.py | 0 .../common/restricted_value.py | 0 src/ansys/hps/{core => client}/connection.py | 0 src/ansys/hps/{core => client}/exceptions.py | 4 +- .../hps/{core => client}/jms/__init__.py | 0 .../hps/{core => client}/jms/api/__init__.py | 0 .../hps/{core => client}/jms/api/base.py | 4 +- .../hps/{core => client}/jms/api/jms_api.py | 20 +++---- .../{core => client}/jms/api/project_api.py | 24 ++++---- src/ansys/hps/{core => client}/jms/keys.py | 0 .../{core => client}/jms/resource/.gitignore | 0 .../{core => client}/jms/resource/__init__.py | 0 .../jms/resource/algorithm.py | 2 +- .../jms/resource/evaluator.py | 2 +- .../hps/{core => client}/jms/resource/file.py | 2 +- .../jms/resource/fitness_definition.py | 4 +- .../hps/{core => client}/jms/resource/job.py | 2 +- .../jms/resource/job_definition.py | 2 +- .../jms/resource/license_context.py | 2 +- .../jms/resource/operation.py | 2 +- .../jms/resource/parameter_definition.py | 2 +- .../jms/resource/parameter_mapping.py | 2 +- .../jms/resource/permission.py | 2 +- .../{core => client}/jms/resource/project.py | 2 +- .../jms/resource/selection.py | 2 +- .../hps/{core => client}/jms/resource/task.py | 2 +- .../jms/resource/task_definition.py | 2 +- .../jms/resource/task_definition_template.py | 2 +- .../{core => client}/jms/schema/__init__.py | 0 .../{core => client}/jms/schema/algorithm.py | 2 +- .../{core => client}/jms/schema/evaluator.py | 2 +- .../hps/{core => client}/jms/schema/file.py | 2 +- .../jms/schema/fitness_definition.py | 2 +- .../hps/{core => client}/jms/schema/job.py | 2 +- .../jms/schema/job_definition.py | 2 +- .../jms/schema/license_context.py | 2 +- .../jms/schema/object_reference.py | 0 .../{core => client}/jms/schema/operation.py | 2 +- .../jms/schema/parameter_definition.py | 2 +- .../jms/schema/parameter_mapping.py | 2 +- .../{core => client}/jms/schema/permission.py | 2 +- .../{core => client}/jms/schema/project.py | 2 +- .../{core => client}/jms/schema/selection.py | 2 +- .../hps/{core => client}/jms/schema/task.py | 2 +- .../jms/schema/task_definition.py | 2 +- .../jms/schema/task_definition_template.py | 2 +- .../hps/{core => client}/rms/__init__.py | 0 .../hps/{core => client}/rms/api/base.py | 2 +- .../hps/{core => client}/rms/api/rms_api.py | 8 +-- src/ansys/hps/{core => client}/rms/models.py | 0 src/ansys/hps/{core => client}/warnings.py | 0 tests/auth/test_api.py | 4 +- tests/auth/test_authenticate.py | 2 +- tests/jms/test_algorithms.py | 4 +- tests/jms/test_files.py | 4 +- tests/jms/test_fitness_definition.py | 11 ++-- tests/jms/test_jms_api.py | 14 ++--- tests/jms/test_job_definitions.py | 4 +- tests/jms/test_jobs.py | 6 +- tests/jms/test_parameter_definitions.py | 6 +- tests/jms/test_project_permissions.py | 10 ++-- tests/jms/test_projects.py | 8 +-- tests/jms/test_resources.py | 2 +- tests/jms/test_task_definition.py | 6 +- tests/jms/test_task_definition_templates.py | 10 ++-- tests/jms/test_task_files.py | 4 +- tests/jms/test_tasks.py | 6 +- tests/rep_test.py | 6 +- tests/rms/test_api.py | 2 +- tests/rms/test_compute_resource_sets.py | 2 +- tests/rms/test_evaluators.py | 4 +- tests/rms/test_serialization.py | 4 +- tests/test_client.py | 2 +- tests/test_connection.py | 4 +- tests/test_examples.py | 9 ++- tests/test_exceptions.py | 4 +- 115 files changed, 251 insertions(+), 243 deletions(-) rename src/ansys/hps/{core => client}/__init__.py (100%) rename src/ansys/hps/{core => client}/__version__.py (96%) rename src/ansys/hps/{core => client}/auth/__init__.py (100%) rename src/ansys/hps/{core => client}/auth/api/__init__.py (100%) rename src/ansys/hps/{core => client}/auth/api/auth_api.py (94%) rename src/ansys/hps/{core => client}/auth/authenticate.py (100%) rename src/ansys/hps/{core => client}/auth/resource/__init__.py (100%) rename src/ansys/hps/{core => client}/auth/resource/user.py (98%) rename src/ansys/hps/{core => client}/auth/schema/__init__.py (100%) rename src/ansys/hps/{core => client}/auth/schema/user.py (96%) rename src/ansys/hps/{core => client}/client.py (99%) rename src/ansys/hps/{core => client}/common/__init__.py (100%) rename src/ansys/hps/{core => client}/common/base_resource.py (100%) rename src/ansys/hps/{core => client}/common/base_schema.py (100%) rename src/ansys/hps/{core => client}/common/restricted_value.py (100%) rename src/ansys/hps/{core => client}/connection.py (100%) rename src/ansys/hps/{core => client}/exceptions.py (97%) rename src/ansys/hps/{core => client}/jms/__init__.py (100%) rename src/ansys/hps/{core => client}/jms/api/__init__.py (100%) rename src/ansys/hps/{core => client}/jms/api/base.py (98%) rename src/ansys/hps/{core => client}/jms/api/jms_api.py (95%) rename src/ansys/hps/{core => client}/jms/api/project_api.py (96%) rename src/ansys/hps/{core => client}/jms/keys.py (100%) rename src/ansys/hps/{core => client}/jms/resource/.gitignore (100%) rename src/ansys/hps/{core => client}/jms/resource/__init__.py (100%) rename src/ansys/hps/{core => client}/jms/resource/algorithm.py (98%) rename src/ansys/hps/{core => client}/jms/resource/evaluator.py (99%) rename src/ansys/hps/{core => client}/jms/resource/file.py (99%) rename src/ansys/hps/{core => client}/jms/resource/fitness_definition.py (97%) rename src/ansys/hps/{core => client}/jms/resource/job.py (99%) rename src/ansys/hps/{core => client}/jms/resource/job_definition.py (98%) rename src/ansys/hps/{core => client}/jms/resource/license_context.py (97%) rename src/ansys/hps/{core => client}/jms/resource/operation.py (98%) rename src/ansys/hps/{core => client}/jms/resource/parameter_definition.py (99%) rename src/ansys/hps/{core => client}/jms/resource/parameter_mapping.py (98%) rename src/ansys/hps/{core => client}/jms/resource/permission.py (97%) rename src/ansys/hps/{core => client}/jms/resource/project.py (98%) rename src/ansys/hps/{core => client}/jms/resource/selection.py (98%) rename src/ansys/hps/{core => client}/jms/resource/task.py (99%) rename src/ansys/hps/{core => client}/jms/resource/task_definition.py (99%) rename src/ansys/hps/{core => client}/jms/resource/task_definition_template.py (99%) rename src/ansys/hps/{core => client}/jms/schema/__init__.py (100%) rename src/ansys/hps/{core => client}/jms/schema/algorithm.py (96%) rename src/ansys/hps/{core => client}/jms/schema/evaluator.py (98%) rename src/ansys/hps/{core => client}/jms/schema/file.py (97%) rename src/ansys/hps/{core => client}/jms/schema/fitness_definition.py (98%) rename src/ansys/hps/{core => client}/jms/schema/job.py (98%) rename src/ansys/hps/{core => client}/jms/schema/job_definition.py (97%) rename src/ansys/hps/{core => client}/jms/schema/license_context.py (96%) rename src/ansys/hps/{core => client}/jms/schema/object_reference.py (100%) rename src/ansys/hps/{core => client}/jms/schema/operation.py (97%) rename src/ansys/hps/{core => client}/jms/schema/parameter_definition.py (98%) rename src/ansys/hps/{core => client}/jms/schema/parameter_mapping.py (97%) rename src/ansys/hps/{core => client}/jms/schema/permission.py (97%) rename src/ansys/hps/{core => client}/jms/schema/project.py (97%) rename src/ansys/hps/{core => client}/jms/schema/selection.py (96%) rename src/ansys/hps/{core => client}/jms/schema/task.py (98%) rename src/ansys/hps/{core => client}/jms/schema/task_definition.py (98%) rename src/ansys/hps/{core => client}/jms/schema/task_definition_template.py (99%) rename src/ansys/hps/{core => client}/rms/__init__.py (100%) rename src/ansys/hps/{core => client}/rms/api/base.py (99%) rename src/ansys/hps/{core => client}/rms/api/rms_api.py (96%) rename src/ansys/hps/{core => client}/rms/models.py (100%) rename src/ansys/hps/{core => client}/warnings.py (100%) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 8bff69311..df20ca2d5 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -11,7 +11,7 @@ on: env: MAIN_PYTHON_VERSION: '3.9' DOCUMENTATION_CNAME: 'hps.docs.pyansys.com' - PACKAGE_NAME: 'ansys-hps-core' + PACKAGE_NAME: 'ansys-hps-client' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -241,7 +241,7 @@ jobs: steps: - uses: actions/download-artifact@v3 with: - name: ansys-hps-core-artifacts + name: ansys-hps-client-artifacts path: /tmp/artifacts - name: List artifacts diff --git a/README.rst b/README.rst index 7b7e2b4e1..55e51e3a5 100644 --- a/README.rst +++ b/README.rst @@ -6,16 +6,16 @@ PyHPS :target: https://docs.pyansys.com/ :alt: PyAnsys -.. |python| image:: https://img.shields.io/pypi/pyversions/ansys-hps-core?logo=pypi - :target: https://pypi.org/project/ansys-hps-core +.. |python| image:: https://img.shields.io/pypi/pyversions/ansys-hps-client?logo=pypi + :target: https://pypi.org/project/ansys-hps-client :alt: Python -.. |pypi| image:: https://img.shields.io/pypi/v/ansys-hps-core.svg?logo=python&logoColor=white - :target: https://pypi.org/project/ansys-hps-core +.. |pypi| image:: https://img.shields.io/pypi/v/ansys-hps-client.svg?logo=python&logoColor=white + :target: https://pypi.org/project/ansys-hps-client :alt: PyPI .. |codecov| image:: https://codecov.io/gh/ansys-internal/pyhps/branch/main/graph/badge.svg - :target: https://codecov.io/gh/ansys-internal/ansys-hps-core + :target: https://codecov.io/gh/ansys-internal/ansys-hps-client :alt: Codecov .. |GH-CI| image:: https://github.com/ansys-internal/pyhps/actions/workflows/ci_cd.yml/badge.svg @@ -49,7 +49,7 @@ Then, as long as PyHPS is a private pyAnsys module not published to pypi yet, yo python -m pip install git+https://github.com/ansys-internal/pyhps -.. TODO: Enable this once pyhps is published: python -m pip install ansys-hps-core +.. TODO: Enable this once pyhps is published: python -m pip install ansys-hps-client Contribute ---------- diff --git a/doc/source/api/auth.rst b/doc/source/api/auth.rst index c30fbe12d..7ba80a52e 100644 --- a/doc/source/api/auth.rst +++ b/doc/source/api/auth.rst @@ -6,20 +6,20 @@ Authentication service The REP Authentication Service processes all REP sign ins following Open Authorization (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.core.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/rep/auth/api``. Authentication function ----------------------- -.. autofunction:: ansys.hps.core.auth.authenticate +.. autofunction:: ansys.hps.client.auth.authenticate Auth API -------- -.. autoclass:: ansys.hps.core.auth.AuthApi +.. autoclass:: ansys.hps.client.auth.AuthApi :members: User ---- -.. autoclass:: ansys.hps.core.auth.User +.. autoclass:: ansys.hps.client.auth.User :members: \ No newline at end of file diff --git a/doc/source/api/client.rst b/doc/source/api/client.rst index d95d0467f..5db948005 100644 --- a/doc/source/api/client.rst +++ b/doc/source/api/client.rst @@ -4,11 +4,11 @@ Client Connection module ------------------------------------------ -.. automodule:: ansys.hps.core.connection +.. automodule:: ansys.hps.client.connection :members: Client object ------------------------------------ -.. autoclass:: ansys.hps.core.Client +.. autoclass:: ansys.hps.client.Client :members: \ No newline at end of file diff --git a/doc/source/api/exceptions.rst b/doc/source/api/exceptions.rst index eead18b4e..9abb82310 100644 --- a/doc/source/api/exceptions.rst +++ b/doc/source/api/exceptions.rst @@ -3,13 +3,13 @@ Exceptions HTTP requests returning an unsuccessful status code raise: -* :exc:`ansys.hps.core.ClientError` for client errors (4xx status code. For example, bad syntax or not found) -* :exc:`ansys.hps.core.APIError` for server errors (5xx status code. For example, internal server error or not implemented) +* :exc:`ansys.hps.client.ClientError` for client errors (4xx status code. For example, bad syntax or not found) +* :exc:`ansys.hps.client.APIError` for server errors (5xx status code. For example, internal server error or not implemented) -All exceptions that the Ansys REP clients explicitly raise inherit from :exc:`ansys.hps.core.HPSError`. +All exceptions that the Ansys REP clients explicitly raise inherit from :exc:`ansys.hps.client.HPSError`. -.. autoexception:: ansys.hps.core.HPSError +.. autoexception:: ansys.hps.client.HPSError :members: -.. autoexception:: ansys.hps.core.APIError -.. autoexception:: ansys.hps.core.ClientError \ No newline at end of file +.. autoexception:: ansys.hps.client.APIError +.. autoexception:: ansys.hps.client.ClientError \ No newline at end of file diff --git a/doc/source/api/jms.rst b/doc/source/api/jms.rst index 05e864d6f..afaa79586 100644 --- a/doc/source/api/jms.rst +++ b/doc/source/api/jms.rst @@ -3,20 +3,20 @@ 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.core.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/rep/jms/api``. APIs ---- JMS API ^^^^^^^ -.. autoclass:: ansys.hps.core.jms.JmsApi +.. autoclass:: ansys.hps.client.jms.JmsApi :members: :undoc-members: Project API ^^^^^^^^^^^ -.. autoclass:: ansys.hps.core.jms.ProjectApi +.. autoclass:: ansys.hps.client.jms.ProjectApi :members: :undoc-members: @@ -27,13 +27,13 @@ Resources File ^^^^ -.. autoclass:: ansys.hps.core.jms.File +.. autoclass:: ansys.hps.client.jms.File :members: Project ^^^^^^^ -.. autoclass:: ansys.hps.core.jms.Project +.. autoclass:: ansys.hps.client.jms.Project :members: :undoc-members: :exclude-members: Meta @@ -41,54 +41,54 @@ Project Fitness definition ^^^^^^^^^^^^^^^^^^ -.. autoclass:: ansys.hps.core.jms.FitnessTermDefinition +.. autoclass:: ansys.hps.client.jms.FitnessTermDefinition :members: -.. autoclass:: ansys.hps.core.jms.FitnessDefinition +.. autoclass:: ansys.hps.client.jms.FitnessDefinition :members: Parameters ^^^^^^^^^^ -.. autoclass:: ansys.hps.core.jms.FloatParameterDefinition +.. autoclass:: ansys.hps.client.jms.FloatParameterDefinition :members: -.. autoclass:: ansys.hps.core.jms.BoolParameterDefinition +.. autoclass:: ansys.hps.client.jms.BoolParameterDefinition :members: -.. autoclass:: ansys.hps.core.jms.IntParameterDefinition +.. autoclass:: ansys.hps.client.jms.IntParameterDefinition :members: -.. autoclass:: ansys.hps.core.jms.StringParameterDefinition +.. autoclass:: ansys.hps.client.jms.StringParameterDefinition :members: -.. autoclass:: ansys.hps.core.jms.ParameterMapping +.. autoclass:: ansys.hps.client.jms.ParameterMapping :members: Task definition ^^^^^^^^^^^^^^^ -.. autoclass:: ansys.hps.core.jms.Software +.. autoclass:: ansys.hps.client.jms.Software :members: -.. autoclass:: ansys.hps.core.jms.ResourceRequirements +.. autoclass:: ansys.hps.client.jms.ResourceRequirements :members: -.. autoclass:: ansys.hps.core.jms.SuccessCriteria +.. autoclass:: ansys.hps.client.jms.SuccessCriteria :members: -.. autoclass:: ansys.hps.core.jms.Licensing +.. autoclass:: ansys.hps.client.jms.Licensing :members: -.. autoclass:: ansys.hps.core.jms.TaskDefinition +.. autoclass:: ansys.hps.client.jms.TaskDefinition :members: Job definition ^^^^^^^^^^^^^^ -.. autoclass:: ansys.hps.core.jms.JobDefinition +.. autoclass:: ansys.hps.client.jms.JobDefinition :members: :undoc-members: :exclude-members: Meta @@ -96,58 +96,58 @@ Job definition Task ^^^^ -.. autoclass:: ansys.hps.core.jms.Task +.. autoclass:: ansys.hps.client.jms.Task :members: Job ^^^ -.. autoclass:: ansys.hps.core.jms.Job +.. autoclass:: ansys.hps.client.jms.Job :members: Job selection ^^^^^^^^^^^^^ -.. autoclass:: ansys.hps.core.jms.JobSelection +.. autoclass:: ansys.hps.client.jms.JobSelection :members: Design exploration algorithm ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. autoclass:: ansys.hps.core.jms.Algorithm +.. autoclass:: ansys.hps.client.jms.Algorithm :members: Evaluator ^^^^^^^^^ -.. autoclass:: ansys.hps.core.jms.Evaluator +.. autoclass:: ansys.hps.client.jms.Evaluator :members: Task definition template ^^^^^^^^^^^^^^^^^^^^^^^^ -.. autoclass:: ansys.hps.core.jms.TemplateProperty +.. autoclass:: ansys.hps.client.jms.TemplateProperty :members: -.. autoclass:: ansys.hps.core.jms.TemplateResourceRequirements +.. autoclass:: ansys.hps.client.jms.TemplateResourceRequirements :members: -.. autoclass:: ansys.hps.core.jms.TemplateInputFile +.. autoclass:: ansys.hps.client.jms.TemplateInputFile :members: -.. autoclass:: ansys.hps.core.jms.TemplateOutputFile +.. autoclass:: ansys.hps.client.jms.TemplateOutputFile :members: -.. autoclass:: ansys.hps.core.jms.TaskDefinitionTemplate +.. autoclass:: ansys.hps.client.jms.TaskDefinitionTemplate :members: Permissions ^^^^^^^^^^^ -.. autoclass:: ansys.hps.core.jms.Permission +.. autoclass:: ansys.hps.client.jms.Permission :members: \ No newline at end of file diff --git a/doc/source/api/rms.rst b/doc/source/api/rms.rst index 86a0c2e82..3b51973ef 100644 --- a/doc/source/api/rms.rst +++ b/doc/source/api/rms.rst @@ -3,14 +3,14 @@ Resource management service Ansys REP includes the Resource Management Service (RMS), which is the main service for managing heterogeneous compute resources. -The Python subpackage ``ansys.hps.core.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/rep/rms/api``. APIs -------------------------------------- RMS API ^^^^^^^ -.. autoclass:: ansys.hps.core.rms.RmsApi +.. autoclass:: ansys.hps.client.rms.RmsApi :members: :undoc-members: @@ -21,24 +21,24 @@ Resources Evaluator registration ^^^^^^^^^^^^^^^^^^^^^^ -.. autopydantic_model:: ansys.hps.core.rms.EvaluatorRegistration +.. autopydantic_model:: ansys.hps.client.rms.EvaluatorRegistration Evaluator configuration ^^^^^^^^^^^^^^^^^^^^^^^ -.. autopydantic_model:: ansys.hps.core.rms.EvaluatorConfiguration +.. autopydantic_model:: ansys.hps.client.rms.EvaluatorConfiguration Evaluator configuration update ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. autopydantic_model:: ansys.hps.core.rms.EvaluatorConfigurationUpdate +.. autopydantic_model:: ansys.hps.client.rms.EvaluatorConfigurationUpdate Scaler configuration ^^^^^^^^^^^^^^^^^^^^ -.. autopydantic_model:: ansys.hps.core.rms.ScalerRegistration +.. autopydantic_model:: ansys.hps.client.rms.ScalerRegistration Compute resource set ^^^^^^^^^^^^^^^^^^^^ -.. autopydantic_model:: ansys.hps.core.rms.ComputeResourceSet +.. autopydantic_model:: ansys.hps.client.rms.ComputeResourceSet diff --git a/doc/source/conf.py b/doc/source/conf.py index d15bd9e9b..6ac6ed388 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -5,7 +5,7 @@ from ansys_sphinx_theme import ansys_favicon, get_version_match, pyansys_logo_black -from ansys.hps.core import __ansys_apps_version__, __version__ +from ansys.hps.client import __ansys_apps_version__, __version__ sys.path.append(os.path.abspath(os.path.dirname(__file__))) @@ -178,7 +178,7 @@ latex_documents = [ ( "index", - "ansys-hps-core.tex", + "ansys-hps-client.tex", "Ansys HPS Python Client Documentation", author, "manual", @@ -211,7 +211,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ("index", "ansys-hps-core", "Ansys HPS Python Client Documentation", ["ANSYS, Inc."], 1) + ("index", "ansys-hps-client", "Ansys HPS Python Client Documentation", ["ANSYS, Inc."], 1) ] # If true, show URL addresses after external links. @@ -226,7 +226,7 @@ # texinfo_documents = [ # ( # "index", -# "ansys-hps-core", +# "ansys-hps-client", # "Ansys HPS Python Client Documentation", # "ANSYS, Inc.", # "JMS", diff --git a/doc/source/examples/index.rst b/doc/source/examples/index.rst index 853552c21..e16414762 100644 --- a/doc/source/examples/index.rst +++ b/doc/source/examples/index.rst @@ -3,7 +3,7 @@ Examples ======== -Here you can find some examples showing how to interact with a REP server in Python using the ``ansys-hps-core``. +Here you can find some examples showing how to interact with a REP server in Python using the ``ansys-hps-client``. Examples consist of a Python script plus some data files (e.g. solver input files). Many of the Python scripts can be executed with the following command line arguments: diff --git a/doc/source/index.rst b/doc/source/index.rst index 0a73a061f..5f4f948ca 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -15,7 +15,7 @@ Introduction Ansys HPC Platform Services (HPS) is a set of technology components designed to help you manage the execution of simulations while making use of your full range of computing assets. -``ansys-hps-core`` brings Ansys HPS to your Python application. +``ansys-hps-client`` brings Ansys HPS to your Python application. Wrapping around the HPS REST APIs, it allows you to: * create new projects and modify existing ones diff --git a/doc/source/quickstart.rst b/doc/source/quickstart.rst index 9a18a8e3c..c5e93184c 100644 --- a/doc/source/quickstart.rst +++ b/doc/source/quickstart.rst @@ -9,7 +9,7 @@ while detailed documentation can be found in the :ref:`Code documentation `_ for instructions. -- A Python shell with ``ansys-hps-core`` installed. If you haven't installed it yet, please refer to the :ref:`Installation ` guide. +- A Python shell with ``ansys-hps-client`` installed. If you haven't installed it yet, please refer to the :ref:`Installation ` guide. Connect to HPC platform services @@ -19,8 +19,8 @@ Start by connecting to an HPS deployment running on the localhost with default u .. code-block:: python - from ansys.hps.core import Client - from ansys.hps.core.jms import JmsApi, ProjectApi + from ansys.hps.client import Client + from ansys.hps.client.jms import JmsApi, ProjectApi client = Client(url="https://localhost:8443/rep", username="repuser", password="repuser") @@ -283,8 +283,8 @@ Admin users with the Keycloak "manage-users" role can create new users as well a .. code-block:: python - from ansys.hps.core import Client - from ansys.hps.core.auth import AuthApi, User + from ansys.hps.client import Client + from ansys.hps.client.auth import AuthApi, User client = Client(url="https://localhost:8443/rep/", username="repadmin", password="repadmin") auth_api = AuthApi(client) @@ -311,14 +311,14 @@ Admin users with the Keycloak "manage-users" role can create new users as well a Exception handling ------------------------------------------ -All exceptions that the Ansys REP client explicitly raise inherit from :exc:`ansys.hps.core.HPSError`. +All exceptions that the Ansys REP client explicitly raise inherit from :exc:`ansys.hps.client.HPSError`. Client Errors are raised for 4xx HTTP status codes, while API Errors are raised for 5xx HTTP status codes (server side errors). For example, instantiating a client with invalid credentials returns a 401 Client Error. .. code-block:: python - from ansys.hps.core import Client, HPSError + from ansys.hps.client import Client, HPSError try: client = Client(url="https://localhost:8443/rep/", username="repuser", password="wrong_psw") @@ -333,7 +333,7 @@ A *get* call on a non-existing resource returns a 404 Client Error. .. code-block:: python - from ansys.hps.core.jms import JmsApi + from ansys.hps.client.jms import JmsApi jms_api = JmsApi(client) try: diff --git a/examples/cfx_static_mixer/project_setup.py b/examples/cfx_static_mixer/project_setup.py index a5f8a47d4..8413044a8 100644 --- a/examples/cfx_static_mixer/project_setup.py +++ b/examples/cfx_static_mixer/project_setup.py @@ -27,8 +27,8 @@ import logging import os -from ansys.hps.core import Client, HPSError, __ansys_apps_version__ -from ansys.hps.core.jms import ( +from ansys.hps.client import Client, HPSError, __ansys_apps_version__ +from ansys.hps.client.jms import ( File, JmsApi, Job, diff --git a/examples/fluent_2d_heat_exchanger/project_setup.py b/examples/fluent_2d_heat_exchanger/project_setup.py index aa4ec3cbf..71ca335fd 100644 --- a/examples/fluent_2d_heat_exchanger/project_setup.py +++ b/examples/fluent_2d_heat_exchanger/project_setup.py @@ -28,8 +28,8 @@ import logging import os -from ansys.hps.core import Client, HPSError, __ansys_apps_version__ -from ansys.hps.core.jms import ( +from ansys.hps.client import Client, HPSError, __ansys_apps_version__ +from ansys.hps.client.jms import ( File, JmsApi, Job, diff --git a/examples/fluent_nozzle/project_setup.py b/examples/fluent_nozzle/project_setup.py index 403efe3fc..6d8e6e2c9 100644 --- a/examples/fluent_nozzle/project_setup.py +++ b/examples/fluent_nozzle/project_setup.py @@ -27,8 +27,8 @@ import logging import os -from ansys.hps.core import Client, HPSError, __ansys_apps_version__ -from ansys.hps.core.jms import ( +from ansys.hps.client import Client, HPSError, __ansys_apps_version__ +from ansys.hps.client.jms import ( File, JmsApi, Job, diff --git a/examples/lsdyna_cylinder_plate/lsdyna_job.py b/examples/lsdyna_cylinder_plate/lsdyna_job.py index cf27e9324..4edde6b38 100644 --- a/examples/lsdyna_cylinder_plate/lsdyna_job.py +++ b/examples/lsdyna_cylinder_plate/lsdyna_job.py @@ -45,8 +45,8 @@ import os import time -from ansys.hps.core import Client, HPSError -from ansys.hps.core.jms import ( +from ansys.hps.client import Client, HPSError +from ansys.hps.client.jms import ( File, JmsApi, Job, diff --git a/examples/mapdl_linked_analyses/project_setup.py b/examples/mapdl_linked_analyses/project_setup.py index dbec5b8a2..8c36bb0c2 100644 --- a/examples/mapdl_linked_analyses/project_setup.py +++ b/examples/mapdl_linked_analyses/project_setup.py @@ -46,8 +46,8 @@ import os from typing import List, Tuple -from ansys.hps.core import Client, HPSError, __ansys_apps_version__ -from ansys.hps.core.jms import ( +from ansys.hps.client import Client, HPSError, __ansys_apps_version__ +from ansys.hps.client.jms import ( File, JmsApi, Job, diff --git a/examples/mapdl_motorbike_frame/project_query.py b/examples/mapdl_motorbike_frame/project_query.py index ed832f077..78bc33356 100644 --- a/examples/mapdl_motorbike_frame/project_query.py +++ b/examples/mapdl_motorbike_frame/project_query.py @@ -32,8 +32,8 @@ import os from statistics import mean, stdev -from ansys.hps.core import Client, HPSError -from ansys.hps.core.jms import JmsApi, ProjectApi +from ansys.hps.client import Client, HPSError +from ansys.hps.client.jms import JmsApi, ProjectApi log = logging.getLogger(__name__) diff --git a/examples/mapdl_motorbike_frame/project_setup.py b/examples/mapdl_motorbike_frame/project_setup.py index c0dce02fc..9b28dca12 100644 --- a/examples/mapdl_motorbike_frame/project_setup.py +++ b/examples/mapdl_motorbike_frame/project_setup.py @@ -31,8 +31,8 @@ import os import random -from ansys.hps.core import Client, HPSError, __ansys_apps_version__ -from ansys.hps.core.jms import ( +from ansys.hps.client import Client, HPSError, __ansys_apps_version__ +from ansys.hps.client.jms import ( File, FitnessDefinition, FloatParameterDefinition, diff --git a/examples/mapdl_motorbike_frame/task_files.py b/examples/mapdl_motorbike_frame/task_files.py index 18396a312..9215d3fa9 100644 --- a/examples/mapdl_motorbike_frame/task_files.py +++ b/examples/mapdl_motorbike_frame/task_files.py @@ -25,8 +25,8 @@ import logging import os -from ansys.hps.core import HPSError -from ansys.hps.core.jms import Client, File +from ansys.hps.client import HPSError +from ansys.hps.client.jms import Client, File log = logging.getLogger(__name__) diff --git a/examples/mapdl_tyre_performance/project_setup.py b/examples/mapdl_tyre_performance/project_setup.py index 82b10a378..9d4001b29 100644 --- a/examples/mapdl_tyre_performance/project_setup.py +++ b/examples/mapdl_tyre_performance/project_setup.py @@ -32,8 +32,8 @@ import os import random -from ansys.hps.core import Client, HPSError, __ansys_apps_version__ -from ansys.hps.core.jms import ( +from ansys.hps.client import Client, HPSError, __ansys_apps_version__ +from ansys.hps.client.jms import ( File, FloatParameterDefinition, JmsApi, diff --git a/examples/python_linked_multi_process_step/project_setup.py b/examples/python_linked_multi_process_step/project_setup.py index a57e3ab94..1c958bd14 100644 --- a/examples/python_linked_multi_process_step/project_setup.py +++ b/examples/python_linked_multi_process_step/project_setup.py @@ -30,8 +30,8 @@ import os import random -from ansys.hps.core import Client, HPSError -from ansys.hps.core.jms import ( +from ansys.hps.client import Client, HPSError +from ansys.hps.client.jms import ( File, FloatParameterDefinition, JmsApi, diff --git a/examples/python_multi_process_step/project_setup.py b/examples/python_multi_process_step/project_setup.py index b950285b8..2a33295ca 100644 --- a/examples/python_multi_process_step/project_setup.py +++ b/examples/python_multi_process_step/project_setup.py @@ -47,8 +47,8 @@ import os import random -from ansys.hps.core import Client, HPSError -from ansys.hps.core.jms import ( +from ansys.hps.client import Client, HPSError +from ansys.hps.client.jms import ( File, IntParameterDefinition, JmsApi, diff --git a/examples/python_multi_process_step/task_files.py b/examples/python_multi_process_step/task_files.py index e966545a9..5e08936dd 100644 --- a/examples/python_multi_process_step/task_files.py +++ b/examples/python_multi_process_step/task_files.py @@ -32,7 +32,7 @@ import os from tempfile import NamedTemporaryFile -from ansys.hps.core.jms import File +from ansys.hps.client.jms import File log = logging.getLogger(__name__) diff --git a/examples/python_two_bar_truss_problem/project_setup.py b/examples/python_two_bar_truss_problem/project_setup.py index 0db1872f5..7614e128d 100644 --- a/examples/python_two_bar_truss_problem/project_setup.py +++ b/examples/python_two_bar_truss_problem/project_setup.py @@ -29,8 +29,8 @@ import os import random -from ansys.hps.core import Client, HPSError -from ansys.hps.core.jms import ( +from ansys.hps.client import Client, HPSError +from ansys.hps.client.jms import ( File, FitnessDefinition, FloatParameterDefinition, diff --git a/generate_resources.py b/generate_resources.py index aea43d59b..75ca5bdd8 100644 --- a/generate_resources.py +++ b/generate_resources.py @@ -31,8 +31,8 @@ import marshmallow -from ansys.hps.core.common.restricted_value import RestrictedValue -from ansys.hps.core.jms.schema.object_reference import IdReference, IdReferenceList +from ansys.hps.client.common.restricted_value import RestrictedValue +from ansys.hps.client.jms.schema.object_reference import IdReference, IdReferenceList # we define here which resources to auto-generate # some are excluded or done only partially (e.g. File) @@ -394,7 +394,7 @@ def get_resource_imports(resource, base_class): imports = [ "from marshmallow.utils import missing", - "from ansys.hps.core.common import Object", + "from ansys.hps.client.common import Object", # f"from {base_class['path']}.{base_class['filename']} import {base_class['name']}", f"from ..schema.{resource['schema_filename']} import {resource['schema']}", ] @@ -438,7 +438,7 @@ def __init__(self, return code -def process_resources(subpackage, resources, base_class_path="ansys.hps.core"): +def process_resources(subpackage, resources, base_class_path="ansys.hps.client"): target_folder = os.path.join("ansys", "hps", "client", subpackage, "resource") resources_code = {} @@ -447,7 +447,7 @@ def process_resources(subpackage, resources, base_class_path="ansys.hps.core"): # dynamically load resource schema module = importlib.import_module( - f"ansys.hps.core.{subpackage}.schema.{resource['schema_filename']}" + f"ansys.hps.client.{subpackage}.schema.{resource['schema_filename']}" ) resource_class = getattr(module, resource["schema"]) @@ -465,7 +465,7 @@ def process_resources(subpackage, resources, base_class_path="ansys.hps.core"): base_class = {"name": "Object", "filename": "common", "path": base_class_path} if resource.get("base_class", None): base_class["name"] = resource["base_class"] - base_class["path"] = "ansys.hps.core.jms.resource" + base_class["path"] = "ansys.hps.client.jms.resource" base_class["filename"] = next( (r["resource_filename"] for r in resources if r["class"] == resource["base_class"]), None, diff --git a/pyproject.toml b/pyproject.toml index fb3d0051f..5bfb5e728 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi" [project] # Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections -name = "ansys-hps-core" +name = "ansys-hps-client" version = "0.6.dev0" description = "A python client for Ansys HPC Platform Services" readme = "README.rst" @@ -71,7 +71,7 @@ Homepage = "https://github.com/ansys-internal/pyhps" Tracker = "https://github.com/ansys-internal/pyhps/issues" [tool.flit.module] -name = "ansys.hps.core" +name = "ansys.hps.client" [tool.black] line-length = 100 @@ -109,5 +109,5 @@ markers = [ filterwarnings = [ "ignore::urllib3.exceptions.InsecureRequestWarning", "ignore::DeprecationWarning:pkg_resources.*", - "ignore::ansys.hps.core.UnverifiedHTTPSRequestsWarning", + "ignore::ansys.hps.client.UnverifiedHTTPSRequestsWarning", ] \ No newline at end of file diff --git a/src/ansys/hps/core/__init__.py b/src/ansys/hps/client/__init__.py similarity index 100% rename from src/ansys/hps/core/__init__.py rename to src/ansys/hps/client/__init__.py diff --git a/src/ansys/hps/core/__version__.py b/src/ansys/hps/client/__version__.py similarity index 96% rename from src/ansys/hps/core/__version__.py rename to src/ansys/hps/client/__version__.py index b75fb6a39..2f4b30339 100644 --- a/src/ansys/hps/core/__version__.py +++ b/src/ansys/hps/client/__version__.py @@ -27,7 +27,7 @@ # Read from the pyproject.toml # major, minor, patch -__version__ = importlib_metadata.version("ansys-hps-core") +__version__ = importlib_metadata.version("ansys-hps-client") # this is only a convenience to default the version # of Ansys simulation applications in pyhps examples diff --git a/src/ansys/hps/core/auth/__init__.py b/src/ansys/hps/client/auth/__init__.py similarity index 100% rename from src/ansys/hps/core/auth/__init__.py rename to src/ansys/hps/client/auth/__init__.py diff --git a/src/ansys/hps/core/auth/api/__init__.py b/src/ansys/hps/client/auth/api/__init__.py similarity index 100% rename from src/ansys/hps/core/auth/api/__init__.py rename to src/ansys/hps/client/auth/api/__init__.py diff --git a/src/ansys/hps/core/auth/api/auth_api.py b/src/ansys/hps/client/auth/api/auth_api.py similarity index 94% rename from src/ansys/hps/core/auth/api/auth_api.py rename to src/ansys/hps/client/auth/api/auth_api.py index eaad96b47..442c98327 100644 --- a/src/ansys/hps/core/auth/api/auth_api.py +++ b/src/ansys/hps/client/auth/api/auth_api.py @@ -46,8 +46,8 @@ class AuthApi: Get users whose first name contains "john": - >>> from ansys.hps.core import Client - >>> from ansys.hps.core.auth import AuthApi, User + >>> 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" ... ) @@ -111,7 +111,7 @@ def get_user_realm_roles(self, id: str) -> List[str]: def user_is_admin(self, id: str) -> bool: """Check whether the user is system admin""" - from ansys.hps.core.jms import JmsApi + from ansys.hps.client.jms import JmsApi # the admin keys are configurable settings of JMS # they need to be queried, can't be hardcoded @@ -134,7 +134,7 @@ def create_user(self, user: User, as_objects=True) -> User: """Create a new user. Args: - user (:class:`ansys.hps.core.auth.User`): A User object. Defaults to None. + user (:class:`ansys.hps.client.auth.User`): A User object. Defaults to None. as_objects (bool, optional): Defaults to True. """ return create_user(self.keycloak_admin_client, user, as_objects=as_objects) @@ -143,7 +143,7 @@ def update_user(self, user: User, as_objects=True) -> User: """Modify an existing user. Args: - user (:class:`ansys.hps.core.auth.User`): A User object. Defaults to None. + user (:class:`ansys.hps.client.auth.User`): A User object. Defaults to None. as_objects (bool, optional): Defaults to True. """ return update_user(self.keycloak_admin_client, user, as_objects=as_objects) @@ -152,7 +152,7 @@ def delete_user(self, user: User) -> None: """Delete an existing user. Args: - user (:class:`ansys.hps.core.auth.User`): A User object. Defaults to None. + user (:class:`ansys.hps.client.auth.User`): A User object. Defaults to None. """ return self.keycloak_admin_client.delete_user(user.id) diff --git a/src/ansys/hps/core/auth/authenticate.py b/src/ansys/hps/client/auth/authenticate.py similarity index 100% rename from src/ansys/hps/core/auth/authenticate.py rename to src/ansys/hps/client/auth/authenticate.py diff --git a/src/ansys/hps/core/auth/resource/__init__.py b/src/ansys/hps/client/auth/resource/__init__.py similarity index 100% rename from src/ansys/hps/core/auth/resource/__init__.py rename to src/ansys/hps/client/auth/resource/__init__.py diff --git a/src/ansys/hps/core/auth/resource/user.py b/src/ansys/hps/client/auth/resource/user.py similarity index 98% rename from src/ansys/hps/core/auth/resource/user.py rename to src/ansys/hps/client/auth/resource/user.py index 00c64e929..fe5f6dfa4 100644 --- a/src/ansys/hps/core/auth/resource/user.py +++ b/src/ansys/hps/client/auth/resource/user.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.user import UserSchema diff --git a/src/ansys/hps/core/auth/schema/__init__.py b/src/ansys/hps/client/auth/schema/__init__.py similarity index 100% rename from src/ansys/hps/core/auth/schema/__init__.py rename to src/ansys/hps/client/auth/schema/__init__.py diff --git a/src/ansys/hps/core/auth/schema/user.py b/src/ansys/hps/client/auth/schema/user.py similarity index 96% rename from src/ansys/hps/core/auth/schema/user.py rename to src/ansys/hps/client/auth/schema/user.py index e39d79e2b..a2bcbc278 100644 --- a/src/ansys/hps/core/auth/schema/user.py +++ b/src/ansys/hps/client/auth/schema/user.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.core.common.base_schema import BaseSchema +from ansys.hps.client.common.base_schema import BaseSchema class UserSchema(BaseSchema): diff --git a/src/ansys/hps/core/client.py b/src/ansys/hps/client/client.py similarity index 99% rename from src/ansys/hps/core/client.py rename to src/ansys/hps/client/client.py index 140994ea4..cbbd205ca 100644 --- a/src/ansys/hps/core/client.py +++ b/src/ansys/hps/client/client.py @@ -83,7 +83,7 @@ class Client(object): Create client object and connect to HPS with username and password - >>> from ansys.hps.core import Client + >>> from ansys.hps.client import Client >>> cl = Client( ... url="https://localhost:8443/rep", ... username="repuser", diff --git a/src/ansys/hps/core/common/__init__.py b/src/ansys/hps/client/common/__init__.py similarity index 100% rename from src/ansys/hps/core/common/__init__.py rename to src/ansys/hps/client/common/__init__.py diff --git a/src/ansys/hps/core/common/base_resource.py b/src/ansys/hps/client/common/base_resource.py similarity index 100% rename from src/ansys/hps/core/common/base_resource.py rename to src/ansys/hps/client/common/base_resource.py diff --git a/src/ansys/hps/core/common/base_schema.py b/src/ansys/hps/client/common/base_schema.py similarity index 100% rename from src/ansys/hps/core/common/base_schema.py rename to src/ansys/hps/client/common/base_schema.py diff --git a/src/ansys/hps/core/common/restricted_value.py b/src/ansys/hps/client/common/restricted_value.py similarity index 100% rename from src/ansys/hps/core/common/restricted_value.py rename to src/ansys/hps/client/common/restricted_value.py diff --git a/src/ansys/hps/core/connection.py b/src/ansys/hps/client/connection.py similarity index 100% rename from src/ansys/hps/core/connection.py rename to src/ansys/hps/client/connection.py diff --git a/src/ansys/hps/core/exceptions.py b/src/ansys/hps/client/exceptions.py similarity index 97% rename from src/ansys/hps/core/exceptions.py rename to src/ansys/hps/client/exceptions.py index 3f893b053..e8b915dca 100644 --- a/src/ansys/hps/core/exceptions.py +++ b/src/ansys/hps/client/exceptions.py @@ -30,8 +30,8 @@ def __init__(self, *args, **kwargs): Derives from :class:`requests.exceptions.RequestException`. Example: - >>> from ansys.hps.core import HPSError - >>> from ansys.hps.core.jms import Client + >>> 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", diff --git a/src/ansys/hps/core/jms/__init__.py b/src/ansys/hps/client/jms/__init__.py similarity index 100% rename from src/ansys/hps/core/jms/__init__.py rename to src/ansys/hps/client/jms/__init__.py diff --git a/src/ansys/hps/core/jms/api/__init__.py b/src/ansys/hps/client/jms/api/__init__.py similarity index 100% rename from src/ansys/hps/core/jms/api/__init__.py rename to src/ansys/hps/client/jms/api/__init__.py diff --git a/src/ansys/hps/core/jms/api/base.py b/src/ansys/hps/client/jms/api/base.py similarity index 98% rename from src/ansys/hps/core/jms/api/base.py rename to src/ansys/hps/client/jms/api/base.py index fbc253e0d..e36e79bc9 100644 --- a/src/ansys/hps/core/jms/api/base.py +++ b/src/ansys/hps/client/jms/api/base.py @@ -26,8 +26,8 @@ from requests import Session -from ansys.hps.core.common import Object -from ansys.hps.core.exceptions import ClientError +from ansys.hps.client.common import Object +from ansys.hps.client.exceptions import ClientError log = logging.getLogger(__name__) diff --git a/src/ansys/hps/core/jms/api/jms_api.py b/src/ansys/hps/client/jms/api/jms_api.py similarity index 95% rename from src/ansys/hps/core/jms/api/jms_api.py rename to src/ansys/hps/client/jms/api/jms_api.py index 1553be6e9..4386e48b3 100644 --- a/src/ansys/hps/core/jms/api/jms_api.py +++ b/src/ansys/hps/client/jms/api/jms_api.py @@ -29,11 +29,11 @@ import backoff import requests -from ansys.hps.core.client import Client -from ansys.hps.core.common import Object -from ansys.hps.core.exceptions import HPSError -from ansys.hps.core.jms.resource import Operation, Permission, Project, TaskDefinitionTemplate -from ansys.hps.core.jms.schema.project import ProjectSchema +from ansys.hps.client.client import Client +from ansys.hps.client.common import Object +from ansys.hps.client.exceptions import HPSError +from ansys.hps.client.jms.resource import Operation, Permission, Project, TaskDefinitionTemplate +from ansys.hps.client.jms.schema.project import ProjectSchema from .base import copy_objects as base_copy_objects from .base import create_objects, delete_objects, get_object, get_objects, update_objects @@ -54,8 +54,8 @@ class JmsApi(object): Create a new project - >>> from ansys.hps.core import Client - >>> from ansys.hps.core.jms import JmsApi, Project + >>> 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" ... ) @@ -148,7 +148,7 @@ def create_task_definition_templates( """Create new task definition templates Args: - templates (list of :class:`ansys.hps.core.jms.TaskDefinitionTemplate`): + templates (list of :class:`ansys.hps.client.jms.TaskDefinitionTemplate`): A list of task definition templates """ return create_objects( @@ -166,7 +166,7 @@ def update_task_definition_templates( """Update existing task definition templates Args: - templates (list of :class:`ansys.hps.core.jms.TaskDefinitionTemplate`): + templates (list of :class:`ansys.hps.client.jms.TaskDefinitionTemplate`): A list of task definition templates """ return update_objects( @@ -182,7 +182,7 @@ def delete_task_definition_templates(self, templates: List[TaskDefinitionTemplat """Delete existing task definition templates Args: - templates (list of :class:`ansys.hps.core.jms.TaskDefinitionTemplate`): + templates (list of :class:`ansys.hps.client.jms.TaskDefinitionTemplate`): A list of task definition templates """ return delete_objects(self.client.session, self.url, templates, TaskDefinitionTemplate) diff --git a/src/ansys/hps/core/jms/api/project_api.py b/src/ansys/hps/client/jms/api/project_api.py similarity index 96% rename from src/ansys/hps/core/jms/api/project_api.py rename to src/ansys/hps/client/jms/api/project_api.py index 71b85c736..7770191c7 100644 --- a/src/ansys/hps/core/jms/api/project_api.py +++ b/src/ansys/hps/client/jms/api/project_api.py @@ -29,10 +29,10 @@ import requests -from ansys.hps.core.client import Client -from ansys.hps.core.common import Object -from ansys.hps.core.exceptions import HPSError -from ansys.hps.core.jms.resource import ( +from ansys.hps.client.client import Client +from ansys.hps.client.common import Object +from ansys.hps.client.exceptions import HPSError +from ansys.hps.client.jms.resource import ( Algorithm, File, Job, @@ -66,8 +66,8 @@ class ProjectApi: Examples -------- - >>> from ansys.hps.core import Client - >>> from ansys.hps.core.jms import JmsApi, Project, 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" ... ) @@ -150,7 +150,7 @@ def get_files(self, as_objects=True, content=False, **query_params) -> List[File """ Return a list of file resources, optionally filtered by given query parameters. If content=True, each files content is downloaded as well and stored in memory - as :attr:`ansys.hps.core.jms.File.content`. + as :attr:`ansys.hps.client.jms.File.content`. """ return get_files(self, as_objects=as_objects, content=content, **query_params) @@ -306,11 +306,11 @@ def create_jobs(self, jobs: List[Job], as_objects=True) -> List[Job]: """Create new jobs Args: - jobs (list of :class:`ansys.hps.core.jms.Job`): A list of Job objects + jobs (list of :class:`ansys.hps.client.jms.Job`): A list of Job objects as_objects (bool): Whether to return jobs as objects or dictionaries Returns: - List of :class:`ansys.hps.core.jms.Job` or list of dict if `as_objects` is False + List of :class:`ansys.hps.client.jms.Job` or list of dict if `as_objects` is False """ return self._create_objects(jobs, Job, as_objects=as_objects) @@ -339,11 +339,11 @@ def update_jobs(self, jobs: List[Job], as_objects=True) -> List[Job]: """Update existing jobs Args: - jobs (list of :class:`ansys.hps.core.jms.Job`): A list of job objects + jobs (list of :class:`ansys.hps.client.jms.Job`): A list of job objects as_objects (bool): Whether to return jobs as objects or dictionaries Returns: - List of :class:`ansys.hps.core.jms.Job` or list of dict if `as_objects` is True + List of :class:`ansys.hps.client.jms.Job` or list of dict if `as_objects` is True """ return self._update_objects(jobs, Job, as_objects=as_objects) @@ -351,7 +351,7 @@ def delete_jobs(self, jobs: List[Job]): """Delete existing jobs Args: - jobs (list of :class:`ansys.hps.core.jms.Job`): A list of Job objects + jobs (list of :class:`ansys.hps.client.jms.Job`): A list of Job objects Note that only the ``id`` field of the Job objects need to be filled; the other fields can be empty. diff --git a/src/ansys/hps/core/jms/keys.py b/src/ansys/hps/client/jms/keys.py similarity index 100% rename from src/ansys/hps/core/jms/keys.py rename to src/ansys/hps/client/jms/keys.py diff --git a/src/ansys/hps/core/jms/resource/.gitignore b/src/ansys/hps/client/jms/resource/.gitignore similarity index 100% rename from src/ansys/hps/core/jms/resource/.gitignore rename to src/ansys/hps/client/jms/resource/.gitignore diff --git a/src/ansys/hps/core/jms/resource/__init__.py b/src/ansys/hps/client/jms/resource/__init__.py similarity index 100% rename from src/ansys/hps/core/jms/resource/__init__.py rename to src/ansys/hps/client/jms/resource/__init__.py diff --git a/src/ansys/hps/core/jms/resource/algorithm.py b/src/ansys/hps/client/jms/resource/algorithm.py similarity index 98% rename from src/ansys/hps/core/jms/resource/algorithm.py rename to src/ansys/hps/client/jms/resource/algorithm.py index bf6a47498..015d77a79 100644 --- a/src/ansys/hps/core/jms/resource/algorithm.py +++ b/src/ansys/hps/client/jms/resource/algorithm.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.algorithm import AlgorithmSchema diff --git a/src/ansys/hps/core/jms/resource/evaluator.py b/src/ansys/hps/client/jms/resource/evaluator.py similarity index 99% rename from src/ansys/hps/core/jms/resource/evaluator.py rename to src/ansys/hps/client/jms/resource/evaluator.py index c710ca8c1..765f40ecd 100644 --- a/src/ansys/hps/core/jms/resource/evaluator.py +++ b/src/ansys/hps/client/jms/resource/evaluator.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.evaluator import EvaluatorConfigurationUpdateSchema, EvaluatorSchema diff --git a/src/ansys/hps/core/jms/resource/file.py b/src/ansys/hps/client/jms/resource/file.py similarity index 99% rename from src/ansys/hps/core/jms/resource/file.py rename to src/ansys/hps/client/jms/resource/file.py index 23b52e988..a8d8ef2d6 100644 --- a/src/ansys/hps/core/jms/resource/file.py +++ b/src/ansys/hps/client/jms/resource/file.py @@ -22,7 +22,7 @@ from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.file import FileSchema diff --git a/src/ansys/hps/core/jms/resource/fitness_definition.py b/src/ansys/hps/client/jms/resource/fitness_definition.py similarity index 97% rename from src/ansys/hps/core/jms/resource/fitness_definition.py rename to src/ansys/hps/client/jms/resource/fitness_definition.py index f0b85a9d1..189216871 100644 --- a/src/ansys/hps/core/jms/resource/fitness_definition.py +++ b/src/ansys/hps/client/jms/resource/fitness_definition.py @@ -24,7 +24,7 @@ from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.fitness_definition import FitnessDefinitionSchema, FitnessTermDefinitionSchema @@ -105,7 +105,7 @@ class FitnessDefinition(Object): id : str, optional Unique ID to access the resource, generated internally by the server on creation. fitness_term_definitions - List of :class:`ansys.hps.core.jms.FitnessTermDefinition`. + List of :class:`ansys.hps.client.jms.FitnessTermDefinition`. error_fitness : float The default fitness value assigned to failed jobs. diff --git a/src/ansys/hps/core/jms/resource/job.py b/src/ansys/hps/client/jms/resource/job.py similarity index 99% rename from src/ansys/hps/core/jms/resource/job.py rename to src/ansys/hps/client/jms/resource/job.py index 1b5b470e3..8db30ccbc 100644 --- a/src/ansys/hps/core/jms/resource/job.py +++ b/src/ansys/hps/client/jms/resource/job.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.job import JobSchema diff --git a/src/ansys/hps/core/jms/resource/job_definition.py b/src/ansys/hps/client/jms/resource/job_definition.py similarity index 98% rename from src/ansys/hps/core/jms/resource/job_definition.py rename to src/ansys/hps/client/jms/resource/job_definition.py index 234cdaf63..c8774f454 100644 --- a/src/ansys/hps/core/jms/resource/job_definition.py +++ b/src/ansys/hps/client/jms/resource/job_definition.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.job_definition import JobDefinitionSchema diff --git a/src/ansys/hps/core/jms/resource/license_context.py b/src/ansys/hps/client/jms/resource/license_context.py similarity index 97% rename from src/ansys/hps/core/jms/resource/license_context.py rename to src/ansys/hps/client/jms/resource/license_context.py index a71af41ac..beeac74be 100644 --- a/src/ansys/hps/core/jms/resource/license_context.py +++ b/src/ansys/hps/client/jms/resource/license_context.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.license_context import LicenseContextSchema diff --git a/src/ansys/hps/core/jms/resource/operation.py b/src/ansys/hps/client/jms/resource/operation.py similarity index 98% rename from src/ansys/hps/core/jms/resource/operation.py rename to src/ansys/hps/client/jms/resource/operation.py index b175da99d..76724121e 100644 --- a/src/ansys/hps/core/jms/resource/operation.py +++ b/src/ansys/hps/client/jms/resource/operation.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.operation import OperationSchema diff --git a/src/ansys/hps/core/jms/resource/parameter_definition.py b/src/ansys/hps/client/jms/resource/parameter_definition.py similarity index 99% rename from src/ansys/hps/core/jms/resource/parameter_definition.py rename to src/ansys/hps/client/jms/resource/parameter_definition.py index 7febc2e97..1357cd29c 100644 --- a/src/ansys/hps/core/jms/resource/parameter_definition.py +++ b/src/ansys/hps/client/jms/resource/parameter_definition.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.parameter_definition import ( BoolParameterDefinitionSchema, diff --git a/src/ansys/hps/core/jms/resource/parameter_mapping.py b/src/ansys/hps/client/jms/resource/parameter_mapping.py similarity index 98% rename from src/ansys/hps/core/jms/resource/parameter_mapping.py rename to src/ansys/hps/client/jms/resource/parameter_mapping.py index dc8ee3054..d61542c34 100644 --- a/src/ansys/hps/core/jms/resource/parameter_mapping.py +++ b/src/ansys/hps/client/jms/resource/parameter_mapping.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.parameter_mapping import ParameterMappingSchema diff --git a/src/ansys/hps/core/jms/resource/permission.py b/src/ansys/hps/client/jms/resource/permission.py similarity index 97% rename from src/ansys/hps/core/jms/resource/permission.py rename to src/ansys/hps/client/jms/resource/permission.py index cc0b20133..edeaf2e33 100644 --- a/src/ansys/hps/core/jms/resource/permission.py +++ b/src/ansys/hps/client/jms/resource/permission.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.permission import PermissionSchema diff --git a/src/ansys/hps/core/jms/resource/project.py b/src/ansys/hps/client/jms/resource/project.py similarity index 98% rename from src/ansys/hps/core/jms/resource/project.py rename to src/ansys/hps/client/jms/resource/project.py index a47bf4c3b..241be2a1a 100644 --- a/src/ansys/hps/core/jms/resource/project.py +++ b/src/ansys/hps/client/jms/resource/project.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.project import ProjectSchema diff --git a/src/ansys/hps/core/jms/resource/selection.py b/src/ansys/hps/client/jms/resource/selection.py similarity index 98% rename from src/ansys/hps/core/jms/resource/selection.py rename to src/ansys/hps/client/jms/resource/selection.py index f78e802fa..2b12d0972 100644 --- a/src/ansys/hps/core/jms/resource/selection.py +++ b/src/ansys/hps/client/jms/resource/selection.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.selection import JobSelectionSchema diff --git a/src/ansys/hps/core/jms/resource/task.py b/src/ansys/hps/client/jms/resource/task.py similarity index 99% rename from src/ansys/hps/core/jms/resource/task.py rename to src/ansys/hps/client/jms/resource/task.py index 3cb932900..bce789f5f 100644 --- a/src/ansys/hps/core/jms/resource/task.py +++ b/src/ansys/hps/client/jms/resource/task.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.task import TaskSchema diff --git a/src/ansys/hps/core/jms/resource/task_definition.py b/src/ansys/hps/client/jms/resource/task_definition.py similarity index 99% rename from src/ansys/hps/core/jms/resource/task_definition.py rename to src/ansys/hps/client/jms/resource/task_definition.py index 26c38be97..0414d9fab 100644 --- a/src/ansys/hps/core/jms/resource/task_definition.py +++ b/src/ansys/hps/client/jms/resource/task_definition.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.task_definition import ( HpcResourcesSchema, diff --git a/src/ansys/hps/core/jms/resource/task_definition_template.py b/src/ansys/hps/client/jms/resource/task_definition_template.py similarity index 99% rename from src/ansys/hps/core/jms/resource/task_definition_template.py rename to src/ansys/hps/client/jms/resource/task_definition_template.py index bf12fb6f0..c904d5386 100644 --- a/src/ansys/hps/core/jms/resource/task_definition_template.py +++ b/src/ansys/hps/client/jms/resource/task_definition_template.py @@ -23,7 +23,7 @@ # autogenerated code from marshmallow.utils import missing -from ansys.hps.core.common import Object +from ansys.hps.client.common import Object from ..schema.task_definition_template import ( TaskDefinitionTemplateSchema, diff --git a/src/ansys/hps/core/jms/schema/__init__.py b/src/ansys/hps/client/jms/schema/__init__.py similarity index 100% rename from src/ansys/hps/core/jms/schema/__init__.py rename to src/ansys/hps/client/jms/schema/__init__.py diff --git a/src/ansys/hps/core/jms/schema/algorithm.py b/src/ansys/hps/client/jms/schema/algorithm.py similarity index 96% rename from src/ansys/hps/core/jms/schema/algorithm.py rename to src/ansys/hps/client/jms/schema/algorithm.py index 0836b83c6..75b153d75 100644 --- a/src/ansys/hps/core/jms/schema/algorithm.py +++ b/src/ansys/hps/client/jms/schema/algorithm.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.core.common import ObjectSchemaWithModificationInfo +from ansys.hps.client.common import ObjectSchemaWithModificationInfo from .object_reference import IdReferenceList diff --git a/src/ansys/hps/core/jms/schema/evaluator.py b/src/ansys/hps/client/jms/schema/evaluator.py similarity index 98% rename from src/ansys/hps/core/jms/schema/evaluator.py rename to src/ansys/hps/client/jms/schema/evaluator.py index cc1d34133..11e07e997 100644 --- a/src/ansys/hps/core/jms/schema/evaluator.py +++ b/src/ansys/hps/client/jms/schema/evaluator.py @@ -25,7 +25,7 @@ from marshmallow import fields from marshmallow.validate import OneOf -from ansys.hps.core.common import ObjectSchema, RestrictedValue +from ansys.hps.client.common import ObjectSchema, RestrictedValue project_assignment_modes = ["disabled", "all_active", "project_list"] diff --git a/src/ansys/hps/core/jms/schema/file.py b/src/ansys/hps/client/jms/schema/file.py similarity index 97% rename from src/ansys/hps/core/jms/schema/file.py rename to src/ansys/hps/client/jms/schema/file.py index b5671980f..565f8fff7 100644 --- a/src/ansys/hps/core/jms/schema/file.py +++ b/src/ansys/hps/client/jms/schema/file.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.core.common import ObjectSchemaWithModificationInfo +from ansys.hps.client.common import ObjectSchemaWithModificationInfo from .object_reference import IdReference diff --git a/src/ansys/hps/core/jms/schema/fitness_definition.py b/src/ansys/hps/client/jms/schema/fitness_definition.py similarity index 98% rename from src/ansys/hps/core/jms/schema/fitness_definition.py rename to src/ansys/hps/client/jms/schema/fitness_definition.py index 52b8f5852..2a2780f63 100644 --- a/src/ansys/hps/core/jms/schema/fitness_definition.py +++ b/src/ansys/hps/client/jms/schema/fitness_definition.py @@ -24,7 +24,7 @@ from marshmallow import fields from marshmallow.validate import OneOf -from ansys.hps.core.common import ObjectSchema +from ansys.hps.client.common import ObjectSchema fitness_term_types = ["design_objective", "limit_constraint", "target_constraint"] diff --git a/src/ansys/hps/core/jms/schema/job.py b/src/ansys/hps/client/jms/schema/job.py similarity index 98% rename from src/ansys/hps/core/jms/schema/job.py rename to src/ansys/hps/client/jms/schema/job.py index 2f69c0ee9..099312015 100644 --- a/src/ansys/hps/core/jms/schema/job.py +++ b/src/ansys/hps/client/jms/schema/job.py @@ -24,7 +24,7 @@ from marshmallow import fields from marshmallow.validate import OneOf -from ansys.hps.core.common import ObjectSchemaWithModificationInfo +from ansys.hps.client.common import ObjectSchemaWithModificationInfo from .object_reference import IdReference, IdReferenceList diff --git a/src/ansys/hps/core/jms/schema/job_definition.py b/src/ansys/hps/client/jms/schema/job_definition.py similarity index 97% rename from src/ansys/hps/core/jms/schema/job_definition.py rename to src/ansys/hps/client/jms/schema/job_definition.py index 42cf88183..da8a7a5b7 100644 --- a/src/ansys/hps/core/jms/schema/job_definition.py +++ b/src/ansys/hps/client/jms/schema/job_definition.py @@ -24,7 +24,7 @@ from marshmallow import fields -from ansys.hps.core.common import ObjectSchemaWithModificationInfo +from ansys.hps.client.common import ObjectSchemaWithModificationInfo from .fitness_definition import FitnessDefinitionSchema from .object_reference import IdReferenceList diff --git a/src/ansys/hps/core/jms/schema/license_context.py b/src/ansys/hps/client/jms/schema/license_context.py similarity index 96% rename from src/ansys/hps/core/jms/schema/license_context.py rename to src/ansys/hps/client/jms/schema/license_context.py index dc5e1d6bb..1cc337f13 100644 --- a/src/ansys/hps/core/jms/schema/license_context.py +++ b/src/ansys/hps/client/jms/schema/license_context.py @@ -22,7 +22,7 @@ from marshmallow import fields -from ansys.hps.core.common import BaseSchema +from ansys.hps.client.common import BaseSchema class LicenseContextSchema(BaseSchema): diff --git a/src/ansys/hps/core/jms/schema/object_reference.py b/src/ansys/hps/client/jms/schema/object_reference.py similarity index 100% rename from src/ansys/hps/core/jms/schema/object_reference.py rename to src/ansys/hps/client/jms/schema/object_reference.py diff --git a/src/ansys/hps/core/jms/schema/operation.py b/src/ansys/hps/client/jms/schema/operation.py similarity index 97% rename from src/ansys/hps/core/jms/schema/operation.py rename to src/ansys/hps/client/jms/schema/operation.py index 5a0760c12..36798681a 100644 --- a/src/ansys/hps/core/jms/schema/operation.py +++ b/src/ansys/hps/client/jms/schema/operation.py @@ -22,7 +22,7 @@ from marshmallow import fields -from ansys.hps.core.common import ObjectSchema +from ansys.hps.client.common import ObjectSchema class OperationSchema(ObjectSchema): diff --git a/src/ansys/hps/core/jms/schema/parameter_definition.py b/src/ansys/hps/client/jms/schema/parameter_definition.py similarity index 98% rename from src/ansys/hps/core/jms/schema/parameter_definition.py rename to src/ansys/hps/client/jms/schema/parameter_definition.py index 1ec432d7a..81a354298 100644 --- a/src/ansys/hps/core/jms/schema/parameter_definition.py +++ b/src/ansys/hps/client/jms/schema/parameter_definition.py @@ -25,7 +25,7 @@ from marshmallow import fields from marshmallow_oneofschema import OneOfSchema -from ansys.hps.core.common import ObjectSchemaWithModificationInfo +from ansys.hps.client.common import ObjectSchemaWithModificationInfo log = logging.getLogger(__name__) diff --git a/src/ansys/hps/core/jms/schema/parameter_mapping.py b/src/ansys/hps/client/jms/schema/parameter_mapping.py similarity index 97% rename from src/ansys/hps/core/jms/schema/parameter_mapping.py rename to src/ansys/hps/client/jms/schema/parameter_mapping.py index 5fcd93724..9eb51e97c 100644 --- a/src/ansys/hps/core/jms/schema/parameter_mapping.py +++ b/src/ansys/hps/client/jms/schema/parameter_mapping.py @@ -24,7 +24,7 @@ from marshmallow import fields -from ansys.hps.core.common import ObjectSchemaWithModificationInfo +from ansys.hps.client.common import ObjectSchemaWithModificationInfo from .object_reference import IdReference diff --git a/src/ansys/hps/core/jms/schema/permission.py b/src/ansys/hps/client/jms/schema/permission.py similarity index 97% rename from src/ansys/hps/core/jms/schema/permission.py rename to src/ansys/hps/client/jms/schema/permission.py index b711e68ce..bdaf9b1a5 100644 --- a/src/ansys/hps/core/jms/schema/permission.py +++ b/src/ansys/hps/client/jms/schema/permission.py @@ -22,7 +22,7 @@ from marshmallow import fields -from ansys.hps.core.common import BaseSchema +from ansys.hps.client.common import BaseSchema class PermissionSchema(BaseSchema): diff --git a/src/ansys/hps/core/jms/schema/project.py b/src/ansys/hps/client/jms/schema/project.py similarity index 97% rename from src/ansys/hps/core/jms/schema/project.py rename to src/ansys/hps/client/jms/schema/project.py index 3bbb6c4f1..2cb80a591 100644 --- a/src/ansys/hps/core/jms/schema/project.py +++ b/src/ansys/hps/client/jms/schema/project.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.core.common import BaseSchema +from ansys.hps.client.common import BaseSchema class ProjectSchema(BaseSchema): diff --git a/src/ansys/hps/core/jms/schema/selection.py b/src/ansys/hps/client/jms/schema/selection.py similarity index 96% rename from src/ansys/hps/core/jms/schema/selection.py rename to src/ansys/hps/client/jms/schema/selection.py index 46a83f93f..4830ab5de 100644 --- a/src/ansys/hps/core/jms/schema/selection.py +++ b/src/ansys/hps/client/jms/schema/selection.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.core.common import ObjectSchemaWithModificationInfo +from ansys.hps.client.common import ObjectSchemaWithModificationInfo from .object_reference import IdReference, IdReferenceList diff --git a/src/ansys/hps/core/jms/schema/task.py b/src/ansys/hps/client/jms/schema/task.py similarity index 98% rename from src/ansys/hps/core/jms/schema/task.py rename to src/ansys/hps/client/jms/schema/task.py index d3cebfe95..033fe8a57 100644 --- a/src/ansys/hps/core/jms/schema/task.py +++ b/src/ansys/hps/client/jms/schema/task.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.core.common import ObjectSchemaWithModificationInfo +from ansys.hps.client.common import ObjectSchemaWithModificationInfo from .object_reference import IdReference, IdReferenceList from .task_definition import TaskDefinitionSchema diff --git a/src/ansys/hps/core/jms/schema/task_definition.py b/src/ansys/hps/client/jms/schema/task_definition.py similarity index 98% rename from src/ansys/hps/core/jms/schema/task_definition.py rename to src/ansys/hps/client/jms/schema/task_definition.py index b3077c51b..5537a3064 100644 --- a/src/ansys/hps/core/jms/schema/task_definition.py +++ b/src/ansys/hps/client/jms/schema/task_definition.py @@ -23,7 +23,7 @@ from marshmallow import fields -from ansys.hps.core.common import BaseSchema, ObjectSchemaWithModificationInfo, RestrictedValue +from ansys.hps.client.common import BaseSchema, ObjectSchemaWithModificationInfo, RestrictedValue from .object_reference import IdReference, IdReferenceList diff --git a/src/ansys/hps/core/jms/schema/task_definition_template.py b/src/ansys/hps/client/jms/schema/task_definition_template.py similarity index 99% rename from src/ansys/hps/core/jms/schema/task_definition_template.py rename to src/ansys/hps/client/jms/schema/task_definition_template.py index 3d074495e..4f9e7edbe 100644 --- a/src/ansys/hps/core/jms/schema/task_definition_template.py +++ b/src/ansys/hps/client/jms/schema/task_definition_template.py @@ -22,7 +22,7 @@ from marshmallow import fields, validate -from ansys.hps.core.common import BaseSchema, ObjectSchema +from ansys.hps.client.common import BaseSchema, ObjectSchema from .task_definition import HpcResourcesSchema, SoftwareSchema diff --git a/src/ansys/hps/core/rms/__init__.py b/src/ansys/hps/client/rms/__init__.py similarity index 100% rename from src/ansys/hps/core/rms/__init__.py rename to src/ansys/hps/client/rms/__init__.py diff --git a/src/ansys/hps/core/rms/api/base.py b/src/ansys/hps/client/rms/api/base.py similarity index 99% rename from src/ansys/hps/core/rms/api/base.py rename to src/ansys/hps/client/rms/api/base.py index e8e4e8a72..f417e232e 100644 --- a/src/ansys/hps/core/rms/api/base.py +++ b/src/ansys/hps/client/rms/api/base.py @@ -29,7 +29,7 @@ from pydantic import create_model from requests import Session -from ansys.hps.core.exceptions import ClientError +from ansys.hps.client.exceptions import ClientError from ..models import ( ComputeResourceSet, diff --git a/src/ansys/hps/core/rms/api/rms_api.py b/src/ansys/hps/client/rms/api/rms_api.py similarity index 96% rename from src/ansys/hps/core/rms/api/rms_api.py rename to src/ansys/hps/client/rms/api/rms_api.py index 9b12c26a9..93c1164db 100644 --- a/src/ansys/hps/core/rms/api/rms_api.py +++ b/src/ansys/hps/client/rms/api/rms_api.py @@ -23,8 +23,8 @@ import logging from typing import List -from ansys.hps.core.client import Client -from ansys.hps.core.rms.models import ( +from ansys.hps.client.client import Client +from ansys.hps.client.rms.models import ( ClusterInfo, ComputeResourceSet, EvaluatorConfiguration, @@ -100,8 +100,8 @@ def update_evaluator_configuration( on a Linux evaluator that was active in the past 60 seconds. >>> import datetime - >>> from ansys.hps.core import Client - >>> from ansys.hps.core.jms import RmsApi, EvaluatorConfigurationUpdate + >>> from ansys.hps.client import Client + >>> from ansys.hps.client.jms import RmsApi, EvaluatorConfigurationUpdate >>> cl = Client( ... url="https://localhost:8443/rep", username="repuser", password="repuser" ... ) diff --git a/src/ansys/hps/core/rms/models.py b/src/ansys/hps/client/rms/models.py similarity index 100% rename from src/ansys/hps/core/rms/models.py rename to src/ansys/hps/client/rms/models.py diff --git a/src/ansys/hps/core/warnings.py b/src/ansys/hps/client/warnings.py similarity index 100% rename from src/ansys/hps/core/warnings.py rename to src/ansys/hps/client/warnings.py diff --git a/tests/auth/test_api.py b/tests/auth/test_api.py index 7ab7c0701..6cbc6004c 100644 --- a/tests/auth/test_api.py +++ b/tests/auth/test_api.py @@ -26,8 +26,8 @@ from keycloak import KeycloakOpenID from keycloak.exceptions import KeycloakError -from ansys.hps.core import Client, HPSError -from ansys.hps.core.auth import AuthApi, User, authenticate +from ansys.hps.client import Client, HPSError +from ansys.hps.client.auth import AuthApi, User, authenticate from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/auth/test_authenticate.py b/tests/auth/test_authenticate.py index 018487da4..131b27b4b 100644 --- a/tests/auth/test_authenticate.py +++ b/tests/auth/test_authenticate.py @@ -24,7 +24,7 @@ import requests -from ansys.hps.core.auth import authenticate +from ansys.hps.client.auth import authenticate from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_algorithms.py b/tests/jms/test_algorithms.py index bc53e2a89..698ae49d1 100644 --- a/tests/jms/test_algorithms.py +++ b/tests/jms/test_algorithms.py @@ -25,8 +25,8 @@ from marshmallow.utils import missing -from ansys.hps.core.jms import JmsApi, ProjectApi -from ansys.hps.core.jms.resource import Algorithm, Job, JobDefinition, JobSelection, Project +from ansys.hps.client.jms import JmsApi, ProjectApi +from ansys.hps.client.jms.resource import Algorithm, Job, JobDefinition, JobSelection, Project from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_files.py b/tests/jms/test_files.py index eb0cb30d9..a6f376dac 100644 --- a/tests/jms/test_files.py +++ b/tests/jms/test_files.py @@ -28,8 +28,8 @@ from marshmallow.utils import missing -from ansys.hps.core.jms import JmsApi, ProjectApi -from ansys.hps.core.jms.resource import File, Project +from ansys.hps.client.jms import JmsApi, ProjectApi +from ansys.hps.client.jms.resource import File, Project from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_fitness_definition.py b/tests/jms/test_fitness_definition.py index b2b91ac97..14c06ac85 100644 --- a/tests/jms/test_fitness_definition.py +++ b/tests/jms/test_fitness_definition.py @@ -25,10 +25,13 @@ from marshmallow.utils import missing -from ansys.hps.core.jms import JmsApi, ProjectApi -from ansys.hps.core.jms.resource import JobDefinition, Project -from ansys.hps.core.jms.resource.fitness_definition import FitnessDefinition, FitnessTermDefinition -from ansys.hps.core.jms.schema.fitness_definition import ( +from ansys.hps.client.jms import JmsApi, ProjectApi +from ansys.hps.client.jms.resource import JobDefinition, Project +from ansys.hps.client.jms.resource.fitness_definition import ( + FitnessDefinition, + FitnessTermDefinition, +) +from ansys.hps.client.jms.schema.fitness_definition import ( FitnessDefinitionSchema, FitnessTermDefinitionSchema, ) diff --git a/tests/jms/test_jms_api.py b/tests/jms/test_jms_api.py index 0f6eab726..8aeaa625b 100644 --- a/tests/jms/test_jms_api.py +++ b/tests/jms/test_jms_api.py @@ -26,9 +26,9 @@ from examples.mapdl_motorbike_frame.project_setup import create_project from marshmallow.utils import missing -from ansys.hps.core import Client, ClientError -from ansys.hps.core.jms import JmsApi, ProjectApi -from ansys.hps.core.jms.resource import ( +from ansys.hps.client import Client, ClientError +from ansys.hps.client.jms import JmsApi, ProjectApi +from ansys.hps.client.jms.resource import ( FloatParameterDefinition, IntParameterDefinition, Job, @@ -166,7 +166,7 @@ def test_objects_type_check(self): with self.assertRaises(ClientError) as context: _ = jms_api.create_task_definition_templates([job]) assert "Wrong object type" in str(context.exception) - assert "got " in str(context.exception) + assert "got " in str(context.exception) proj = jms_api.create_project(proj, replace=True) project_api = ProjectApi(client, proj.id) @@ -176,7 +176,7 @@ def test_objects_type_check(self): with self.assertRaises(ClientError) as context: _ = project_api.create_jobs([job_def]) assert "Wrong object type" in str(context.exception) - assert "got " in str( + assert "got " in str( context.exception ) @@ -192,9 +192,9 @@ def test_objects_type_check(self): ) msg = str(context.exception) assert "Wrong object type" in msg - assert "" in msg + assert "" in msg assert ( - "" + "" in msg ) diff --git a/tests/jms/test_job_definitions.py b/tests/jms/test_job_definitions.py index f9f940343..f10b1be09 100644 --- a/tests/jms/test_job_definitions.py +++ b/tests/jms/test_job_definitions.py @@ -25,8 +25,8 @@ from examples.mapdl_motorbike_frame.project_setup import create_project from marshmallow.utils import missing -from ansys.hps.core import AuthApi, JmsApi, ProjectApi -from ansys.hps.core.jms.resource import ( +from ansys.hps.client import AuthApi, JmsApi, ProjectApi +from ansys.hps.client.jms.resource import ( HpcResources, JobDefinition, Project, diff --git a/tests/jms/test_jobs.py b/tests/jms/test_jobs.py index 8303938d0..449fb4cd3 100644 --- a/tests/jms/test_jobs.py +++ b/tests/jms/test_jobs.py @@ -28,9 +28,9 @@ from examples.mapdl_motorbike_frame.project_setup import create_project from marshmallow.utils import missing -from ansys.hps.core import AuthApi, JmsApi, ProjectApi -from ansys.hps.core.jms.resource import Job, JobDefinition, Project -from ansys.hps.core.jms.schema.job import JobSchema +from ansys.hps.client import AuthApi, JmsApi, ProjectApi +from ansys.hps.client.jms.resource import Job, JobDefinition, Project +from ansys.hps.client.jms.schema.job import JobSchema from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_parameter_definitions.py b/tests/jms/test_parameter_definitions.py index a1f90d65f..7422affa2 100644 --- a/tests/jms/test_parameter_definitions.py +++ b/tests/jms/test_parameter_definitions.py @@ -25,8 +25,8 @@ from marshmallow.utils import missing -from ansys.hps.core.jms import JmsApi, ProjectApi -from ansys.hps.core.jms.resource import ( +from ansys.hps.client.jms import JmsApi, ProjectApi +from ansys.hps.client.jms.resource import ( BoolParameterDefinition, FloatParameterDefinition, IntParameterDefinition, @@ -34,7 +34,7 @@ Project, StringParameterDefinition, ) -from ansys.hps.core.jms.schema.parameter_definition import ( +from ansys.hps.client.jms.schema.parameter_definition import ( BoolParameterDefinitionSchema, FloatParameterDefinitionSchema, IntParameterDefinitionSchema, diff --git a/tests/jms/test_project_permissions.py b/tests/jms/test_project_permissions.py index a677c65dd..3e2b5259d 100644 --- a/tests/jms/test_project_permissions.py +++ b/tests/jms/test_project_permissions.py @@ -25,11 +25,11 @@ import unittest import uuid -from ansys.hps.core import Client -from ansys.hps.core.auth import AuthApi, User -from ansys.hps.core.exceptions import ClientError -from ansys.hps.core.jms import JmsApi, ProjectApi -from ansys.hps.core.jms.resource import JobDefinition, Permission, Project +from ansys.hps.client import Client +from ansys.hps.client.auth import AuthApi, User +from ansys.hps.client.exceptions import ClientError +from ansys.hps.client.jms import JmsApi, ProjectApi +from ansys.hps.client.jms.resource import JobDefinition, Permission, Project from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_projects.py b/tests/jms/test_projects.py index ec1f3d50d..2e7d4e30c 100644 --- a/tests/jms/test_projects.py +++ b/tests/jms/test_projects.py @@ -30,10 +30,10 @@ from examples.mapdl_motorbike_frame.project_setup import create_project as motorbike_create_project from marshmallow.utils import missing -from ansys.hps.core import __ansys_apps_version__ as ansys_version -from ansys.hps.core.jms import JmsApi, ProjectApi -from ansys.hps.core.jms.resource import JobDefinition, LicenseContext, Project -from ansys.hps.core.jms.schema.project import ProjectSchema +from ansys.hps.client import __ansys_apps_version__ as ansys_version +from ansys.hps.client.jms import JmsApi, ProjectApi +from ansys.hps.client.jms.resource import JobDefinition, LicenseContext, Project +from ansys.hps.client.jms.schema.project import ProjectSchema from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_resources.py b/tests/jms/test_resources.py index bcc9dacd3..64bbe7714 100644 --- a/tests/jms/test_resources.py +++ b/tests/jms/test_resources.py @@ -26,7 +26,7 @@ from examples.mapdl_motorbike_frame.project_setup import create_project from marshmallow import missing -from ansys.hps.core.jms import ( +from ansys.hps.client.jms import ( FitnessDefinition, JmsApi, JobDefinition, diff --git a/tests/jms/test_task_definition.py b/tests/jms/test_task_definition.py index 826779168..cfa33765f 100644 --- a/tests/jms/test_task_definition.py +++ b/tests/jms/test_task_definition.py @@ -23,14 +23,14 @@ from collections import OrderedDict import unittest -from ansys.hps.core.jms.resource import TaskDefinition -from ansys.hps.core.jms.resource.task_definition import ( +from ansys.hps.client.jms.resource import TaskDefinition +from ansys.hps.client.jms.resource.task_definition import ( HpcResources, Licensing, ResourceRequirements, SuccessCriteria, ) -from ansys.hps.core.jms.schema.task_definition import TaskDefinitionSchema +from ansys.hps.client.jms.schema.task_definition import TaskDefinitionSchema from tests.rep_test import REPTestCase diff --git a/tests/jms/test_task_definition_templates.py b/tests/jms/test_task_definition_templates.py index 3618fa732..a6d9bf393 100644 --- a/tests/jms/test_task_definition_templates.py +++ b/tests/jms/test_task_definition_templates.py @@ -27,16 +27,16 @@ from marshmallow.utils import missing -from ansys.hps.core import HPSError -from ansys.hps.core.auth import AuthApi -from ansys.hps.core.jms import JmsApi -from ansys.hps.core.jms.resource import ( +from ansys.hps.client import HPSError +from ansys.hps.client.auth import AuthApi +from ansys.hps.client.jms import JmsApi +from ansys.hps.client.jms.resource import ( HpcResources, Permission, TaskDefinitionTemplate, TemplateResourceRequirements, ) -from ansys.hps.core.jms.schema.task_definition_template import TaskDefinitionTemplateSchema +from ansys.hps.client.jms.schema.task_definition_template import TaskDefinitionTemplateSchema from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_task_files.py b/tests/jms/test_task_files.py index 770b610dc..e61f48387 100644 --- a/tests/jms/test_task_files.py +++ b/tests/jms/test_task_files.py @@ -29,8 +29,8 @@ from examples.mapdl_motorbike_frame.project_setup import create_project import pytest -from ansys.hps.core.jms import JmsApi, ProjectApi -from ansys.hps.core.jms.resource import File +from ansys.hps.client.jms import JmsApi, ProjectApi +from ansys.hps.client.jms.resource import File from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_tasks.py b/tests/jms/test_tasks.py index 5f9ae15d1..4866ce27d 100644 --- a/tests/jms/test_tasks.py +++ b/tests/jms/test_tasks.py @@ -30,9 +30,9 @@ from marshmallow.utils import missing import pytest -from ansys.hps.core.jms import JmsApi, ProjectApi -from ansys.hps.core.jms.resource import Job, JobDefinition, Project, Software, TaskDefinition -from ansys.hps.core.jms.schema.task import TaskSchema +from ansys.hps.client.jms import JmsApi, ProjectApi +from ansys.hps.client.jms.resource import Job, JobDefinition, Project, Software, TaskDefinition +from ansys.hps.client.jms.schema.task import TaskSchema from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/rep_test.py b/tests/rep_test.py index cc700e85f..27d8984ab 100644 --- a/tests/rep_test.py +++ b/tests/rep_test.py @@ -29,9 +29,9 @@ from keycloak import KeycloakAdmin -from ansys.hps.core import Client -from ansys.hps.core.auth import AuthApi, User -from ansys.hps.core.auth.api.auth_api import create_user +from ansys.hps.client import Client +from ansys.hps.client.auth import AuthApi, User +from ansys.hps.client.auth.api.auth_api import create_user class REPTestCase(unittest.TestCase): diff --git a/tests/rms/test_api.py b/tests/rms/test_api.py index ca53508da..491655b3e 100644 --- a/tests/rms/test_api.py +++ b/tests/rms/test_api.py @@ -23,7 +23,7 @@ import logging import unittest -from ansys.hps.core.rms import RmsApi +from ansys.hps.client.rms import RmsApi from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/rms/test_compute_resource_sets.py b/tests/rms/test_compute_resource_sets.py index 5c80e9cf6..5de67bbd3 100644 --- a/tests/rms/test_compute_resource_sets.py +++ b/tests/rms/test_compute_resource_sets.py @@ -23,7 +23,7 @@ import logging import unittest -from ansys.hps.core.rms import RmsApi +from ansys.hps.client.rms import RmsApi from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/rms/test_evaluators.py b/tests/rms/test_evaluators.py index 0cdba700d..6a6ab93d9 100644 --- a/tests/rms/test_evaluators.py +++ b/tests/rms/test_evaluators.py @@ -24,8 +24,8 @@ import logging import unittest -from ansys.hps.core.rms import RmsApi -from ansys.hps.core.rms.models import EvaluatorConfigurationUpdate, EvaluatorRegistration +from ansys.hps.client.rms import RmsApi +from ansys.hps.client.rms.models import EvaluatorConfigurationUpdate, EvaluatorRegistration from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/rms/test_serialization.py b/tests/rms/test_serialization.py index 752e22ae1..93ab00424 100644 --- a/tests/rms/test_serialization.py +++ b/tests/rms/test_serialization.py @@ -25,8 +25,8 @@ import logging import unittest -from ansys.hps.core.rms.api.base import objects_to_json -from ansys.hps.core.rms.models import EvaluatorRegistration +from ansys.hps.client.rms.api.base import objects_to_json +from ansys.hps.client.rms.models import EvaluatorRegistration from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/test_client.py b/tests/test_client.py index 35950badc..90ad3fadf 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -26,7 +26,7 @@ import requests -from ansys.hps.core import Client +from ansys.hps.client import Client from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/test_connection.py b/tests/test_connection.py index 2adf8c89b..9ca9314e6 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -22,8 +22,8 @@ import logging -from ansys.hps.core.auth import authenticate -from ansys.hps.core.connection import create_session, ping +from ansys.hps.client.auth import authenticate +from ansys.hps.client.connection import create_session, ping from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/test_examples.py b/tests/test_examples.py index e7aa8300b..8f47660c1 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -23,8 +23,13 @@ import logging import unittest -from ansys.hps.core import __ansys_apps_version__ as ansys_version -from ansys.hps.core.jms import IntParameterDefinition, JmsApi, ProjectApi, StringParameterDefinition +from ansys.hps.client import __ansys_apps_version__ as ansys_version +from ansys.hps.client.jms import ( + IntParameterDefinition, + JmsApi, + ProjectApi, + StringParameterDefinition, +) from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index 135380106..947193aa0 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -23,8 +23,8 @@ import logging import unittest -from ansys.hps.core import APIError, Client, ClientError -from ansys.hps.core.jms import JmsApi +from ansys.hps.client import APIError, Client, ClientError +from ansys.hps.client.jms import JmsApi from tests.rep_test import REPTestCase log = logging.getLogger(__name__) From 0e5fe06bb6b037f122e8b05e06dfb1c991ae7c65 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 23 Jan 2024 13:16:20 -0500 Subject: [PATCH 44/61] remove last core ref --- src/ansys/hps/client/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/hps/client/connection.py b/src/ansys/hps/client/connection.py index 402e6fc29..69264cb34 100644 --- a/src/ansys/hps/client/connection.py +++ b/src/ansys/hps/client/connection.py @@ -39,7 +39,7 @@ def create_session( Parameters ---------- access_token : str - The access token provided by :meth:`ansys.hps.core.auth.authenticate` + The access token provided by :meth:`ansys.hps.client.auth.authenticate` verify: Union[bool, str], optional Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be From 824df081d095095a3a3580f54ebc13c23d72c5ad Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 23 Jan 2024 15:29:19 -0500 Subject: [PATCH 45/61] add sphinx-autoapi --- .github/workflows/ci_cd.yml | 2 +- doc/Makefile | 14 +++++++++++--- doc/make.bat | 7 +++++++ pyproject.toml | 1 + 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index df20ca2d5..e657db85e 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -44,7 +44,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} tests: - name: Tests and coverage + name: Quick tests and coverage runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/doc/Makefile b/doc/Makefile index a676dbd6f..6b2d948a3 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -13,18 +13,26 @@ help: .PHONY: help Makefile +# Install dependencies for sphinx-autoapi +.install-deps: + @pip freeze | grep -q "sphinx-autoapi @ git+https://github.com/ansys/sphinx-autoapi" && is_custom_sphinx_autoapi_installed="yes" || is_custom_sphinx_autoapi_installed="no" + @if [ "$$is_custom_sphinx_autoapi_installed" != "yes" ]; then \ + pip uninstall --yes sphinx-autoapi; \ + pip install "sphinx-autoapi @ git+https://github.com/ansys/sphinx-autoapi@feat/single-page-stable"; \ + fi + # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile +%: .install-deps Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -pdf: +pdf: .install-deps @$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true (test -f $(BUILDDIR)/latex/*.pdf && echo pdf exists) || exit 1 # Customized clean due to examples gallery -clean: +clean: .install-deps rm -rf $(BUILDDIR)/* rm -rf $(SOURCEDIR)/examples find . -type d -name "_autosummary" -exec rm -rf {} + diff --git a/doc/make.bat b/doc/make.bat index c98a36031..e64ac6b3d 100644 --- a/doc/make.bat +++ b/doc/make.bat @@ -10,6 +10,13 @@ if "%SPHINXBUILD%" == "" ( set SOURCEDIR=source set BUILDDIR=_build +REM TODO: these lines of code should be removed once the feature branch is merged +for /f %%i in ('pip freeze ^| findstr /c:"sphinx-autoapi @ git+https://github.com/ansys/sphinx-autoapi"') do set is_custom_sphinx_autoapi_installed=%%i +if NOT "%is_custom_sphinx_autoapi_installed%" == "sphinx-autoapi" ( + pip uninstall --yes sphinx-autoapi + pip install "sphinx-autoapi @ git+https://github.com/ansys/sphinx-autoapi@feat/single-page-stable") +REM TODO: these lines of code should be removed once the feature branch is merged + if "%1" == "" goto help if "%1" == "clean" goto clean diff --git a/pyproject.toml b/pyproject.toml index 5bfb5e728..a5f791173 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,6 +55,7 @@ doc = [ "sphinxnotes-strike==1.2", "sphinx-autodoc-typehints==1.25.2", "autodoc_pydantic==2.0.1", + "sphinx-autoapi==3.0.0", ] build = [ From e4e72dc53bc625b8d40cc288896c12926c322832 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 23 Jan 2024 15:40:06 -0500 Subject: [PATCH 46/61] update dependabot --- .github/dependabot.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 57f52554c..3bdc799a8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,10 +1,17 @@ version: 2 updates: - package-ecosystem: "pip" # See documentation for possible values - directory: "/requirements" # Location of package manifests - insecure-external-code-execution: allow + directory: "/" # Location of package manifests schedule: - interval: "daily" + interval: "weekly" labels: - "maintenance" - "dependencies" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + labels: + - "maintenance" + - "dependencies" \ No newline at end of file From b959543e32d6a042fec68a76723af977bdf26e7f Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 23 Jan 2024 16:05:07 -0500 Subject: [PATCH 47/61] change how pytest runs --- pyproject.toml | 7 +++++-- tox.ini | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a5f791173..fde355ef5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -84,6 +84,9 @@ line_length = 100 default_section = "THIRDPARTY" src_paths = ["doc", "src", "tests"] +[tool.hatch.envs.test.scripts] +pytest = "coverage run -m pytest {args}" + [tool.coverage.run] relative_files = true source = ["ansys.hps"] @@ -102,8 +105,8 @@ log_cli = true log_cli_level = "INFO" log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)" log_cli_date_format = "%Y-%m-%d %H:%M:%S" -addopts = """-ra -s --durations=0 --cov=ansys.hps --cov-report html:.cov/html \ - --cov-report xml:.cov/xml --cov-report term -vv""" +addopts = """-ra -s --durations=0 -p pytest_cov --cov=ansys.hps --cov-report html:.cov/html \ + --cov-report xml:.cov/xml --cov-report term -vv --cov-append""" markers = [ "requires_evaluator: marks tests as end-to-end requiring a running evaluator (deselect with '-m \"not requires_evaluator\"')", ] diff --git a/tox.ini b/tox.ini index 27b6f68d8..073fc5b08 100644 --- a/tox.ini +++ b/tox.ini @@ -18,11 +18,11 @@ setenv = PYTHONUNBUFFERED = yes noeval: PYTEST_MARKERS = -m "not requires_evaluator" witheval: PYTEST_MARKERS = -m "requires_evaluator" - coverage: PYTEST_EXTRA_ARGS = -ra -s --durations=0 --cov=ansys.hps --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term -vv + coverage: PYTEST_EXTRA_ARGS = -ra -s --durations=0 -p pytest_cov --cov=ansys.hps --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term -vv --cov-append deps = -e .[tests] commands = - pytest {env:PYTEST_MARKERS:} {env:PYTEST_EXTRA_ARGS:} --junitxml test_results-{envname}.xml {posargs:-vv} + coverage run -m pytest {env:PYTEST_MARKERS:} {env:PYTEST_EXTRA_ARGS:} --junitxml test_results-{envname}.xml {posargs:-vv} [testenv:style] description = Checks project code style From bc2802ef2052978333196809f3fc15770f04bb6a Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Tue, 23 Jan 2024 16:49:37 -0500 Subject: [PATCH 48/61] add cov-append arg to end of coverage run --- pyproject.toml | 3 --- tox.ini | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fde355ef5..7aec92e3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -84,9 +84,6 @@ line_length = 100 default_section = "THIRDPARTY" src_paths = ["doc", "src", "tests"] -[tool.hatch.envs.test.scripts] -pytest = "coverage run -m pytest {args}" - [tool.coverage.run] relative_files = true source = ["ansys.hps"] diff --git a/tox.ini b/tox.ini index 073fc5b08..08db9c9df 100644 --- a/tox.ini +++ b/tox.ini @@ -18,11 +18,11 @@ setenv = PYTHONUNBUFFERED = yes noeval: PYTEST_MARKERS = -m "not requires_evaluator" witheval: PYTEST_MARKERS = -m "requires_evaluator" - coverage: PYTEST_EXTRA_ARGS = -ra -s --durations=0 -p pytest_cov --cov=ansys.hps --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term -vv --cov-append + coverage: PYTEST_EXTRA_ARGS = -ra -s --durations=0 -p pytest_cov --cov=ansys.hps --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term deps = -e .[tests] commands = - coverage run -m pytest {env:PYTEST_MARKERS:} {env:PYTEST_EXTRA_ARGS:} --junitxml test_results-{envname}.xml {posargs:-vv} + coverage run -m pytest {env:PYTEST_MARKERS:} {env:PYTEST_EXTRA_ARGS:} --junitxml test_results-{envname}.xml {posargs:-vv --cov-append} [testenv:style] description = Checks project code style From 0f98e0e2be660bdc03b3c1310aafeccd17b3f0cd Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 25 Jan 2024 15:45:30 -0500 Subject: [PATCH 49/61] update conf.py for autoapi --- doc/source/conf.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 6ac6ed388..8bb669443 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,9 +1,15 @@ # Sphinx documentation configuration file from datetime import datetime import os +from pathlib import Path import sys -from ansys_sphinx_theme import ansys_favicon, get_version_match, pyansys_logo_black +from ansys_sphinx_theme import ( + ansys_favicon, + get_autoapi_templates_dir_relative_path, + get_version_match, + pyansys_logo_black, +) from ansys.hps.client import __ansys_apps_version__, __version__ @@ -43,8 +49,27 @@ "sphinxnotes.strike", "sphinx_autodoc_typehints", "sphinxcontrib.autodoc_pydantic", + "autoapi.extension", ] +exclude_patterns = ["_autoapi_templates", "_build", "Thumbs.db", ".DS_Store"] + +# Configuration for Sphinx autoapi +autoapi_type = "python" +autoapi_dirs = ["../../src/ansys"] +# autoapi_root = "api" +autoapi_options = [ + "members", + "undoc-members", + "show-inheritance", + "show-module-summary", + "special-members", +] +autoapi_template_dir = get_autoapi_templates_dir_relative_path(Path(__file__)) +suppress_warnings = ["autoapi.python_import_resolution"] +autoapi_python_use_implicit_namespaces = True +autoapi_keep_files = True +autoapi_render_in_single_page = ["class", "enum", "exception"] # autodoc/autosummary flags autoclass_content = "both" From 1e7675d878fb75cff16ef2921a6700606771e368 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 25 Jan 2024 17:44:33 -0500 Subject: [PATCH 50/61] add information for api references --- src/ansys/hps/client/__init__.py | 2 +- src/ansys/hps/client/auth/__init__.py | 2 +- src/ansys/hps/client/auth/api/__init__.py | 2 +- src/ansys/hps/client/auth/api/auth_api.py | 2 +- src/ansys/hps/client/auth/authenticate.py | 3 ++- src/ansys/hps/client/auth/resource/__init__.py | 2 +- src/ansys/hps/client/auth/resource/user.py | 2 +- src/ansys/hps/client/auth/schema/__init__.py | 1 + src/ansys/hps/client/auth/schema/user.py | 2 +- src/ansys/hps/client/client.py | 2 +- src/ansys/hps/client/common/__init__.py | 2 +- src/ansys/hps/client/common/base_resource.py | 2 +- src/ansys/hps/client/common/base_schema.py | 2 +- src/ansys/hps/client/common/restricted_value.py | 2 +- src/ansys/hps/client/connection.py | 3 ++- src/ansys/hps/client/exceptions.py | 2 +- src/ansys/hps/client/jms/__init__.py | 2 +- src/ansys/hps/client/jms/api/__init__.py | 2 +- src/ansys/hps/client/jms/api/base.py | 2 +- src/ansys/hps/client/jms/api/jms_api.py | 2 +- src/ansys/hps/client/jms/api/project_api.py | 2 +- src/ansys/hps/client/jms/keys.py | 2 +- src/ansys/hps/client/jms/resource/__init__.py | 2 +- src/ansys/hps/client/jms/resource/algorithm.py | 2 +- src/ansys/hps/client/jms/resource/evaluator.py | 2 +- src/ansys/hps/client/jms/resource/file.py | 2 +- src/ansys/hps/client/jms/resource/fitness_definition.py | 2 +- src/ansys/hps/client/jms/resource/job.py | 2 +- src/ansys/hps/client/jms/resource/job_definition.py | 2 +- src/ansys/hps/client/jms/resource/license_context.py | 2 +- src/ansys/hps/client/jms/resource/operation.py | 2 +- src/ansys/hps/client/jms/resource/parameter_definition.py | 1 + src/ansys/hps/client/jms/resource/parameter_mapping.py | 2 +- src/ansys/hps/client/jms/resource/permission.py | 2 +- src/ansys/hps/client/jms/resource/project.py | 2 +- src/ansys/hps/client/jms/resource/selection.py | 2 +- src/ansys/hps/client/jms/resource/task.py | 2 +- src/ansys/hps/client/jms/resource/task_definition.py | 3 ++- src/ansys/hps/client/jms/resource/task_definition_template.py | 3 ++- src/ansys/hps/client/jms/schema/__init__.py | 1 + src/ansys/hps/client/jms/schema/algorithm.py | 2 +- src/ansys/hps/client/jms/schema/evaluator.py | 2 +- src/ansys/hps/client/jms/schema/file.py | 2 +- src/ansys/hps/client/jms/schema/fitness_definition.py | 2 +- src/ansys/hps/client/jms/schema/job.py | 2 +- src/ansys/hps/client/jms/schema/job_definition.py | 2 +- src/ansys/hps/client/jms/schema/license_context.py | 2 +- src/ansys/hps/client/jms/schema/object_reference.py | 2 +- src/ansys/hps/client/jms/schema/operation.py | 2 +- src/ansys/hps/client/jms/schema/parameter_definition.py | 2 +- src/ansys/hps/client/jms/schema/parameter_mapping.py | 2 +- src/ansys/hps/client/jms/schema/permission.py | 2 +- src/ansys/hps/client/jms/schema/project.py | 2 +- src/ansys/hps/client/jms/schema/selection.py | 2 +- src/ansys/hps/client/jms/schema/task.py | 2 +- src/ansys/hps/client/jms/schema/task_definition.py | 3 ++- src/ansys/hps/client/jms/schema/task_definition_template.py | 3 ++- src/ansys/hps/client/rms/__init__.py | 2 +- src/ansys/hps/client/rms/api/base.py | 3 ++- src/ansys/hps/client/rms/api/rms_api.py | 2 +- src/ansys/hps/client/rms/models.py | 2 +- src/ansys/hps/client/warnings.py | 1 + 62 files changed, 69 insertions(+), 58 deletions(-) diff --git a/src/ansys/hps/client/__init__.py b/src/ansys/hps/client/__init__.py index be9cdedff..38353cfb9 100644 --- a/src/ansys/hps/client/__init__.py +++ b/src/ansys/hps/client/__init__.py @@ -19,7 +19,7 @@ # 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. - +"""PyHPS is a Python client for Ansys HPC Platform Services (HPS).""" from .__version__ import __ansys_apps_version__, __version__ from .auth import AuthApi diff --git a/src/ansys/hps/client/auth/__init__.py b/src/ansys/hps/client/auth/__init__.py index f3cea38ff..4cbe9851a 100644 --- a/src/ansys/hps/client/auth/__init__.py +++ b/src/ansys/hps/client/auth/__init__.py @@ -19,7 +19,7 @@ # 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. - +"""PyHPS authentication subpackage.""" from .api import AuthApi from .authenticate import authenticate from .resource import User diff --git a/src/ansys/hps/client/auth/api/__init__.py b/src/ansys/hps/client/auth/api/__init__.py index 449891774..aed063c57 100644 --- a/src/ansys/hps/client/auth/api/__init__.py +++ b/src/ansys/hps/client/auth/api/__init__.py @@ -19,5 +19,5 @@ # 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. - +"""PyHPS Authentication API subpackage.""" from .auth_api import AuthApi diff --git a/src/ansys/hps/client/auth/api/auth_api.py b/src/ansys/hps/client/auth/api/auth_api.py index 5ad0a33f1..149c16c3e 100644 --- a/src/ansys/hps/client/auth/api/auth_api.py +++ b/src/ansys/hps/client/auth/api/auth_api.py @@ -19,7 +19,7 @@ # 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 the Python interface to the Authorization Service API.""" from typing import List diff --git a/src/ansys/hps/client/auth/authenticate.py b/src/ansys/hps/client/auth/authenticate.py index 7d1d8c8a9..ab8aaf961 100644 --- a/src/ansys/hps/client/auth/authenticate.py +++ b/src/ansys/hps/client/auth/authenticate.py @@ -19,7 +19,8 @@ # 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 that provides authentication for the user with a password or refresh token against the +HPS authentication service.""" import logging from typing import Union import urllib.parse diff --git a/src/ansys/hps/client/auth/resource/__init__.py b/src/ansys/hps/client/auth/resource/__init__.py index f88889709..a03399078 100644 --- a/src/ansys/hps/client/auth/resource/__init__.py +++ b/src/ansys/hps/client/auth/resource/__init__.py @@ -19,6 +19,6 @@ # 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. - +"""PyHPS resource user subpackage.""" from .user import User diff --git a/src/ansys/hps/client/auth/resource/user.py b/src/ansys/hps/client/auth/resource/user.py index ea2a807d1..8713ed510 100644 --- a/src/ansys/hps/client/auth/resource/user.py +++ b/src/ansys/hps/client/auth/resource/user.py @@ -19,7 +19,7 @@ # 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 the user resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/auth/schema/__init__.py b/src/ansys/hps/client/auth/schema/__init__.py index a95b96476..54defd6e6 100644 --- a/src/ansys/hps/client/auth/schema/__init__.py +++ b/src/ansys/hps/client/auth/schema/__init__.py @@ -19,3 +19,4 @@ # 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. +"""PyHPS schema subpackage.""" diff --git a/src/ansys/hps/client/auth/schema/user.py b/src/ansys/hps/client/auth/schema/user.py index a2bcbc278..8d19f76a7 100644 --- a/src/ansys/hps/client/auth/schema/user.py +++ b/src/ansys/hps/client/auth/schema/user.py @@ -19,7 +19,7 @@ # 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 that creates the user schema.""" from marshmallow import fields diff --git a/src/ansys/hps/client/client.py b/src/ansys/hps/client/client.py index fe4485058..294698efa 100644 --- a/src/ansys/hps/client/client.py +++ b/src/ansys/hps/client/client.py @@ -19,7 +19,7 @@ # 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 the Python client to the HPS APIs.""" import logging from typing import Union diff --git a/src/ansys/hps/client/common/__init__.py b/src/ansys/hps/client/common/__init__.py index 8f61ae360..2fb5a5ae3 100644 --- a/src/ansys/hps/client/common/__init__.py +++ b/src/ansys/hps/client/common/__init__.py @@ -19,7 +19,7 @@ # 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. - +"""PyHPS common subpackage.""" from .base_resource import Object from .base_schema import BaseSchema, ObjectSchema, ObjectSchemaWithModificationInfo from .restricted_value import RestrictedValue diff --git a/src/ansys/hps/client/common/base_resource.py b/src/ansys/hps/client/common/base_resource.py index f4ecb8aa8..64bc1d08d 100644 --- a/src/ansys/hps/client/common/base_resource.py +++ b/src/ansys/hps/client/common/base_resource.py @@ -19,7 +19,7 @@ # 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 processing class members for an object.""" import json import logging diff --git a/src/ansys/hps/client/common/base_schema.py b/src/ansys/hps/client/common/base_schema.py index d4e7efb01..897966639 100644 --- a/src/ansys/hps/client/common/base_schema.py +++ b/src/ansys/hps/client/common/base_schema.py @@ -19,7 +19,7 @@ # 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 base schemas and object schemas with and without modification information.""" from marshmallow import INCLUDE, Schema, fields, post_load diff --git a/src/ansys/hps/client/common/restricted_value.py b/src/ansys/hps/client/common/restricted_value.py index 7e60a24d7..6882a0cee 100644 --- a/src/ansys/hps/client/common/restricted_value.py +++ b/src/ansys/hps/client/common/restricted_value.py @@ -19,7 +19,7 @@ # 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 restricted value fields.""" from marshmallow import fields from marshmallow.exceptions import ValidationError diff --git a/src/ansys/hps/client/connection.py b/src/ansys/hps/client/connection.py index 3b9d67b8a..c5ad824ae 100644 --- a/src/ansys/hps/client/connection.py +++ b/src/ansys/hps/client/connection.py @@ -19,7 +19,8 @@ # 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 getting the :class:`requests.Session` object configured for HPS with a given access token +and pinging a given URL.""" import logging from typing import Union diff --git a/src/ansys/hps/client/exceptions.py b/src/ansys/hps/client/exceptions.py index 30bf152cd..5a274e09e 100644 --- a/src/ansys/hps/client/exceptions.py +++ b/src/ansys/hps/client/exceptions.py @@ -19,7 +19,7 @@ # 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 the base class for all client and server REP-related errors.""" from requests.exceptions import RequestException diff --git a/src/ansys/hps/client/jms/__init__.py b/src/ansys/hps/client/jms/__init__.py index ba22858a5..384214900 100644 --- a/src/ansys/hps/client/jms/__init__.py +++ b/src/ansys/hps/client/jms/__init__.py @@ -19,7 +19,7 @@ # 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. - +"""PyHPS JMS subpackage.""" from .api import JmsApi, ProjectApi from .resource import ( diff --git a/src/ansys/hps/client/jms/api/__init__.py b/src/ansys/hps/client/jms/api/__init__.py index 66109716f..8fee0bae9 100644 --- a/src/ansys/hps/client/jms/api/__init__.py +++ b/src/ansys/hps/client/jms/api/__init__.py @@ -19,6 +19,6 @@ # 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. - +"""PyHPS JMS API submodule.""" from .jms_api import JmsApi from .project_api import ProjectApi diff --git a/src/ansys/hps/client/jms/api/base.py b/src/ansys/hps/client/jms/api/base.py index e36e79bc9..4300a9e73 100644 --- a/src/ansys/hps/client/jms/api/base.py +++ b/src/ansys/hps/client/jms/api/base.py @@ -19,7 +19,7 @@ # 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 creating, getting, updating, deleting and copying objects.""" import json import logging from typing import List, Type diff --git a/src/ansys/hps/client/jms/api/jms_api.py b/src/ansys/hps/client/jms/api/jms_api.py index fcd8bc6ab..d06b5c807 100644 --- a/src/ansys/hps/client/jms/api/jms_api.py +++ b/src/ansys/hps/client/jms/api/jms_api.py @@ -19,7 +19,7 @@ # 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 wrapping around the JMS root endpoints.""" import json import logging import os diff --git a/src/ansys/hps/client/jms/api/project_api.py b/src/ansys/hps/client/jms/api/project_api.py index bd5cfef98..a1df35191 100644 --- a/src/ansys/hps/client/jms/api/project_api.py +++ b/src/ansys/hps/client/jms/api/project_api.py @@ -19,7 +19,7 @@ # 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 exposing the project endpoints of the JMS.""" import json import logging import os diff --git a/src/ansys/hps/client/jms/keys.py b/src/ansys/hps/client/jms/keys.py index 89d0ad6fd..24ad1cc9a 100644 --- a/src/ansys/hps/client/jms/keys.py +++ b/src/ansys/hps/client/jms/keys.py @@ -19,5 +19,5 @@ # 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 the object ID key.""" OBJECT_ID_KEY = "id" diff --git a/src/ansys/hps/client/jms/resource/__init__.py b/src/ansys/hps/client/jms/resource/__init__.py index 0bb6d95a0..80c7c525d 100644 --- a/src/ansys/hps/client/jms/resource/__init__.py +++ b/src/ansys/hps/client/jms/resource/__init__.py @@ -19,7 +19,7 @@ # 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. - +"""PyHPS JMS resource subpackage.""" from .algorithm import Algorithm from .evaluator import Evaluator, EvaluatorConfigurationUpdate from .file import File diff --git a/src/ansys/hps/client/jms/resource/algorithm.py b/src/ansys/hps/client/jms/resource/algorithm.py index 087ca047d..8faf56835 100644 --- a/src/ansys/hps/client/jms/resource/algorithm.py +++ b/src/ansys/hps/client/jms/resource/algorithm.py @@ -19,7 +19,7 @@ # 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 the algorithm resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/evaluator.py b/src/ansys/hps/client/jms/resource/evaluator.py index 34b51b6d7..43f4f9933 100644 --- a/src/ansys/hps/client/jms/resource/evaluator.py +++ b/src/ansys/hps/client/jms/resource/evaluator.py @@ -19,7 +19,7 @@ # 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 the evaluator resource and updating its configuration.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/file.py b/src/ansys/hps/client/jms/resource/file.py index a1f809556..2c5c2a31e 100644 --- a/src/ansys/hps/client/jms/resource/file.py +++ b/src/ansys/hps/client/jms/resource/file.py @@ -19,7 +19,7 @@ # 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 the file resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object diff --git a/src/ansys/hps/client/jms/resource/fitness_definition.py b/src/ansys/hps/client/jms/resource/fitness_definition.py index 088b47dd5..2f51c1da2 100644 --- a/src/ansys/hps/client/jms/resource/fitness_definition.py +++ b/src/ansys/hps/client/jms/resource/fitness_definition.py @@ -19,7 +19,7 @@ # 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 the fitness definition and fitness term definition resources.""" import logging from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/job.py b/src/ansys/hps/client/jms/resource/job.py index da275ad28..65ff2e8e7 100644 --- a/src/ansys/hps/client/jms/resource/job.py +++ b/src/ansys/hps/client/jms/resource/job.py @@ -19,7 +19,7 @@ # 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 a job resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/job_definition.py b/src/ansys/hps/client/jms/resource/job_definition.py index e93e72041..61036a4e1 100644 --- a/src/ansys/hps/client/jms/resource/job_definition.py +++ b/src/ansys/hps/client/jms/resource/job_definition.py @@ -19,7 +19,7 @@ # 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 the job definition resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/license_context.py b/src/ansys/hps/client/jms/resource/license_context.py index 3a1820d2f..e6facb96d 100644 --- a/src/ansys/hps/client/jms/resource/license_context.py +++ b/src/ansys/hps/client/jms/resource/license_context.py @@ -19,7 +19,7 @@ # 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 the license context resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/operation.py b/src/ansys/hps/client/jms/resource/operation.py index 04332e10e..1523cfbf0 100644 --- a/src/ansys/hps/client/jms/resource/operation.py +++ b/src/ansys/hps/client/jms/resource/operation.py @@ -19,7 +19,7 @@ # 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 the operation resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/parameter_definition.py b/src/ansys/hps/client/jms/resource/parameter_definition.py index a5c04337a..0eb030675 100644 --- a/src/ansys/hps/client/jms/resource/parameter_definition.py +++ b/src/ansys/hps/client/jms/resource/parameter_definition.py @@ -19,6 +19,7 @@ # 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 the float, integer, boolean, and string parameter definition resources.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/parameter_mapping.py b/src/ansys/hps/client/jms/resource/parameter_mapping.py index ce880d382..aee1fa9da 100644 --- a/src/ansys/hps/client/jms/resource/parameter_mapping.py +++ b/src/ansys/hps/client/jms/resource/parameter_mapping.py @@ -19,7 +19,7 @@ # 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 the parameter mapping resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/permission.py b/src/ansys/hps/client/jms/resource/permission.py index 70f13450e..6e12b6857 100644 --- a/src/ansys/hps/client/jms/resource/permission.py +++ b/src/ansys/hps/client/jms/resource/permission.py @@ -19,7 +19,7 @@ # 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 the permission resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/project.py b/src/ansys/hps/client/jms/resource/project.py index e174ba5b2..59da9e28b 100644 --- a/src/ansys/hps/client/jms/resource/project.py +++ b/src/ansys/hps/client/jms/resource/project.py @@ -19,7 +19,7 @@ # 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 the project resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/selection.py b/src/ansys/hps/client/jms/resource/selection.py index 7e3ac463a..3074928e9 100644 --- a/src/ansys/hps/client/jms/resource/selection.py +++ b/src/ansys/hps/client/jms/resource/selection.py @@ -19,7 +19,7 @@ # 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 the job selection resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/task.py b/src/ansys/hps/client/jms/resource/task.py index 28927c05d..2ac8dfe54 100644 --- a/src/ansys/hps/client/jms/resource/task.py +++ b/src/ansys/hps/client/jms/resource/task.py @@ -19,7 +19,7 @@ # 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 the task resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/task_definition.py b/src/ansys/hps/client/jms/resource/task_definition.py index 18e796ec5..fee6aa390 100644 --- a/src/ansys/hps/client/jms/resource/task_definition.py +++ b/src/ansys/hps/client/jms/resource/task_definition.py @@ -19,7 +19,8 @@ # 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 the HPC, resource requirements, software, success criteria, +licensing, and task definition resources.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/task_definition_template.py b/src/ansys/hps/client/jms/resource/task_definition_template.py index ab7d3eb9c..a49ba22cb 100644 --- a/src/ansys/hps/client/jms/resource/task_definition_template.py +++ b/src/ansys/hps/client/jms/resource/task_definition_template.py @@ -19,7 +19,8 @@ # 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 the template property, template resource requirements, +template input file, template output file, and task definition template resources.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/schema/__init__.py b/src/ansys/hps/client/jms/schema/__init__.py index a95b96476..5e72538db 100644 --- a/src/ansys/hps/client/jms/schema/__init__.py +++ b/src/ansys/hps/client/jms/schema/__init__.py @@ -19,3 +19,4 @@ # 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. +"""PyHPS JMS schema subpackage.""" diff --git a/src/ansys/hps/client/jms/schema/algorithm.py b/src/ansys/hps/client/jms/schema/algorithm.py index 75b153d75..4e030410c 100644 --- a/src/ansys/hps/client/jms/schema/algorithm.py +++ b/src/ansys/hps/client/jms/schema/algorithm.py @@ -19,7 +19,7 @@ # 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 the algorithm schema with modification information.""" from marshmallow import fields diff --git a/src/ansys/hps/client/jms/schema/evaluator.py b/src/ansys/hps/client/jms/schema/evaluator.py index b47576cb5..87ca2507b 100644 --- a/src/ansys/hps/client/jms/schema/evaluator.py +++ b/src/ansys/hps/client/jms/schema/evaluator.py @@ -19,7 +19,7 @@ # 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 diff --git a/src/ansys/hps/client/jms/schema/file.py b/src/ansys/hps/client/jms/schema/file.py index 565f8fff7..0cb98ea22 100644 --- a/src/ansys/hps/client/jms/schema/file.py +++ b/src/ansys/hps/client/jms/schema/file.py @@ -19,7 +19,7 @@ # 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 file schema.""" from marshmallow import fields diff --git a/src/ansys/hps/client/jms/schema/fitness_definition.py b/src/ansys/hps/client/jms/schema/fitness_definition.py index 2a2780f63..2037e5fcd 100644 --- a/src/ansys/hps/client/jms/schema/fitness_definition.py +++ b/src/ansys/hps/client/jms/schema/fitness_definition.py @@ -19,7 +19,7 @@ # 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 fitness term definition schema.""" from marshmallow import fields from marshmallow.validate import OneOf diff --git a/src/ansys/hps/client/jms/schema/job.py b/src/ansys/hps/client/jms/schema/job.py index 099312015..a00a488dd 100644 --- a/src/ansys/hps/client/jms/schema/job.py +++ b/src/ansys/hps/client/jms/schema/job.py @@ -19,7 +19,7 @@ # 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 job schema.""" from marshmallow import fields from marshmallow.validate import OneOf diff --git a/src/ansys/hps/client/jms/schema/job_definition.py b/src/ansys/hps/client/jms/schema/job_definition.py index da8a7a5b7..5d0fa306c 100644 --- a/src/ansys/hps/client/jms/schema/job_definition.py +++ b/src/ansys/hps/client/jms/schema/job_definition.py @@ -19,7 +19,7 @@ # 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 job definition schema.""" import logging from marshmallow import fields diff --git a/src/ansys/hps/client/jms/schema/license_context.py b/src/ansys/hps/client/jms/schema/license_context.py index 1cc337f13..67d0d7c26 100644 --- a/src/ansys/hps/client/jms/schema/license_context.py +++ b/src/ansys/hps/client/jms/schema/license_context.py @@ -19,7 +19,7 @@ # 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 license context schema.""" from marshmallow import fields from ansys.hps.client.common import BaseSchema diff --git a/src/ansys/hps/client/jms/schema/object_reference.py b/src/ansys/hps/client/jms/schema/object_reference.py index 703577a3f..e1a3cb531 100644 --- a/src/ansys/hps/client/jms/schema/object_reference.py +++ b/src/ansys/hps/client/jms/schema/object_reference.py @@ -19,7 +19,7 @@ # 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 retrieving IDs and providing ID references.""" import logging from marshmallow import fields diff --git a/src/ansys/hps/client/jms/schema/operation.py b/src/ansys/hps/client/jms/schema/operation.py index 36798681a..fa3f296ba 100644 --- a/src/ansys/hps/client/jms/schema/operation.py +++ b/src/ansys/hps/client/jms/schema/operation.py @@ -19,7 +19,7 @@ # 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 operation schema.""" from marshmallow import fields from ansys.hps.client.common import ObjectSchema diff --git a/src/ansys/hps/client/jms/schema/parameter_definition.py b/src/ansys/hps/client/jms/schema/parameter_definition.py index 81a354298..4e0a20ec7 100644 --- a/src/ansys/hps/client/jms/schema/parameter_definition.py +++ b/src/ansys/hps/client/jms/schema/parameter_definition.py @@ -19,7 +19,7 @@ # 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 float, integer, boolean, and string parameter definition schema.""" import logging from marshmallow import fields diff --git a/src/ansys/hps/client/jms/schema/parameter_mapping.py b/src/ansys/hps/client/jms/schema/parameter_mapping.py index 9eb51e97c..89ac7e8af 100644 --- a/src/ansys/hps/client/jms/schema/parameter_mapping.py +++ b/src/ansys/hps/client/jms/schema/parameter_mapping.py @@ -19,7 +19,7 @@ # 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 parameter mapping schema.""" import logging from marshmallow import fields diff --git a/src/ansys/hps/client/jms/schema/permission.py b/src/ansys/hps/client/jms/schema/permission.py index bdaf9b1a5..4c0fc9d81 100644 --- a/src/ansys/hps/client/jms/schema/permission.py +++ b/src/ansys/hps/client/jms/schema/permission.py @@ -19,7 +19,7 @@ # 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 permission schema.""" from marshmallow import fields from ansys.hps.client.common import BaseSchema diff --git a/src/ansys/hps/client/jms/schema/project.py b/src/ansys/hps/client/jms/schema/project.py index 2cb80a591..666603089 100644 --- a/src/ansys/hps/client/jms/schema/project.py +++ b/src/ansys/hps/client/jms/schema/project.py @@ -19,7 +19,7 @@ # 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 project schema.""" from marshmallow import fields diff --git a/src/ansys/hps/client/jms/schema/selection.py b/src/ansys/hps/client/jms/schema/selection.py index 4830ab5de..80badd681 100644 --- a/src/ansys/hps/client/jms/schema/selection.py +++ b/src/ansys/hps/client/jms/schema/selection.py @@ -19,7 +19,7 @@ # 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 job selection schema.""" from marshmallow import fields diff --git a/src/ansys/hps/client/jms/schema/task.py b/src/ansys/hps/client/jms/schema/task.py index 033fe8a57..e9d28f7ba 100644 --- a/src/ansys/hps/client/jms/schema/task.py +++ b/src/ansys/hps/client/jms/schema/task.py @@ -19,7 +19,7 @@ # 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 task schema.""" from marshmallow import fields diff --git a/src/ansys/hps/client/jms/schema/task_definition.py b/src/ansys/hps/client/jms/schema/task_definition.py index 5537a3064..acb1c60f9 100644 --- a/src/ansys/hps/client/jms/schema/task_definition.py +++ b/src/ansys/hps/client/jms/schema/task_definition.py @@ -19,7 +19,8 @@ # 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 software, HPC resource, resource requirement, success criteria, +licensing, and task definition schema.""" from marshmallow import fields diff --git a/src/ansys/hps/client/jms/schema/task_definition_template.py b/src/ansys/hps/client/jms/schema/task_definition_template.py index 4f9e7edbe..c6005467c 100644 --- a/src/ansys/hps/client/jms/schema/task_definition_template.py +++ b/src/ansys/hps/client/jms/schema/task_definition_template.py @@ -19,7 +19,8 @@ # 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 template property, resource requirements, file, input file, +output file, and task definition schema.""" from marshmallow import fields, validate from ansys.hps.client.common import BaseSchema, ObjectSchema diff --git a/src/ansys/hps/client/rms/__init__.py b/src/ansys/hps/client/rms/__init__.py index 4aab3cc64..803c4b583 100644 --- a/src/ansys/hps/client/rms/__init__.py +++ b/src/ansys/hps/client/rms/__init__.py @@ -19,7 +19,7 @@ # 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. - +"""PyHPS RMS subpackage.""" from .api.rms_api import RmsApi from .models import ( ComputeResourceSet, diff --git a/src/ansys/hps/client/rms/api/base.py b/src/ansys/hps/client/rms/api/base.py index f417e232e..da670b237 100644 --- a/src/ansys/hps/client/rms/api/base.py +++ b/src/ansys/hps/client/rms/api/base.py @@ -19,7 +19,8 @@ # 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 getting, updating, creating, and deleting objects, and converting objects +to and from JSONs.""" import json import logging from typing import List, Type diff --git a/src/ansys/hps/client/rms/api/rms_api.py b/src/ansys/hps/client/rms/api/rms_api.py index de4235226..70e514d95 100644 --- a/src/ansys/hps/client/rms/api/rms_api.py +++ b/src/ansys/hps/client/rms/api/rms_api.py @@ -19,7 +19,7 @@ # 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 wrapping around RMS root endpoints.""" import logging from typing import List diff --git a/src/ansys/hps/client/rms/models.py b/src/ansys/hps/client/rms/models.py index d95695582..3f542b12e 100644 --- a/src/ansys/hps/client/rms/models.py +++ b/src/ansys/hps/client/rms/models.py @@ -19,7 +19,7 @@ # 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 model information.""" # generated by datamodel-codegen: # filename: rms_openapi.json # timestamp: 2024-01-15T16:13:17+00:00 diff --git a/src/ansys/hps/client/warnings.py b/src/ansys/hps/client/warnings.py index be44c68ed..f9abdabe7 100644 --- a/src/ansys/hps/client/warnings.py +++ b/src/ansys/hps/client/warnings.py @@ -19,6 +19,7 @@ # 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 unverified HTTPS request warnings.""" class UnverifiedHTTPSRequestsWarning(Warning): From 9538114bf3251c9252d8707adcfdfe7f91b16230 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Thu, 25 Jan 2024 17:46:45 -0500 Subject: [PATCH 51/61] updates to conf.py --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 8bb669443..7b0d2ef32 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -57,7 +57,7 @@ # Configuration for Sphinx autoapi autoapi_type = "python" autoapi_dirs = ["../../src/ansys"] -# autoapi_root = "api" +autoapi_root = "api" autoapi_options = [ "members", "undoc-members", From e39fda13a5dfeeb8bc351c6fca803be162208c0d Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Fri, 26 Jan 2024 13:10:52 -0500 Subject: [PATCH 52/61] add more docstrings and update sphinx docs --- doc/source/conf.py | 67 ++++++++-- pyproject.toml | 4 +- src/ansys/hps/client/auth/api/auth_api.py | 126 ++++++++++++++++-- src/ansys/hps/client/auth/resource/user.py | 4 +- src/ansys/hps/client/auth/schema/user.py | 2 + src/ansys/hps/client/common/base_resource.py | 4 +- src/ansys/hps/client/common/base_schema.py | 5 + .../hps/client/common/restricted_value.py | 4 + src/ansys/hps/client/jms/api/base.py | 13 +- src/ansys/hps/client/jms/api/jms_api.py | 16 ++- src/ansys/hps/client/jms/api/project_api.py | 58 +++++++- 11 files changed, 261 insertions(+), 42 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 7b0d2ef32..93e8e9003 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -22,6 +22,7 @@ copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved" author = "ANSYS Inc." cname = os.getenv("DOCUMENTATION_CNAME", "hps.docs.pyansys.com") +switcher_version = get_version_match(__version__) """The canonical name of the webpage hosting the documentation.""" # The short X.Y version @@ -36,20 +37,13 @@ extensions = [ "sphinx.ext.autodoc", "sphinx.ext.autosummary", - "sphinx.ext.intersphinx", - "sphinx.ext.coverage", - "sphinx.ext.napoleon", - "sphinx.ext.todo", - "sphinx.ext.extlinks", - # "sphinx.ext.viewcode", # to show python source code - "sphinxcontrib.httpdomain", - "sphinxcontrib.globalsubs", + "autoapi.extension", + "sphinx_autodoc_typehints", + "numpydoc", "sphinx.ext.intersphinx", "sphinx_copybutton", - "sphinxnotes.strike", - "sphinx_autodoc_typehints", - "sphinxcontrib.autodoc_pydantic", - "autoapi.extension", + "sphinx_tabs.tabs", + "sphinx_design", ] exclude_patterns = ["_autoapi_templates", "_build", "Thumbs.db", ".DS_Store"] @@ -71,12 +65,61 @@ autoapi_keep_files = True autoapi_render_in_single_page = ["class", "enum", "exception"] +# Intersphinx mapping +intersphinx_mapping = { + "python": ("https://docs.python.org/3.11", None), + "numpy": ("https://numpy.org/doc/stable", None), + "scipy": ("https://docs.scipy.org/doc/scipy/", None), + "pyvista": ("https://docs.pyvista.org/version/stable", None), + "grpc": ("https://grpc.github.io/grpc/python/", None), + "pint": ("https://pint.readthedocs.io/en/stable", None), + "beartype": ("https://beartype.readthedocs.io/en/stable/", None), + "docker": ("https://docker-py.readthedocs.io/en/stable/", None), + "pypim": ("https://pypim.docs.pyansys.com/version/stable", None), + "ansys.hps.client": (f"https://hps.docs.pyansys.com/version/{switcher_version}", None), +} + +# numpydoc configuration +numpydoc_show_class_members = False +numpydoc_xref_param_type = True + +# Consider enabling numpydoc validation. See: +# https://numpydoc.readthedocs.io/en/latest/validation.html# +numpydoc_validate = True +numpydoc_validation_checks = { + "GL06", # Found unknown section + "GL07", # Sections are in the wrong order. + # "GL08", # The object does not have a docstring + "GL09", # Deprecation warning should precede extended summary + "GL10", # reST directives {directives} must be followed by two colons + "SS01", # No summary found + "SS02", # Summary does not start with a capital letter + # "SS03", # Summary does not end with a period + "SS04", # Summary contains heading whitespaces + # "SS05", # Summary must start with infinitive verb, not third person + "RT02", # The first line of the Returns section should contain only the + # type, unless multiple values are being returned" +} + # autodoc/autosummary flags autoclass_content = "both" # autodoc_default_flags = ["members"] autosummary_generate = True +def prepare_jinja_env(jinja_env) -> None: + """ + Customize the jinja env. + + Notes + ----- + See https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.Environment + """ + jinja_env.globals["project_name"] = project + + +autoapi_prepare_jinja_env = prepare_jinja_env + # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] diff --git a/pyproject.toml b/pyproject.toml index 7aec92e3c..acd0b65ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ tests = [ doc = [ "Sphinx==7.2.6", "numpydoc==1.6.0", - "ansys-sphinx-theme==0.12.5", + "ansys-sphinx-theme==0.13.1", "sphinx-copybutton==0.5.2", "sphinxcontrib-httpdomain==1.8.1", "sphinxcontrib-globalsubs==0.1.1", @@ -56,6 +56,8 @@ doc = [ "sphinx-autodoc-typehints==1.25.2", "autodoc_pydantic==2.0.1", "sphinx-autoapi==3.0.0", + "numpydoc==1.6.0", + "sphinx_design==0.5.0", ] build = [ diff --git a/src/ansys/hps/client/auth/api/auth_api.py b/src/ansys/hps/client/auth/api/auth_api.py index 149c16c3e..df67d87c0 100644 --- a/src/ansys/hps/client/auth/api/auth_api.py +++ b/src/ansys/hps/client/auth/api/auth_api.py @@ -30,7 +30,8 @@ class AuthApi: - """Provides the Python interface to the Authorization Service API. + """ + Provides the Python interface to the Authorization Service API. Admin users with the Keycloak "manage-users" role can create users as well as modify or delete existing users. Non-admin users are only allowed @@ -64,7 +65,6 @@ class AuthApi: ... last_name="User", ... ) >>> auth_api.create_user(new_user) - """ def __init__(self, client): @@ -81,7 +81,8 @@ def keycloak_admin_client(self) -> KeycloakAdmin: return _admin_client(self.client) def get_users(self, as_objects=True, **query_params) -> List[User]: - """Get users, filtered according to query parameters. + """ + Get users, filtered according to query parameters. Examples of query parameters are: - ``username`` @@ -96,19 +97,68 @@ def get_users(self, as_objects=True, **query_params) -> List[User]: return get_users(self.keycloak_admin_client, as_objects=as_objects, **query_params) def get_user(self, id: str) -> User: - """Get the user representation for a given user ID.""" + """ + Get the user representation for a given user ID. + + Parameters + ---------- + id : str + User ID. + + Returns + ------- + User + User object. + """ return get_user(self.keycloak_admin_client, id) def get_user_groups(self, id: str) -> List[str]: - """Get the groups that the user belongs to.""" + """ + Get the groups that the user belongs to. + + Parameters + ---------- + id : str + User ID. + + Returns + ------- + List[str] + List of groups the user belongs to. + """ return [g["name"] for g in self.keycloak_admin_client.get_user_groups(id)] def get_user_realm_roles(self, id: str) -> List[str]: - """Get the realm roles for the user.""" + """ + Get the realm roles for the user. + + Parameters + ---------- + id : str + User ID. + + Returns + ------- + List[str] + List of realm roles for the user. + """ return [r["name"] for r in self.keycloak_admin_client.get_realm_roles_of_user(id)] def user_is_admin(self, id: str) -> bool: - """Determine if the user is a system administrator.""" + """ + Determine if the user is a system administrator. + + Parameters + ---------- + id : str + User ID. + + Returns + ------- + bool + ``True`` if the user is a system administrator. + ``False`` if the user is not a system administrator. + """ from ansys.hps.client.jms import JmsApi @@ -130,7 +180,8 @@ def user_is_admin(self, id: str) -> bool: return False def create_user(self, user: User, as_objects=True) -> User: - """Create a user. + """ + Create a user. Parameters ---------- @@ -138,11 +189,17 @@ def create_user(self, user: User, as_objects=True) -> User: User object. The default is ``None``. as_objects : bool, optional The default is ``True``. + + Returns + ------- + User + User object. """ return create_user(self.keycloak_admin_client, user, as_objects=as_objects) def update_user(self, user: User, as_objects=True) -> User: - """Modify an existing user. + """ + Modify an existing user. Parameters ---------- @@ -150,11 +207,17 @@ def update_user(self, user: User, as_objects=True) -> User: User object. The default is ``None``. as_objects : bool, optional The default is ``True``. + + Returns + ------- + User + User object. """ return update_user(self.keycloak_admin_client, user, as_objects=as_objects) def delete_user(self, user: User) -> None: - """Delete an existing user. + """ + Delete an existing user. Parameters ---------- @@ -165,7 +228,14 @@ def delete_user(self, user: User) -> None: def _admin_client(client): + """ + Set information for admin. + Parameters + ---------- + client : Client + HPS client object. + """ custom_headers = { "Authorization": "Bearer " + client.access_token, "Content-Type": "application/json", @@ -183,7 +253,14 @@ def _admin_client(client): def get_users(admin_client: KeycloakAdmin, as_objects=True, **query_params): + """ + Get users as admin. + Parameters + ---------- + admin_client : KeycloakAdmin + Keycloak admin user. + """ users = admin_client.get_users(query=query_params) if not as_objects: @@ -194,7 +271,16 @@ def get_users(admin_client: KeycloakAdmin, as_objects=True, **query_params): def get_user(admin_client: KeycloakAdmin, id: str, as_objects=True): + """ + Get user using ID. + Parameters + ---------- + admin_client: KeycloakAdmin + Keycloak admin user. + id : str + User ID. + """ user = admin_client.get_user(user_id=id) if not as_objects: @@ -205,6 +291,16 @@ def get_user(admin_client: KeycloakAdmin, id: str, as_objects=True): def create_user(admin_client: KeycloakAdmin, user: User, as_objects=True): + """ + Create user. + + Parameters + ---------- + admin_client : KeycloakAdmin + Keycloak admin user. + user : User + HPS user object. + """ schema = UserSchema(many=False) data = schema.dump(user) @@ -223,6 +319,16 @@ def create_user(admin_client: KeycloakAdmin, user: User, as_objects=True): def update_user(admin_client: KeycloakAdmin, user: User, as_objects=True): + """ + Update user. + + Parameters + ---------- + admin_client : KeycloakAdmin + Keycloak admin user. + user : User + HPS user object. + """ schema = UserSchema(many=False) data = schema.dump(user) diff --git a/src/ansys/hps/client/auth/resource/user.py b/src/ansys/hps/client/auth/resource/user.py index 8713ed510..6b9e6a1d9 100644 --- a/src/ansys/hps/client/auth/resource/user.py +++ b/src/ansys/hps/client/auth/resource/user.py @@ -29,7 +29,8 @@ class User(Object): - """Provides the user resource. + """ + Provides the user resource. Parameters ---------- @@ -45,7 +46,6 @@ class User(Object): Last name. email : str, optional E-mail address. - """ class Meta: diff --git a/src/ansys/hps/client/auth/schema/user.py b/src/ansys/hps/client/auth/schema/user.py index 8d19f76a7..50f5e59c9 100644 --- a/src/ansys/hps/client/auth/schema/user.py +++ b/src/ansys/hps/client/auth/schema/user.py @@ -27,6 +27,8 @@ class UserSchema(BaseSchema): + """Create user schema with ID, username, password, first name, last name, and email.""" + class Meta(BaseSchema.Meta): pass diff --git a/src/ansys/hps/client/common/base_resource.py b/src/ansys/hps/client/common/base_resource.py index 64bc1d08d..d952569fe 100644 --- a/src/ansys/hps/client/common/base_resource.py +++ b/src/ansys/hps/client/common/base_resource.py @@ -64,12 +64,14 @@ def __init__(self, **kwargs): setattr(self, k, missing) def __repr__(self): + """Printable representation of the object.""" return "%s(%s)" % ( self.__class__.__name__, ",".join(["%s=%r" % (k, getattr(self, k)) for k in self.declared_fields()]), ) def __eq__(self, other): + """Compare instances of the object.""" if not isinstance(other, self.__class__): return NotImplemented for k in self.declared_fields(): @@ -78,7 +80,7 @@ def __eq__(self, other): return True def __str__(self): - + """String representation of the object.""" # Ideally we'd simply do # return json.dumps(self.Meta.schema(many=False).dump(self), indent=2) # However the schema.dump() function (rightfully) ignores fields marked as load_only. diff --git a/src/ansys/hps/client/common/base_schema.py b/src/ansys/hps/client/common/base_schema.py index 897966639..431c1742a 100644 --- a/src/ansys/hps/client/common/base_schema.py +++ b/src/ansys/hps/client/common/base_schema.py @@ -25,6 +25,8 @@ class BaseSchema(Schema): + """Base schema class.""" + class Meta: ordered = True unknown = INCLUDE @@ -32,10 +34,12 @@ class Meta: @post_load def make_object(self, data, **kwargs): + """Make object for base schema.""" return self.Meta.object_class(**data) class ObjectSchema(BaseSchema): + """Create object schema with ID.""" id = fields.String( allow_none=True, @@ -48,6 +52,7 @@ class ObjectSchema(BaseSchema): class ObjectSchemaWithModificationInfo(ObjectSchema): + """Object schema with creation & modification times, and created & modified by fields.""" creation_time = fields.DateTime( allow_none=True, diff --git a/src/ansys/hps/client/common/restricted_value.py b/src/ansys/hps/client/common/restricted_value.py index 6882a0cee..64ce43883 100644 --- a/src/ansys/hps/client/common/restricted_value.py +++ b/src/ansys/hps/client/common/restricted_value.py @@ -25,6 +25,8 @@ class RestrictedValue(fields.Field): + """Restricted value fields.""" + restricted_fields = [ fields.Int(strict=True), fields.Bool(truthy=[True], falsy=[False]), @@ -36,6 +38,7 @@ def __init__(self): super().__init__(allow_none=True) def _deserialize(self, value, attr, obj, **kwargs): + """Convert string to restricted value object.""" for field in self.restricted_fields: try: return field._deserialize(value, attr, obj, **kwargs) @@ -45,4 +48,5 @@ def _deserialize(self, value, attr, obj, **kwargs): self.raise_validation_error() def raise_validation_error(): + """Raise validation error if value is not a float, integer, Boolean, or string.""" raise ValidationError("Value must be a float, integer, Boolean, or string.") diff --git a/src/ansys/hps/client/jms/api/base.py b/src/ansys/hps/client/jms/api/base.py index 4300a9e73..7fd15f0ea 100644 --- a/src/ansys/hps/client/jms/api/base.py +++ b/src/ansys/hps/client/jms/api/base.py @@ -35,7 +35,7 @@ def get_objects( session: Session, url: str, obj_type: Type[Object], as_objects=True, **query_params ): - + """Get objects with a session, URL, and object type.""" rest_name = obj_type.Meta.rest_name url = f"{url}/{rest_name}" r = session.get(url, params=query_params) @@ -54,7 +54,7 @@ def get_objects( def get_object( session: Session, url: str, obj_type: Type[Object], id: str, as_object=True, **query_params ): - + """Get an object with a session, URL, object type, and object.""" rest_name = obj_type.Meta.rest_name url = f"{url}/{rest_name}/{id}" r = session.get(url, params=query_params) @@ -75,7 +75,7 @@ def get_object( def _check_object_types(objects: List[Object], obj_type: Type[Object]): - + """Check object types.""" are_same = [isinstance(o, obj_type) for o in objects] if not all(are_same): actual_types = set([type(o) for o in objects]) @@ -92,6 +92,7 @@ def create_objects( as_objects=True, **query_params, ): + """Create objects.""" if not objects: return [] @@ -120,7 +121,7 @@ def update_objects( as_objects=True, **query_params, ): - + """Update objects.""" if not objects: return [] @@ -142,7 +143,7 @@ def update_objects( def delete_objects(session: Session, url: str, objects: List[Object], obj_type: Type[Object]): - + """Delete objects.""" if not objects: return @@ -157,7 +158,7 @@ def delete_objects(session: Session, url: str, objects: List[Object], obj_type: def copy_objects(session: Session, url: str, objects: List[Object], wait: bool = True) -> str: - + """Copy objects.""" are_same = [o.__class__ == objects[0].__class__ for o in objects[1:]] if not all(are_same): raise ClientError("Mixed object types") diff --git a/src/ansys/hps/client/jms/api/jms_api.py b/src/ansys/hps/client/jms/api/jms_api.py index d06b5c807..c97218f31 100644 --- a/src/ansys/hps/client/jms/api/jms_api.py +++ b/src/ansys/hps/client/jms/api/jms_api.py @@ -65,6 +65,7 @@ class JmsApi(object): """ def __init__(self, client: Client): + """Initialize JMS API.""" self.client = client self._fs_url = None @@ -247,11 +248,13 @@ def update_task_definition_template_permissions( ################################################################ # Operations def get_operations(self, as_objects=True, **query_params) -> List[Operation]: + """Get operations.""" return get_objects( self.client.session, self.url, Operation, as_objects=as_objects, **query_params ) def get_operation(self, id, as_object=True) -> Operation: + """Get an operation.""" return get_object(self.client.session, self.url, Operation, id, as_object=as_object) def monitor_operation(self, operation_id: str, max_value: float = 5.0, max_time: float = None): @@ -322,6 +325,7 @@ def get_project_by_name(client, api_url, name, last_created=True) -> Union[Proje def create_project(client, api_url, project, replace=False, as_objects=True) -> Project: + """Create a project.""" url = f"{api_url}/projects/" schema = ProjectSchema() @@ -340,6 +344,7 @@ def create_project(client, api_url, project, replace=False, as_objects=True) -> def update_project(client, api_url, project, as_objects=True) -> Project: + """Update a project.""" url = f"{api_url}/projects/{project.id}" schema = ProjectSchema() @@ -355,7 +360,7 @@ def update_project(client, api_url, project, as_objects=True) -> Project: def delete_project(client, api_url, project): - + """Delete a project.""" url = f"{api_url}/projects/{project.id}" r = client.session.delete(url) @@ -363,6 +368,8 @@ def delete_project(client, api_url, project): def _monitor_operation( jms_api: JmsApi, operation_id: str, max_value: float = 5.0, max_time: float = None ) -> Operation: + """Monitor an operation.""" + @backoff.on_predicate( backoff.expo, lambda x: x[1] == False, @@ -371,6 +378,7 @@ def _monitor_operation( max_time=max_time, ) def _monitor(): + """Monitor the operation with its ID.""" done = False op = jms_api.get_operation(id=operation_id) if op: @@ -387,7 +395,7 @@ def _monitor(): def _copy_objects( client: Client, api_url: str, objects: List[Object], wait: bool = True ) -> Union[str, List[str]]: - + """Copy objects.""" operation_id = base_copy_objects(client.session, api_url, objects) if not wait: @@ -402,7 +410,7 @@ def _copy_objects( def restore_project(jms_api, archive_path): - + """Restore an archived project.""" if not os.path.exists(archive_path): raise HPSError(f"Project archive: path does not exist {archive_path}") @@ -456,7 +464,7 @@ def get_storages(client, api_url): def get_fs_url(client, api_url): - + """Get the file storage URL.""" file_storages = get_storages(client, api_url) if not file_storages: diff --git a/src/ansys/hps/client/jms/api/project_api.py b/src/ansys/hps/client/jms/api/project_api.py index a1df35191..229396dc1 100644 --- a/src/ansys/hps/client/jms/api/project_api.py +++ b/src/ansys/hps/client/jms/api/project_api.py @@ -95,6 +95,7 @@ class ProjectApi: """ def __init__(self, client: Client, project_id: str): + """Initialize project API.""" self.client = client self.project_id = project_id self._fs_url = None @@ -102,6 +103,7 @@ def __init__(self, client: Client, project_id: str): @property def jms_api_url(self) -> str: + """Get the JMS API URL.""" return f"{self.client.url}/jms/api/v1" @property @@ -160,12 +162,15 @@ def get_files(self, as_objects=True, content=False, **query_params) -> List[File return get_files(self, as_objects=as_objects, content=content, **query_params) def create_files(self, files: List[File], as_objects=True) -> List[File]: + """Create a list of files.""" return create_files(self, files, as_objects=as_objects) def update_files(self, files: List[File], as_objects=True): + """Update files.""" return update_files(self, files, as_objects=as_objects) def delete_files(self, files: List[File]): + """Delete files.""" return self._delete_objects(files, File) def download_file( @@ -188,55 +193,67 @@ def download_file( def get_parameter_definitions( self, as_objects=True, **query_params ) -> List[ParameterDefinition]: + """Get a list of parameter definitions.""" return self._get_objects(ParameterDefinition, as_objects, **query_params) def create_parameter_definitions( self, parameter_definitions: List[ParameterDefinition], as_objects=True ) -> List[ParameterDefinition]: + """Create a list of parameter definitions.""" return self._create_objects(parameter_definitions, ParameterDefinition, as_objects) def update_parameter_definitions( self, parameter_definitions: List[ParameterDefinition], as_objects=True ) -> List[ParameterDefinition]: + """Update a list of parameter definitions.""" return self._update_objects(parameter_definitions, ParameterDefinition, as_objects) def delete_parameter_definitions(self, parameter_definitions: List[ParameterDefinition]): + """Delete a list of parameter definitions.""" return self._delete_objects(parameter_definitions, ParameterDefinition) ################################################################ # Parameter mappings def get_parameter_mappings(self, as_objects=True, **query_params) -> List[ParameterMapping]: + """Get a list of parameter mappings.""" return self._get_objects(ParameterMapping, as_objects=as_objects, **query_params) def create_parameter_mappings( self, parameter_mappings: List[ParameterMapping], as_objects=True ) -> List[ParameterMapping]: + """Get a list of created parameter mappings.""" return self._create_objects(parameter_mappings, ParameterMapping, as_objects=as_objects) def update_parameter_mappings( self, parameter_mappings: List[ParameterMapping], as_objects=True ) -> List[ParameterMapping]: + """Get a list of updated parameter mappings.""" return self._update_objects(parameter_mappings, ParameterMapping, as_objects=as_objects) def delete_parameter_mappings(self, parameter_mappings: List[ParameterMapping]): + """Delete a list of parameter mappings.""" return self._delete_objects(parameter_mappings, ParameterMapping) ################################################################ # Task definitions def get_task_definitions(self, as_objects=True, **query_params) -> List[TaskDefinition]: + """Get a list of task definitions.""" return self._get_objects(TaskDefinition, as_objects=as_objects, **query_params) def create_task_definitions( self, task_definitions: List[TaskDefinition], as_objects=True ) -> List[TaskDefinition]: + """Create a list of task definitions.""" return self._create_objects(task_definitions, TaskDefinition, as_objects=as_objects) def update_task_definitions( self, task_definitions: List[TaskDefinition], as_objects=True ) -> List[TaskDefinition]: + """Update a list of task definitions.""" return self._update_objects(task_definitions, TaskDefinition, as_objects=as_objects) def delete_task_definitions(self, task_definitions: List[TaskDefinition]): + """Delete a list of task definitions.""" return self._delete_objects(task_definitions, TaskDefinition) def copy_task_definitions( @@ -264,19 +281,23 @@ def copy_task_definitions( ################################################################ # Job definitions def get_job_definitions(self, as_objects=True, **query_params) -> List[JobDefinition]: + """Get a list of job definitions.""" return self._get_objects(JobDefinition, as_objects=as_objects, **query_params) def create_job_definitions( self, job_definitions: List[JobDefinition], as_objects=True ) -> List[JobDefinition]: + """Create a list of job definitions.""" return self._create_objects(job_definitions, JobDefinition, as_objects=as_objects) def update_job_definitions( self, job_definitions: List[JobDefinition], as_objects=True ) -> List[JobDefinition]: + """Update a list of job definitions.""" return self._update_objects(job_definitions, JobDefinition, as_objects=as_objects) def delete_job_definitions(self, job_definitions: List[JobDefinition]): + """Delete a list of job definitions.""" return self._delete_objects(job_definitions, JobDefinition) def copy_job_definitions( @@ -304,6 +325,7 @@ def copy_job_definitions( ################################################################ # Jobs def get_jobs(self, as_objects=True, **query_params) -> List[Job]: + """Get a list of jobs.""" return self._get_objects(Job, as_objects=as_objects, **query_params) def create_jobs(self, jobs: List[Job], as_objects=True) -> List[Job]: @@ -384,9 +406,11 @@ def delete_jobs(self, jobs: List[Job]): return self._delete_objects(jobs, Job) def sync_jobs(self, jobs: List[Job]): + """Sync a list of jobs.""" return sync_jobs(self, jobs) def _sync_jobs(self, jobs: List[Job]): + """Deprecated function that syncs a list of jobs.""" msg = ( "'ProjectApi._sync_jobs' is deprecated and is to be removed soon. " "Use 'ProjectApi.sync_jobs' instead." @@ -398,57 +422,71 @@ def _sync_jobs(self, jobs: List[Job]): ################################################################ # Tasks def get_tasks(self, as_objects=True, **query_params) -> List[Task]: + """Get a list of tasks.""" return self._get_objects(Task, as_objects=as_objects, **query_params) def update_tasks(self, tasks: List[Task], as_objects=True) -> List[Task]: + """Update a list of tasks.""" return self._update_objects(tasks, Task, as_objects=as_objects) ################################################################ # Selections def get_job_selections(self, as_objects=True, **query_params) -> List[JobSelection]: + """Get a list of job selections.""" return self._get_objects(JobSelection, as_objects=as_objects, **query_params) def create_job_selections( self, selections: List[JobSelection], as_objects=True ) -> List[JobSelection]: + """Create a list of job selections.""" return self._create_objects(selections, JobSelection, as_objects=as_objects) def update_job_selections( self, selections: List[JobSelection], as_objects=True ) -> List[JobSelection]: + """Update a list of job selections.""" return self._update_objects(selections, JobSelection, as_objects=as_objects) def delete_job_selections(self, selections: List[JobSelection]): + """Delete a list of job selections.""" return self._delete_objects(selections, JobSelection) ################################################################ # Algorithms def get_algorithms(self, as_objects=True, **query_params) -> List[Algorithm]: + """Get a list of algorithms.""" return self._get_objects(Algorithm, as_objects=as_objects, **query_params) def create_algorithms(self, algorithms: List[Algorithm], as_objects=True) -> List[Algorithm]: + """Create a list of algorithms.""" return self._create_objects(algorithms, Algorithm, as_objects=as_objects) def update_algorithms(self, algorithms: List[Algorithm], as_objects=True) -> List[Algorithm]: + """Update a list of algorithms.""" return self._update_objects(algorithms, Algorithm, as_objects=as_objects) def delete_algorithms(self, algorithms: List[Algorithm]): + """Delete a list of algorithms.""" return self._delete_objects(algorithms, Algorithm) ################################################################ # Permissions def get_permissions(self, as_objects=True) -> List[Permission]: + """Get a list of permissions.""" return self._get_objects(Permission, as_objects=as_objects, fields=None) def update_permissions(self, permissions: List[Permission], as_objects=True): + """Update a list of permissions.""" return self._update_objects(permissions, Permission, as_objects=as_objects) ################################################################ # License contexts def get_license_contexts(self, as_objects=True, **query_params) -> List[LicenseContext]: + """Get a list of license contexts.""" return self._get_objects(self, LicenseContext, as_objects=as_objects, **query_params) def create_license_contexts(self, as_objects=True) -> List[LicenseContext]: + """Create a list of license contexts.""" rest_name = LicenseContext.Meta.rest_name url = f"{self.jms_api_url}/projects/{self.project_id}/{rest_name}" r = self.client.session.post(f"{url}") @@ -460,9 +498,11 @@ def create_license_contexts(self, as_objects=True) -> List[LicenseContext]: return objects def update_license_contexts(self, license_contexts, as_objects=True) -> List[LicenseContext]: + """Update a list of license contexts.""" return self._update_objects(self, license_contexts, LicenseContext, as_objects=as_objects) def delete_license_contexts(self): + """Delete license contexts.""" rest_name = LicenseContext.Meta.rest_name url = f"{self.jms_api_url}/projects/{self.id}/{rest_name}" r = self.client.session.delete(url) @@ -503,11 +543,13 @@ def copy_default_execution_script(self, filename: str) -> File: ################################################################ def _get_objects(self, obj_type: Object, as_objects=True, **query_params): + """Get objects.""" return get_objects(self.client.session, self.url, obj_type, as_objects, **query_params) def _create_objects( self, objects: List[Object], obj_type: Type[Object], as_objects=True, **query_params ): + """Create objects.""" return create_objects( self.client.session, self.url, objects, obj_type, as_objects, **query_params ) @@ -515,11 +557,13 @@ def _create_objects( def _update_objects( self, objects: List[Object], obj_type: Type[Object], as_objects=True, **query_params ): + """Update objects.""" return update_objects( self.client.session, self.url, objects, obj_type, as_objects, **query_params ) def _delete_objects(self, objects: List[Object], obj_type: Type[Object]): + """Delete objects.""" delete_objects(self.client.session, self.url, objects, obj_type) @@ -539,7 +583,7 @@ def _download_files(project_api: ProjectApi, files: List[File]): def get_files(project_api: ProjectApi, as_objects=True, content=False, **query_params): - + """Get files for the project API.""" files = get_objects( project_api.client.session, project_api.url, File, as_objects=as_objects, **query_params ) @@ -579,6 +623,7 @@ def _upload_files(project_api: ProjectApi, files): def create_files(project_api: ProjectApi, files, as_objects=True) -> List[File]: + """Create a list of files.""" # (1) Create file resources in JMS created_files = create_objects( project_api.client.session, project_api.url, files, File, as_objects=as_objects @@ -605,6 +650,7 @@ def create_files(project_api: ProjectApi, files, as_objects=True) -> List[File]: def update_files(project_api: ProjectApi, files: List[File], as_objects=True) -> List[File]: + """Update a list of files.""" # Upload files first if there are any src parameters _upload_files(project_api, files) # Update file resources in JMS @@ -620,7 +666,7 @@ def _download_file( progress_handler: Callable[[int], None] = None, stream: bool = True, ) -> str: - + """Download a file.""" if getattr(file, "hash", None) is None: log.warning(f"No hash found for file {file.name}.") @@ -642,7 +688,7 @@ def _download_file( def copy_projects( project_api: ProjectApi, project_source_ids: List[str], wait: bool = True ) -> Union[str, List[str]]: - + """Copy projects.""" return _copy_objects( project_api.client, project_api.jms_api_url, @@ -652,7 +698,7 @@ def copy_projects( def archive_project(project_api: ProjectApi, target_path, include_job_files=True) -> str: - + """Archive projects.""" # PUT archive request url = f"{project_api.url}/archive" query_params = {} @@ -702,7 +748,7 @@ def copy_jobs(project_api: ProjectApi, jobs: List[Job], as_objects=True, **query def sync_jobs(project_api: ProjectApi, jobs: List[Job]): - + """Sync jobs.""" url = f"{project_api.url}/jobs:sync" # noqa: E231 json_data = json.dumps({"job_ids": [obj.id for obj in jobs]}) r = project_api.client.session.put(f"{url}", data=json_data) @@ -716,7 +762,7 @@ def _fs_copy_file( destination_bucket: str, destination_name: str, ) -> str: - + """Copy files with the fs REST gateway.""" json_data = json.dumps( {"destination": f"ansfs://{destination_bucket}/{destination_name}"} # noqa: E231 ) From b17bf960fb4de9dcea7a11047fe82681cbf64b92 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Fri, 26 Jan 2024 13:18:35 -0500 Subject: [PATCH 53/61] remove sphinx tabs --- doc/source/conf.py | 1 - pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 93e8e9003..7fa631e4f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -42,7 +42,6 @@ "numpydoc", "sphinx.ext.intersphinx", "sphinx_copybutton", - "sphinx_tabs.tabs", "sphinx_design", ] diff --git a/pyproject.toml b/pyproject.toml index acd0b65ec..2ec0d0d69 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,12 +52,12 @@ doc = [ "sphinx-copybutton==0.5.2", "sphinxcontrib-httpdomain==1.8.1", "sphinxcontrib-globalsubs==0.1.1", + "sphinx_design==0.5.0", "sphinxnotes-strike==1.2", "sphinx-autodoc-typehints==1.25.2", "autodoc_pydantic==2.0.1", "sphinx-autoapi==3.0.0", "numpydoc==1.6.0", - "sphinx_design==0.5.0", ] build = [ From d23fdedd5fe965abc9d7f602622dbc40f4610bf7 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Fri, 26 Jan 2024 15:46:47 -0500 Subject: [PATCH 54/61] make navigation depth 5 to show all classes --- doc/source/conf.py | 2 +- pyproject.toml | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 7fa631e4f..09a1d8d0c 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -192,7 +192,7 @@ def prepare_jinja_env(jinja_env) -> None: ("PyAnsys", "https://docs.pyansys.com/"), ], "collapse_navigation": True, - "navigation_depth": 4, + "navigation_depth": 5, "check_switcher": False, "switcher": { "json_url": f"https://{cname}/release/versions.json", # noqa: E231 diff --git a/pyproject.toml b/pyproject.toml index 2ec0d0d69..dc4dbbf57 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,18 +46,21 @@ tests = [ ] doc = [ - "Sphinx==7.2.6", - "numpydoc==1.6.0", "ansys-sphinx-theme==0.13.1", - "sphinx-copybutton==0.5.2", - "sphinxcontrib-httpdomain==1.8.1", + "autodoc_pydantic==2.0.1", + "jupyter_sphinx==0.5.3", + "nbsphinx==0.9.3", + "numpydoc==1.6.0", + "myst-parser==2.0.0", + "Sphinx==7.2.6", + "sphinx-autoapi==3.0.0", + "sphinx-autodoc-typehints==1.25.2", "sphinxcontrib-globalsubs==0.1.1", + "sphinxcontrib-httpdomain==1.8.1", + "sphinx-copybutton==0.5.2", "sphinx_design==0.5.0", + "sphinx-jinja==2.0.2", "sphinxnotes-strike==1.2", - "sphinx-autodoc-typehints==1.25.2", - "autodoc_pydantic==2.0.1", - "sphinx-autoapi==3.0.0", - "numpydoc==1.6.0", ] build = [ From c867e42d627e9520e980a013272db4c2a1a0b2de Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Wed, 31 Jan 2024 13:08:11 -0500 Subject: [PATCH 55/61] remove added docstrings on autogen code files --- src/ansys/hps/client/auth/api/auth_api.py | 98 +++---------------- src/ansys/hps/client/auth/resource/user.py | 4 +- .../hps/client/jms/resource/evaluator.py | 1 - src/ansys/hps/client/jms/resource/job.py | 1 - .../hps/client/jms/resource/job_definition.py | 1 - .../client/jms/resource/license_context.py | 1 - .../hps/client/jms/resource/operation.py | 1 - .../jms/resource/parameter_definition.py | 2 - .../client/jms/resource/parameter_mapping.py | 1 - .../hps/client/jms/resource/permission.py | 1 - src/ansys/hps/client/jms/resource/project.py | 1 - .../hps/client/jms/resource/selection.py | 1 - src/ansys/hps/client/jms/resource/task.py | 1 - .../client/jms/resource/task_definition.py | 2 - .../jms/resource/task_definition_template.py | 2 - 15 files changed, 16 insertions(+), 102 deletions(-) diff --git a/src/ansys/hps/client/auth/api/auth_api.py b/src/ansys/hps/client/auth/api/auth_api.py index df67d87c0..81c027c76 100644 --- a/src/ansys/hps/client/auth/api/auth_api.py +++ b/src/ansys/hps/client/auth/api/auth_api.py @@ -30,8 +30,7 @@ class AuthApi: - """ - Provides the Python interface to the Authorization Service API. + """Provides the Python interface to the Authorization Service API. Admin users with the Keycloak "manage-users" role can create users as well as modify or delete existing users. Non-admin users are only allowed @@ -65,6 +64,7 @@ class AuthApi: ... last_name="User", ... ) >>> auth_api.create_user(new_user) + """ def __init__(self, client): @@ -81,8 +81,7 @@ def keycloak_admin_client(self) -> KeycloakAdmin: return _admin_client(self.client) def get_users(self, as_objects=True, **query_params) -> List[User]: - """ - Get users, filtered according to query parameters. + """Get users, filtered according to query parameters. Examples of query parameters are: - ``username`` @@ -97,68 +96,19 @@ def get_users(self, as_objects=True, **query_params) -> List[User]: return get_users(self.keycloak_admin_client, as_objects=as_objects, **query_params) def get_user(self, id: str) -> User: - """ - Get the user representation for a given user ID. - - Parameters - ---------- - id : str - User ID. - - Returns - ------- - User - User object. - """ + """Get the user representation for a given user ID.""" return get_user(self.keycloak_admin_client, id) def get_user_groups(self, id: str) -> List[str]: - """ - Get the groups that the user belongs to. - - Parameters - ---------- - id : str - User ID. - - Returns - ------- - List[str] - List of groups the user belongs to. - """ + """Get the groups that the user belongs to.""" return [g["name"] for g in self.keycloak_admin_client.get_user_groups(id)] def get_user_realm_roles(self, id: str) -> List[str]: - """ - Get the realm roles for the user. - - Parameters - ---------- - id : str - User ID. - - Returns - ------- - List[str] - List of realm roles for the user. - """ + """Get the realm roles for the user.""" return [r["name"] for r in self.keycloak_admin_client.get_realm_roles_of_user(id)] def user_is_admin(self, id: str) -> bool: - """ - Determine if the user is a system administrator. - - Parameters - ---------- - id : str - User ID. - - Returns - ------- - bool - ``True`` if the user is a system administrator. - ``False`` if the user is not a system administrator. - """ + """Determine if the user is a system administrator.""" from ansys.hps.client.jms import JmsApi @@ -180,8 +130,7 @@ def user_is_admin(self, id: str) -> bool: return False def create_user(self, user: User, as_objects=True) -> User: - """ - Create a user. + """Create a user. Parameters ---------- @@ -189,17 +138,11 @@ def create_user(self, user: User, as_objects=True) -> User: User object. The default is ``None``. as_objects : bool, optional The default is ``True``. - - Returns - ------- - User - User object. """ return create_user(self.keycloak_admin_client, user, as_objects=as_objects) def update_user(self, user: User, as_objects=True) -> User: - """ - Modify an existing user. + """Modify an existing user. Parameters ---------- @@ -207,17 +150,11 @@ def update_user(self, user: User, as_objects=True) -> User: User object. The default is ``None``. as_objects : bool, optional The default is ``True``. - - Returns - ------- - User - User object. """ return update_user(self.keycloak_admin_client, user, as_objects=as_objects) def delete_user(self, user: User) -> None: - """ - Delete an existing user. + """Delete an existing user. Parameters ---------- @@ -228,8 +165,7 @@ def delete_user(self, user: User) -> None: def _admin_client(client): - """ - Set information for admin. + """Set information for admin. Parameters ---------- @@ -253,8 +189,7 @@ def _admin_client(client): def get_users(admin_client: KeycloakAdmin, as_objects=True, **query_params): - """ - Get users as admin. + """Get users as admin. Parameters ---------- @@ -271,8 +206,7 @@ def get_users(admin_client: KeycloakAdmin, as_objects=True, **query_params): def get_user(admin_client: KeycloakAdmin, id: str, as_objects=True): - """ - Get user using ID. + """Get user using ID. Parameters ---------- @@ -291,8 +225,7 @@ def get_user(admin_client: KeycloakAdmin, id: str, as_objects=True): def create_user(admin_client: KeycloakAdmin, user: User, as_objects=True): - """ - Create user. + """Create user. Parameters ---------- @@ -319,8 +252,7 @@ def create_user(admin_client: KeycloakAdmin, user: User, as_objects=True): def update_user(admin_client: KeycloakAdmin, user: User, as_objects=True): - """ - Update user. + """Update user. Parameters ---------- diff --git a/src/ansys/hps/client/auth/resource/user.py b/src/ansys/hps/client/auth/resource/user.py index 6b9e6a1d9..fc4ff2d0a 100644 --- a/src/ansys/hps/client/auth/resource/user.py +++ b/src/ansys/hps/client/auth/resource/user.py @@ -19,7 +19,6 @@ # 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 the user resource.""" # autogenerated code from marshmallow.utils import missing @@ -29,8 +28,7 @@ class User(Object): - """ - Provides the user resource. + """Provides the user resource. Parameters ---------- diff --git a/src/ansys/hps/client/jms/resource/evaluator.py b/src/ansys/hps/client/jms/resource/evaluator.py index 43f4f9933..c45f44ecd 100644 --- a/src/ansys/hps/client/jms/resource/evaluator.py +++ b/src/ansys/hps/client/jms/resource/evaluator.py @@ -19,7 +19,6 @@ # 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 the evaluator resource and updating its configuration.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/job.py b/src/ansys/hps/client/jms/resource/job.py index 65ff2e8e7..55150c3a0 100644 --- a/src/ansys/hps/client/jms/resource/job.py +++ b/src/ansys/hps/client/jms/resource/job.py @@ -19,7 +19,6 @@ # 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 a job resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/job_definition.py b/src/ansys/hps/client/jms/resource/job_definition.py index 61036a4e1..29b499d5f 100644 --- a/src/ansys/hps/client/jms/resource/job_definition.py +++ b/src/ansys/hps/client/jms/resource/job_definition.py @@ -19,7 +19,6 @@ # 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 the job definition resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/license_context.py b/src/ansys/hps/client/jms/resource/license_context.py index e6facb96d..abcb302df 100644 --- a/src/ansys/hps/client/jms/resource/license_context.py +++ b/src/ansys/hps/client/jms/resource/license_context.py @@ -19,7 +19,6 @@ # 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 the license context resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/operation.py b/src/ansys/hps/client/jms/resource/operation.py index 1523cfbf0..605c2fb96 100644 --- a/src/ansys/hps/client/jms/resource/operation.py +++ b/src/ansys/hps/client/jms/resource/operation.py @@ -19,7 +19,6 @@ # 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 the operation resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/parameter_definition.py b/src/ansys/hps/client/jms/resource/parameter_definition.py index 0eb030675..c4c8ec363 100644 --- a/src/ansys/hps/client/jms/resource/parameter_definition.py +++ b/src/ansys/hps/client/jms/resource/parameter_definition.py @@ -19,8 +19,6 @@ # 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 the float, integer, boolean, and string parameter definition resources.""" - # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/parameter_mapping.py b/src/ansys/hps/client/jms/resource/parameter_mapping.py index aee1fa9da..0669a92a1 100644 --- a/src/ansys/hps/client/jms/resource/parameter_mapping.py +++ b/src/ansys/hps/client/jms/resource/parameter_mapping.py @@ -19,7 +19,6 @@ # 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 the parameter mapping resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/permission.py b/src/ansys/hps/client/jms/resource/permission.py index 6e12b6857..2ef8c182d 100644 --- a/src/ansys/hps/client/jms/resource/permission.py +++ b/src/ansys/hps/client/jms/resource/permission.py @@ -19,7 +19,6 @@ # 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 the permission resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/project.py b/src/ansys/hps/client/jms/resource/project.py index 59da9e28b..fe91886c9 100644 --- a/src/ansys/hps/client/jms/resource/project.py +++ b/src/ansys/hps/client/jms/resource/project.py @@ -19,7 +19,6 @@ # 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 the project resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/selection.py b/src/ansys/hps/client/jms/resource/selection.py index 3074928e9..6f857b9b2 100644 --- a/src/ansys/hps/client/jms/resource/selection.py +++ b/src/ansys/hps/client/jms/resource/selection.py @@ -19,7 +19,6 @@ # 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 the job selection resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/task.py b/src/ansys/hps/client/jms/resource/task.py index 2ac8dfe54..c5069ef04 100644 --- a/src/ansys/hps/client/jms/resource/task.py +++ b/src/ansys/hps/client/jms/resource/task.py @@ -19,7 +19,6 @@ # 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 the task resource.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/task_definition.py b/src/ansys/hps/client/jms/resource/task_definition.py index fee6aa390..4672cf6d2 100644 --- a/src/ansys/hps/client/jms/resource/task_definition.py +++ b/src/ansys/hps/client/jms/resource/task_definition.py @@ -19,8 +19,6 @@ # 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 the HPC, resource requirements, software, success criteria, -licensing, and task definition resources.""" # autogenerated code from marshmallow.utils import missing diff --git a/src/ansys/hps/client/jms/resource/task_definition_template.py b/src/ansys/hps/client/jms/resource/task_definition_template.py index a49ba22cb..73f44873b 100644 --- a/src/ansys/hps/client/jms/resource/task_definition_template.py +++ b/src/ansys/hps/client/jms/resource/task_definition_template.py @@ -19,8 +19,6 @@ # 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 the template property, template resource requirements, -template input file, template output file, and task definition template resources.""" # autogenerated code from marshmallow.utils import missing From 5cef4b0af6140de533a0ea76ec764ca4a4f74788 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Wed, 31 Jan 2024 13:10:50 -0500 Subject: [PATCH 56/61] workflow & version updates --- .github/workflows/ci_cd.yml | 10 +--- .github/workflows/nightly.yml | 105 ++++++++++++++++++++++------------ pyproject.toml | 2 +- 3 files changed, 72 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index e657db85e..c43d3512a 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -43,7 +43,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} - tests: + quick-tests: name: Quick tests and coverage runs-on: ${{ matrix.os }} strategy: @@ -51,12 +51,8 @@ jobs: os: [ubuntu-latest] cfg: [ { python-version: '3.9', toxenv: 'py39' }, - { python-version: '3.10', toxenv: 'py310' }, - { python-version: '3.11', toxenv: 'py311' }, - { python-version: '3.12', toxenv: 'py312' }, ] fail-fast: false - steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.cfg.python-version }} @@ -176,7 +172,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.9', '3.10', '3.11', '3.12'] + python-version: ['3.9'] should-release: - ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }} exclude: @@ -192,7 +188,7 @@ jobs: package: name: Package library - needs: [tests, docs] + needs: [quick-tests, docs] runs-on: ubuntu-latest steps: - name: Build library source and wheel artifacts diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index cae6ef242..7e7856718 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -28,19 +28,28 @@ jobs: python -m pip install --upgrade pip setuptools tox - name: Test with tox run: tox -e style + + doc-style: + name: Documentation Style Check + runs-on: ubuntu-latest + steps: + - name: PyAnsys documentation style checks + uses: ansys/actions/doc-style@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} quick-tests: name: Quick tests and coverage runs-on: ${{ matrix.os }} strategy: matrix: - # extend to windows once it's possible to run docker - # on windows runners: - # os: [windows-latest, ubuntu-latest] - os: [ubuntu-latest] - cfg: - - {python-version: "3.9", toxenv: "py39"} - - {python-version: "3.11", toxenv: "py311"} + os: [ubuntu-latest] + cfg: [ + { python-version: '3.9', toxenv: 'py39' }, + { python-version: '3.10', toxenv: 'py310' }, + { python-version: '3.11', toxenv: 'py311' }, + { python-version: '3.12', toxenv: 'py312' }, + ] fail-fast: false steps: @@ -67,7 +76,7 @@ jobs: - uses: KengoTODA/actions-setup-docker-compose@main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + - name: Login in Github Container registry uses: docker/login-action@v2 with: @@ -88,68 +97,90 @@ jobs: working-directory: ./docker-compose-artifact - name: Test with tox - run: tox -e ${{ matrix.cfg.toxenv }}-noeval-coverage + run: tox -e ${{ matrix.cfg.toxenv }}-noeval-coverage env: REP_TEST_URL: https://localhost:8443/rep REP_TEST_USERNAME: repadmin REP_TEST_PASSWORD: repadmin + - name: "Upload coverage results" + uses: actions/upload-artifact@v4 + if: matrix.cfg.python-version == env.MAIN_PYTHON_VERSION + with: + name: coverage-html + path: .cov/html + retention-days: 7 + - name: Publish Test Report uses: mikepenz/action-junit-report@v3 if: always() with: report_paths: '**/test*.xml' - check_name: Test Report ${{ matrix.os }}:${{ matrix.cfg.python-version }} + check_name: Test Report ${{ matrix.os }}:${{ matrix.cfg.python-version }} detailed_summary: true include_passed: true - + - name: Stop services if: always() run: | docker-compose down -v working-directory: ./docker-compose-artifact/docker-compose - - build: - name: Build wheel - runs-on: ubuntu-latest + + smoke-tests: + name: Build and Smoke tests + 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: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 + - name: Build wheelhouse and perform smoke test + uses: ansys/actions/build-wheelhouse@v5 with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - - name: Install dependencies and build the library - run: | - python -m pip install --upgrade pip setuptools - python -m pip install -e .[build] - python -m build venv wheel - python -m twine check dist/* - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: pyhps-package - path: | - dist/*.whl - retention-days: 5 + library-name: ${{ env.PACKAGE_NAME }} + operating-system: ${{ matrix.os }} + python-version: ${{ matrix.python-version }} docs: name: Documentation runs-on: ubuntu-latest - # needs: docs-style + needs: [style, doc-style] steps: - uses: actions/checkout@v3 + - name: Set up Python uses: actions/setup-python@v4 with: - python-version: ${{ env.DOC_PYTHON_VERSION }} + python-version: ${{ env.MAIN_PYTHON_VERSION }} + - name: Install dependencies run: | python -m pip install --upgrade pip setuptools tox + + # Necessary for creating PDF + sudo apt-get -y install latexmk + sudo apt install texlive-latex-extra + - name: Generate the documentation with tox run: tox -e doc + - name: Upload HTML Documentation - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: documentation-html - path: build/sphinx/html - retention-days: 5 + path: doc/_build/html + retention-days: 7 + + - name: Upload PDF Documentation + uses: actions/upload-artifact@v4 + with: + name: documentation-pdf + path: doc/_build/latex/*.pdf + retention-days: 7 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index dc4dbbf57..3f284f37f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi" [project] # Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections name = "ansys-hps-client" -version = "0.6.dev0" +version = "0.7.dev0" description = "A python client for Ansys HPC Platform Services" readme = "README.rst" requires-python = ">=3.9,<4.0" From d4ae342128436940234efb4e112b2a7da1905798 Mon Sep 17 00:00:00 2001 From: Kerry McAdams Date: Wed, 31 Jan 2024 13:26:59 -0500 Subject: [PATCH 57/61] main python version 3.10 to match workflow settings --- .github/workflows/ci_cd.yml | 12 ++++++------ .github/workflows/nightly.yml | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index c43d3512a..02e69d814 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -9,7 +9,7 @@ on: - main env: - MAIN_PYTHON_VERSION: '3.9' + MAIN_PYTHON_VERSION: '3.10' DOCUMENTATION_CNAME: 'hps.docs.pyansys.com' PACKAGE_NAME: 'ansys-hps-client' @@ -43,14 +43,14 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} - quick-tests: + tests: name: Quick tests and coverage runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest] cfg: [ - { python-version: '3.9', toxenv: 'py39' }, + { python-version: '3.10', toxenv: 'py310' }, ] fail-fast: false steps: @@ -172,7 +172,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.9'] + python-version: ['3.10'] should-release: - ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }} exclude: @@ -188,7 +188,7 @@ jobs: package: name: Package library - needs: [quick-tests, docs] + needs: [tests, docs] runs-on: ubuntu-latest steps: - name: Build library source and wheel artifacts @@ -265,7 +265,7 @@ jobs: with: doc-artifact-name: 'documentation-html' cname: ${{ env.DOCUMENTATION_CNAME }} - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} release: name: Release project diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 7e7856718..d77ab39c5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -5,8 +5,9 @@ on: - cron: "0 2 * * *" env: - MAIN_PYTHON_VERSION: '3.9' - DOC_PYTHON_VERSION: '3.9' + MAIN_PYTHON_VERSION: '3.10' + DOCUMENTATION_CNAME: 'hps.docs.pyansys.com' + PACKAGE_NAME: 'ansys-hps-client' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -38,7 +39,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} - quick-tests: + tests: name: Quick tests and coverage runs-on: ${{ matrix.os }} strategy: From 7f0f0c9215f14f323ceeca244bf02d6c55c77c2d Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Thu, 1 Feb 2024 08:35:58 +0100 Subject: [PATCH 58/61] fix: smoke tests should run all Python versions --- .github/workflows/ci_cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 02e69d814..ac2b9bb6d 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -172,7 +172,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.10'] + python-version: ['3.9', '3.10', '3.11', '3.12'] should-release: - ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }} exclude: @@ -296,4 +296,4 @@ jobs: with: doc-artifact-name: 'documentation-html' cname: ${{ env.DOCUMENTATION_CNAME }} - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + token: ${{ secrets.GITHUB_TOKEN }} From 482f189b4ef7d938e9ac32b7c41b4dec5c2fe11c Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Thu, 1 Feb 2024 08:48:31 +0100 Subject: [PATCH 59/61] fix: dependent stages --- .github/workflows/ci_cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index ac2b9bb6d..79ed69194 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -130,7 +130,7 @@ jobs: docs: name: Documentation runs-on: ubuntu-latest - needs: [style, doc-style] + needs: [doc-style] steps: - uses: actions/checkout@v3 @@ -188,7 +188,7 @@ jobs: package: name: Package library - needs: [tests, docs] + needs: [tests, docs, smoke-tests] runs-on: ubuntu-latest steps: - name: Build library source and wheel artifacts From ea03310b84c7d5b81c564f6bf133268dddf5cc32 Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Thu, 1 Feb 2024 08:49:20 +0100 Subject: [PATCH 60/61] fix: dependent stage --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 79ed69194..80ac43eb4 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -258,7 +258,7 @@ jobs: name: "Upload dev documentation" if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest - needs: [docs, pre-release] + needs: [docs] steps: - name: Deploy the latest documentation uses: ansys/actions/doc-deploy-dev@v4 From 164b90ec4ce9be0fb9f4954ab65db49f7550f821 Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Thu, 1 Feb 2024 08:52:07 +0100 Subject: [PATCH 61/61] fix: dependent stages --- .github/workflows/ci_cd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 80ac43eb4..129d55fff 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -255,10 +255,10 @@ jobs: /tmp/artifacts/*.whl upload_dev_docs: - name: "Upload dev documentation" + name: "Deploy dev documentation" if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest - needs: [docs] + needs: [package] steps: - name: Deploy the latest documentation uses: ansys/actions/doc-deploy-dev@v4 @@ -290,7 +290,7 @@ jobs: # Deploy release documentation when creating a new tag if: github.event_name == 'push' && contains(github.ref, 'refs/tags') runs-on: ubuntu-latest - needs: [docs, release] + needs: [release] steps: - uses: ansys/actions/doc-deploy-stable@v4 with: