Skip to content

Commit 76d37e2

Browse files
cbellot000PProfiziTheGoldfish01dependabot[bot]jorgepiloto
authored
Merge/retro/refactor actions grpc (#339)
* Change ANSYS_VERSION to 222 * Add step for pygate 0.1.dev1 installation * Add step for pygate 0.1.dev1 installation * Add trigger for ci * Add trigger for ci * Fix conditional for gatebin install steps * Fix gatebin install steps * Add the wheels temporarily * Fix step conditional * Change requirement to ansys-dpf-gate==0.1.dev1 * Add pygate steps to documentation job * Run Doc on windows-latest * Move build installation of pygate to pydpf-actions * Fix conditionals * Update gate wheel * Add up-to-date ansys-grpc-dpf wheel * Remove ANSYS_VERSION env setter from build_doc job * Add install of local ansys-grpc-dpf wheel * Solve docstring test for download_file * Solve docstring test for download_file * Solve docstring test for download_file * Solve docstring test for download_file * Update pygate wheel * Fix doctests * Fix doctests * Fix doctests * Fix doctests * Fix doctests * pytest.ini: add doctest NORMALIZE_WHITESPACE and ELLIPSIS by default * remove inline #doctest: options * Fix doctest * Fix doctest * Fix doctest * Fix doctest * Fix doctest * Fix doctest * use v2.2 pydpf-actions * Target potential failing test * Change local_test_repo to False * Comment-out segfault test * Remove contrain on ansys-dpf-gate version in setup.py install_requires * Try-out DEBUG option for pydpf-actions/test_package * Revert "Comment-out segfault test" This reverts commit 5f03a49. * Revert "Target potential failing test" This reverts commit fac439a. * Fix test_busy_port from lea's PR on TFS * Fix conftest according to TFS PR form Lea * Fix gatebin tests from TFS PR Lea * Update wheels * Remove Report from test in install package * Fix flake8 * Try-out on Python 3.7 same as TFS * Bump imageio from 2.19.3 to 2.19.5 (#312) Bumps [imageio](https://github.com/imageio/imageio) from 2.19.3 to 2.19.5. - [Release notes](https://github.com/imageio/imageio/releases) - [Changelog](https://github.com/imageio/imageio/blob/master/CHANGELOG.md) - [Commits](imageio/imageio@v2.19.3...v2.19.5) --- updated-dependencies: - dependency-name: imageio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> (cherry picked from commit 9e6584a) * MAINT: collect dependencies under a requirements/ directory (#307) * Collect dependencies under requirements/ dir * Enhance .gitigore * Update actions to new requirements layout * Update documentation * Update action versions (cherry picked from commit 79e5bfc) * Bump sphinx-notfound-page from 0.8 to 0.8.3 (#308) Bumps [sphinx-notfound-page](https://github.com/readthedocs/sphinx-notfound-page) from 0.8 to 0.8.3. - [Release notes](https://github.com/readthedocs/sphinx-notfound-page/releases) - [Changelog](https://github.com/readthedocs/sphinx-notfound-page/blob/main/CHANGELOG.rst) - [Commits](readthedocs/sphinx-notfound-page@0.8...0.8.3) --- updated-dependencies: - dependency-name: sphinx-notfound-page dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> (cherry picked from commit 693b83d) * Bump coverage from 6.4.1 to 6.4.2 (#306) Bumps [coverage](https://github.com/nedbat/coveragepy) from 6.4.1 to 6.4.2. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](nedbat/coveragepy@6.4.1...6.4.2) --- updated-dependencies: - dependency-name: coverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> (cherry picked from commit c3d434f) * Bump actions/setup-python from 4.0.0 to 4.1.0 (#302) Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.0.0 to 4.1.0. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@v4...v4.1.0) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> (cherry picked from commit 251b1fd) * Add a retrocompatibility workflow (#310) * Add a retro-compatibility workflow * Trigger on pull_requests to retro/ branches Trigger also for release/ branches * Update pydpf-actions to 2.1.1 * Update to trigger on pull_requests FROM a retro or release branch * Fix vtk version in setup.py extras_require[plotting] * Add concurrency criterion * Revert Fix vtk version in setup.py extras_require[plotting]: vtk 9.0.3 not available for Python 3.10 * Fix unbuntu doctest error due to unsorted available_property_fields list * Rename job * Update run criteria * Update run criteria * Go back to Windows 3.8 only * Add empty line at end-of-file Co-authored-by: Paul P <[email protected]> (cherry picked from commit 3ca756d) * Use pydpf-actions @v2.2 for retro.yml * Add kill-all-servers steps * Add search for AWP_ROOT221 and others in decreasing order as a last resort. * Reduces restrains in requirements_docs.txt * Try fix doc generation for 06-stress_gradient_path.py * Try fix doc generation for 06-stress_gradient_path.py * Revert "Try fix doc generation for 06-stress_gradient_path.py" This reverts commit 7d7f959. * Revert "Try fix doc generation for 06-stress_gradient_path.py" This reverts commit 6d3f0f7. * Fix doc generation * Use wheel and wheelhouse options of build_package action v2.2 * Set wheelhouse generation to false while gate not available on PyPi * REtro now does not test docstrings * Update wheels of gate, grpc, * Move find_ansys() to last resort. If only AWP_ROOT221 is declared, it should not prioritize a 222 install in the default directory. * Restrict TestServerConfigs tests to servers >= 4.0 * Moved ansys_path retrieval logic to misc along with find_ansys, in get_ansys_path. Is now used to correctly determine if MAPDL is available with the installation actually used for testing. * remove rogue prints * Fixture for server<4.0 now only use global server * Rename test_remote_workflow.py * Fix import * Conftest autouse fixture count_servers * Set ansys_path argument of get_ansys_path to None by default * Revert "Conftest autouse fixture count_servers" This reverts commit c4b1f07. * Conftest actually count_servers with fixture * Fix flake8 * Fix flake8 * Remove code merged by error. * Remove test_set_coordinates_field_meshed_region which should come with new commits from TFS * Remove assert nb_servers=1 from count_servers fixture * Move and rename test_launch_server_not_install to test_launcher.py as test_launch_server_full_path * Fix GrpcServer.shutdown() * Add a version test before trying to launch an InProcess server * Remove version test, add warning to get info on ansys_path used. * ADD WARNINGS FOR DEBUG * ADD TIMESTAMP * Use [email protected] * Revert "Use [email protected]" This reverts commit e8e5835. * Revert "ADD TIMESTAMP" This reverts commit 4ce75de. * Revert "ADD WARNINGS FOR DEBUG" This reverts commit c02c4a0. * Remove warning used for debug * Fix test_start_local_failed_executable * Fix test_busy_port * Try [email protected] * Up doc install-dpf-server to v2.2 * Revert "Try [email protected]" This reverts commit 4d28452. * Set autouse of count_servers fixture to false * Fix codacy errors * Add back test_launch_server_not_install and rename it as test_launcher_server_full_path * Refactor get_ansys_path and find_ansys * Add back a print in test_print_data_sources_path * find_ansys does not filter out the current ansys version for AWP_ROOT * Remove unused fixtures * Set DOCTEST in retro back to true * Revert "Set DOCTEST in retro back to true" This reverts commit 53ed94a. * Test conditionals * Set wheelhouse to default (false) * Set doctest to default (true) * Revert "Set doctest to default (true)" This reverts commit 3c9460d. * Set doctest to false * Revert "Remove unused fixtures" This reverts commit 78894f6. * Remove fixture config_server_type * Refactor test job using new smaller actions * fix ci * dummy * revert dummy * dummy * pre command * doc and backward comp * backward comp fixes * update doc and ansys.grpc.dpf * fix doc * fix merge Co-authored-by: paul.profizi <[email protected]> Co-authored-by: Paul P <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jorge Martínez <[email protected]> Co-authored-by: PProfizi <[email protected]>
1 parent c8d8d54 commit 76d37e2

File tree

10 files changed

+168
-81
lines changed

10 files changed

+168
-81
lines changed
Binary file not shown.

.github/workflows/ci.yml

Lines changed: 79 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,85 @@ jobs:
3535
- uses: actions/checkout@v3
3636

3737
- name: "Build Package"
38-
uses: pyansys/pydpf-actions/[email protected]
38+
uses: pyansys/pydpf-actions/[email protected].dev1
3939
with:
4040
python-version: ${{ matrix.python-version }}
4141
ANSYS_VERSION: ${{env.ANSYS_VERSION}}
4242
PACKAGE_NAME: ${{env.PACKAGE_NAME}}
4343
MODULE: ${{env.MODULE}}
4444
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}}
4545
install_extras: plotting
46-
wheelhouse: "false"
46+
wheelhouse: false
47+
extra-pip-args: "--pre --find-links .github/workflows/"
4748

48-
- name: "Test Package"
49-
uses: pyansys/pydpf-actions/[email protected]
49+
- name: "Prepare Testing Environment"
50+
uses: pyansys/pydpf-actions/[email protected]
51+
with:
52+
DEBUG: true
53+
54+
- name: "Test Docstrings"
55+
uses: pyansys/pydpf-actions/[email protected]
5056
with:
5157
MODULE: ${{env.MODULE}}
52-
DEBUG: True
58+
PACKAGE_NAME: ${{env.PACKAGE_NAME}}
59+
60+
- name: "Separate long Core tests"
61+
shell: pwsh
62+
run: |
63+
New-Item -Path ".\" -Name "local_server_test" -ItemType "directory"
64+
New-Item -Path ".\" -Name "test_workflow" -ItemType "directory"
65+
Copy-Item -Path "tests\conftest.py" -Destination ".\local_server_test\"
66+
Copy-Item -Path "tests\conftest.py" -Destination ".\test_workflow\"
67+
Copy-Item -Path "tests\test_launcher.py" -Destination ".\local_server_test\"
68+
Copy-Item -Path "tests\test_server.py" -Destination ".\local_server_test\"
69+
Copy-Item -Path "tests\test_local_server.py" -Destination ".\local_server_test\"
70+
Copy-Item -Path "tests\test_multi_server.py" -Destination ".\local_server_test\"
71+
Copy-Item -Path "tests\test_workflow.py" -Destination ".\test_workflow\"
72+
Copy-Item -Path "tests\test_remote_workflow.py" -Destination ".\local_server_test\"
73+
Copy-Item -Path "tests\test_remote_operator.py" -Destination ".\local_server_test\"
74+
Remove-Item -Path "tests\test_server.py"
75+
Remove-Item -Path "tests\test_launcher.py"
76+
Remove-Item -Path "tests\test_local_server.py"
77+
Remove-Item -Path "tests\test_multi_server.py"
78+
Remove-Item -Path "tests\test_workflow.py"
79+
Remove-Item -Path "tests\test_remote_workflow.py"
80+
Remove-Item -Path "tests\test_remote_operator.py"
81+
82+
- name: "Test API"
83+
shell: bash
84+
working-directory: tests
85+
run: |
86+
pytest $DEBUG --cov=ansys.dpf.${{env.MODULE}} --cov-report=xml --cov-report=html --log-level=ERROR --junitxml=junit/test-results.xml --reruns 2 .
87+
88+
- name: "Kill all servers"
89+
uses: pyansys/pydpf-actions/[email protected]
90+
91+
- name: "Test API 2"
92+
shell: bash
93+
working-directory: local_server_test
94+
run: |
95+
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results2.xml --reruns 2 .
96+
97+
- name: "Kill all servers"
98+
uses: pyansys/pydpf-actions/[email protected]
99+
100+
- name: "Test API 3"
101+
shell: bash
102+
working-directory: test_workflow
103+
run: |
104+
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results3.xml --reruns 3 .
105+
106+
- name: "Kill all servers"
107+
uses: pyansys/pydpf-actions/[email protected]
108+
109+
- name: "Upload Test Results"
110+
uses: actions/upload-artifact@v2
111+
with:
112+
name: ${{ env.PACKAGE_NAME }}_pytest
113+
path: tests/junit/test-results.xml
114+
115+
- name: "Upload coverage to Codecov"
116+
uses: codecov/codecov-action@v2
53117

54118
- name: 'Upload to PyPi'
55119
if: contains(github.ref, 'refs/tags')
@@ -75,38 +139,18 @@ jobs:
75139
with:
76140
python-version: 3.8
77141

78-
- id: install-dpf
79-
uses: pyansys/pydpf-actions/[email protected]
142+
- name: "Build Package"
143+
id: build-package
144+
uses: pyansys/pydpf-actions/[email protected]
80145
with:
146+
python-version: ${{ matrix.python-version }}
147+
ANSYS_VERSION: ${{env.ANSYS_VERSION}}
148+
PACKAGE_NAME: ${{env.PACKAGE_NAME}}
149+
MODULE: ${{env.MODULE}}
81150
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}}
82-
ANSYS_VERSION : ${{env.ANSYS_VERSION}}
83-
84-
- name: Set AWP_ROOT$env:ANSYS_VERSION
85-
run: echo "AWP_ROOT$env:ANSYS_VERSION=${{ steps.install-dpf.outputs.SERVER }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
86-
87-
- name: Set SERVER
88-
run: echo "SERVER=$env:AWP_ROOT221" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
89-
90-
- name: "Install gatebin Windows"
91-
working-directory: .github\workflows
92-
run: pip install ansys_dpf_gatebin-0.1.dev1-py3-none-win_amd64.whl
93-
94-
- name: "Install pygate"
95-
working-directory: .github\workflows
96-
run: |
97-
pip install ansys_dpf_gate-0.1.dev1-py3-none-any.whl
98-
pip install ansys_grpc_dpf-0.5.dev1-py3-none-any.whl
99-
100-
- name: Install ansys-dpf-core
101-
shell: cmd
102-
run: |
103-
pip install -r requirements/requirements_build.txt
104-
python setup.py bdist_wheel
105-
FOR /F %%a in ('dir /s/b dist\*.whl') do SET WHEELPATH=%%a
106-
ECHO %WHEELPATH%
107-
cd tests
108-
pip install %WHEELPATH%
109-
python -c "from ansys.dpf import core"
151+
install_extras: plotting
152+
wheelhouse: false
153+
extra-pip-args: "--pre --find-links .github/workflows/"
110154

111155
- name: Install OpenGL
112156
run: |

.github/workflows/retro.yml

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,70 @@ jobs:
2828
- uses: actions/checkout@v3
2929

3030
- name: "Build Package"
31-
uses: pyansys/pydpf-actions/[email protected]
31+
uses: pyansys/pydpf-actions/[email protected].dev1
3232
with:
3333
python-version: ${{ matrix.python-version }}
3434
ANSYS_VERSION: ${{env.ANSYS_VERSION}}
3535
PACKAGE_NAME: ${{env.PACKAGE_NAME}}
3636
MODULE: ${{env.MODULE}}
3737
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}}
3838
install_extras: plotting
39-
wheel: "false"
40-
wheelhouse: "false"
39+
wheel: false
40+
extra-pip-args: "--pre --find-links .github/workflows/"
41+
42+
- name: "Install ansys-grpc-dpf==0.4.0"
43+
shell: pwsh
44+
run: |
45+
pip install ansys-grpc-dpf==0.4.0
4146
42-
- name: "Test Package"
43-
uses: pyansys/pydpf-actions/test_package@v2.2.dev0
47+
- name: "Prepare Testing Environment"
48+
uses: pyansys/pydpf-actions/prepare_tests@v2.2
4449
with:
45-
MODULE: ${{env.MODULE}}
46-
DOCTEST: "false"
50+
DEBUG: true
51+
52+
- name: "Separate long Core tests"
53+
shell: pwsh
54+
run: |
55+
New-Item -Path ".\" -Name "local_server_test" -ItemType "directory"
56+
Copy-Item -Path "tests\conftest.py" -Destination ".\local_server_test\"
57+
Copy-Item -Path "tests\test_launcher.py" -Destination ".\local_server_test\"
58+
Copy-Item -Path "tests\test_server.py" -Destination ".\local_server_test\"
59+
Copy-Item -Path "tests\test_local_server.py" -Destination ".\local_server_test\"
60+
Copy-Item -Path "tests\test_multi_server.py" -Destination ".\local_server_test\"
61+
Copy-Item -Path "tests\test_workflow.py" -Destination ".\local_server_test\"
62+
Copy-Item -Path "tests\test_remote_workflow.py" -Destination ".\local_server_test\"
63+
Copy-Item -Path "tests\test_remote_operator.py" -Destination ".\local_server_test\"
64+
Remove-Item -Path "tests\test_server.py"
65+
Remove-Item -Path "tests\test_launcher.py"
66+
Remove-Item -Path "tests\test_local_server.py"
67+
Remove-Item -Path "tests\test_multi_server.py"
68+
Remove-Item -Path "tests\test_workflow.py"
69+
Remove-Item -Path "tests\test_remote_workflow.py"
70+
Remove-Item -Path "tests\test_remote_operator.py"
71+
72+
- name: "Test API"
73+
shell: bash
74+
working-directory: tests
75+
run: |
76+
pytest $DEBUG --cov=ansys.dpf.${{env.MODULE}} --cov-report=xml --cov-report=html --log-level=ERROR --junitxml=junit/test-results.xml --reruns 2 .
77+
78+
- name: "Kill all servers"
79+
uses: pyansys/pydpf-actions/[email protected]
80+
81+
- name: "Test API 2"
82+
shell: bash
83+
working-directory: local_server_test
84+
run: |
85+
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results2.xml --reruns 2 .
86+
87+
- name: "Kill all servers"
88+
uses: pyansys/pydpf-actions/[email protected]
89+
90+
- name: "Upload Test Results"
91+
uses: actions/upload-artifact@v2
92+
with:
93+
name: ${{ env.PACKAGE_NAME }}_pytest
94+
path: tests/junit/test-results.xml
95+
96+
- name: "Upload coverage to Codecov"
97+
uses: codecov/codecov-action@v2

ansys/dpf/core/_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
min_server_version = "2.0"
88

99
server_to_ansys_grpc_dpf_version = {
10-
"1.0": "0.2.2",
11-
"2.0": "0.3.0",
10+
"1.0": "==0.2.2",
11+
"2.0": "==0.3.0",
1212
"3.0": ">=0.4.0",
1313
"4.0": ">=0.5.0",
1414
}

ansys/dpf/core/data_tree.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ def __init__(self, data=None, data_tree=None, server=None):
8383
# step 2: get api
8484
self._api_instance = None # see property self._api
8585

86-
# step3: init environment
87-
self._api.init_dpf_data_tree_environment(self) # creates stub when gRPC
88-
8986
# step4: if object exists, take the instance, else create it
9087
if data_tree is not None:
88+
if not isinstance(data_tree, dict):
89+
# step3: init environment
90+
self._api.init_dpf_data_tree_environment(self) # creates stub when gRPC
9191
self._internal_obj = data_tree
9292
else:
93+
# step3: init environment
94+
self._api.init_dpf_data_tree_environment(self) # creates stub when gRPC
9395
if self._server.has_client():
9496
self._internal_obj = self._api.dpf_data_tree_new_on_client(self._server.client)
9597
else:

ansys/dpf/core/misc.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ def find_ansys():
122122
for version in sorted(versions, reverse=True):
123123
if not version.isnumeric():
124124
continue
125-
if version == __ansys_version__:
126-
continue
127125
elif version < __ansys_version__:
128126
ansys_path = os.environ.get("AWP_ROOT" + version)
129127
if ansys_path:

ansys/dpf/core/server_types.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def _compare_ansys_grpc_dpf_version(right_grpc_module_version_str: str, grpc_mod
234234
from packaging.version import parse as parse_version
235235
right_version_first_numbers = re.search(r"\d", right_grpc_module_version_str)
236236
right_version_numbers = right_grpc_module_version_str[
237-
right_version_first_numbers.start():-1]
237+
right_version_first_numbers.start():]
238238
compare = "==" if right_version_first_numbers.start() == 0 else \
239239
right_grpc_module_version_str[0:right_version_first_numbers.start()].strip()
240240
if compare == "==":
@@ -282,7 +282,7 @@ def check_ansys_grpc_dpf_version(server, timeout):
282282
f"{compatibility_link} while still using DPF server {server_version}, "
283283
f"please install version {right_grpc_module_version} of ansys-grpc-dpf"
284284
f" with the command: \n"
285-
f" pip install ansys-grpc-dpf=={right_grpc_module_version}"
285+
f" pip install ansys-grpc-dpf{right_grpc_module_version}"
286286
)
287287

288288

@@ -754,13 +754,7 @@ def __init__(
754754
def _create_shutdown_funcs(self):
755755
self._core_api = data_processing_grpcapi.DataProcessingGRPCAPI
756756
self._core_api.init_data_processing_environment(self)
757-
from ansys.grpc.dpf import base_pb2
758-
self._preparing_shutdown_func = (
759-
data_processing_grpcapi._get_stub(self).PrepareShutdown, base_pb2.Empty()
760-
)
761-
self._shutdown_func = (
762-
data_processing_grpcapi._get_stub(self).ReleaseServer, base_pb2.Empty()
763-
)
757+
self._core_api.bind_delete_server_func(self)
764758

765759
@property
766760
def client(self):

docs/source/_static/dpf.html

Lines changed: 21 additions & 20 deletions
Large diffs are not rendered by default.

tests/conftest.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ def remote_config_server_type(request):
275275
)
276276
def server_type_legacy_grpc(request):
277277
return core.start_local_server(config=request.param, as_global=False)
278-
279278
else:
280279

281280
@pytest.fixture(scope="session")
@@ -339,8 +338,6 @@ def server_clayer(request):
339338
):
340339
core.settings.get_runtime_client_config(server).cache_enabled = False
341340
return server
342-
343-
344341
class LocalServers:
345342
def __init__(self):
346343
self._local_servers = []

0 commit comments

Comments
 (0)