Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Merge/retro/refactor actions grpc #339

Merged
merged 137 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from 136 commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
3f8d676
Change ANSYS_VERSION to 222
PProfizi Jul 11, 2022
3431471
Add step for pygate 0.1.dev1 installation
PProfizi Jul 12, 2022
18e666a
Add step for pygate 0.1.dev1 installation
PProfizi Jul 12, 2022
e6f2b79
Add trigger for ci
PProfizi Jul 12, 2022
8a4353a
Add trigger for ci
PProfizi Jul 12, 2022
8be2f2a
Fix conditional for gatebin install steps
PProfizi Jul 12, 2022
99856e8
Fix gatebin install steps
PProfizi Jul 12, 2022
3786694
Add the wheels temporarily
PProfizi Jul 12, 2022
76e7650
Fix step conditional
PProfizi Jul 12, 2022
caed381
Change requirement to ansys-dpf-gate==0.1.dev1
PProfizi Jul 12, 2022
56c151d
Add pygate steps to documentation job
PProfizi Jul 12, 2022
a982047
Run Doc on windows-latest
PProfizi Jul 12, 2022
68bd6c2
Move build installation of pygate to pydpf-actions
PProfizi Jul 12, 2022
0db0e2e
Fix conditionals
PProfizi Jul 12, 2022
d810645
Update gate wheel
PProfizi Jul 12, 2022
16e2ab3
Add up-to-date ansys-grpc-dpf wheel
PProfizi Jul 12, 2022
be6c38a
Remove ANSYS_VERSION env setter from build_doc job
PProfizi Jul 12, 2022
5090ef7
Add install of local ansys-grpc-dpf wheel
PProfizi Jul 12, 2022
834f46d
Solve docstring test for download_file
PProfizi Jul 12, 2022
d270bdf
Solve docstring test for download_file
PProfizi Jul 12, 2022
fb9aa51
Solve docstring test for download_file
PProfizi Jul 12, 2022
5ee0bf4
Solve docstring test for download_file
PProfizi Jul 12, 2022
2e18c13
Update pygate wheel
PProfizi Jul 12, 2022
860d190
Fix doctests
PProfizi Jul 12, 2022
fb05974
Fix doctests
PProfizi Jul 12, 2022
f1df7bf
Fix doctests
PProfizi Jul 12, 2022
6a883a2
Fix doctests
PProfizi Jul 12, 2022
a4ec8b2
Fix doctests
PProfizi Jul 12, 2022
d611689
pytest.ini: add doctest NORMALIZE_WHITESPACE and ELLIPSIS by default
PProfizi Jul 12, 2022
0e5d006
remove inline #doctest: options
PProfizi Jul 12, 2022
a540885
Fix doctest
PProfizi Jul 12, 2022
5138dcf
Fix doctest
PProfizi Jul 12, 2022
816925c
Fix doctest
PProfizi Jul 12, 2022
3e8c229
Fix doctest
PProfizi Jul 12, 2022
ed8ca92
Fix doctest
PProfizi Jul 12, 2022
274ca9e
Fix doctest
PProfizi Jul 12, 2022
b2d7e93
use v2.2 pydpf-actions
TheGoldfish01 Jul 13, 2022
fac439a
Target potential failing test
TheGoldfish01 Jul 13, 2022
e4b47fe
Change local_test_repo to False
TheGoldfish01 Jul 13, 2022
5f03a49
Comment-out segfault test
TheGoldfish01 Jul 13, 2022
40801dc
Remove contrain on ansys-dpf-gate version in setup.py install_requires
TheGoldfish01 Jul 15, 2022
58157f2
Try-out DEBUG option for pydpf-actions/test_package
TheGoldfish01 Jul 18, 2022
38d8cb8
Revert "Comment-out segfault test"
TheGoldfish01 Jul 19, 2022
deba5f6
Revert "Target potential failing test"
TheGoldfish01 Jul 19, 2022
f9e7065
Fix test_busy_port from lea's PR on TFS
TheGoldfish01 Jul 19, 2022
26ac04a
Fix conftest according to TFS PR form Lea
TheGoldfish01 Jul 19, 2022
406c3cb
Fix gatebin tests from TFS PR Lea
TheGoldfish01 Jul 19, 2022
2644054
Update wheels
PProfizi Jul 19, 2022
fdaeab3
Merge branch 'merge/0.5.dev2' into merge/fix_222
TheGoldfish01 Jul 19, 2022
548eb12
Remove Report from test in install package
TheGoldfish01 Jul 19, 2022
a3ee08d
Fix flake8
TheGoldfish01 Jul 19, 2022
f30158b
Try-out on Python 3.7 same as TFS
TheGoldfish01 Jul 19, 2022
be15028
Merge branch 'merge/0.5.dev2' into merge/test_222
TheGoldfish01 Jul 19, 2022
e3f6097
Bump imageio from 2.19.3 to 2.19.5 (#312)
dependabot[bot] Jul 19, 2022
4cc4680
MAINT: collect dependencies under a requirements/ directory (#307)
jorgepiloto Jul 15, 2022
5bb7c33
Bump sphinx-notfound-page from 0.8 to 0.8.3 (#308)
dependabot[bot] Jul 15, 2022
ddf63d4
Bump coverage from 6.4.1 to 6.4.2 (#306)
dependabot[bot] Jul 13, 2022
a74e635
Bump actions/setup-python from 4.0.0 to 4.1.0 (#302)
dependabot[bot] Jul 12, 2022
36e1076
Add a retrocompatibility workflow (#310)
PProfizi Jul 19, 2022
306390f
Merge branch 'merge/test_222' into merge/fix_222
TheGoldfish01 Jul 19, 2022
ee1913d
Use pydpf-actions @v2.2 for retro.yml
TheGoldfish01 Jul 19, 2022
ec72b07
Add kill-all-servers steps
TheGoldfish01 Jul 19, 2022
472fe07
Add search for AWP_ROOT221 and others in decreasing order as a last r…
TheGoldfish01 Jul 19, 2022
bfedb8f
Reduces restrains in requirements_docs.txt
TheGoldfish01 Jul 19, 2022
6d3f0f7
Try fix doc generation for 06-stress_gradient_path.py
TheGoldfish01 Jul 19, 2022
7d7f959
Try fix doc generation for 06-stress_gradient_path.py
TheGoldfish01 Jul 19, 2022
b05711d
Revert "Try fix doc generation for 06-stress_gradient_path.py"
TheGoldfish01 Jul 19, 2022
c821bf5
Revert "Try fix doc generation for 06-stress_gradient_path.py"
TheGoldfish01 Jul 19, 2022
b2c30ef
Fix doc generation
PProfizi Jul 20, 2022
b3fe38d
Use wheel and wheelhouse options of build_package action v2.2
PProfizi Jul 20, 2022
3743fcc
Set wheelhouse generation to false while gate not available on PyPi
PProfizi Jul 20, 2022
3330a66
REtro now does not test docstrings
PProfizi Jul 20, 2022
5f00e76
Merge branch 'merge/0.5.dev2' into merge/retro/fix_222
PProfizi Jul 20, 2022
d99e7a0
Update wheels of gate, grpc,
PProfizi Jul 20, 2022
d4d0ebb
Move find_ansys() to last resort. If only AWP_ROOT221 is declared, it…
PProfizi Jul 20, 2022
0505f74
Restrict TestServerConfigs tests to servers >= 4.0
PProfizi Jul 20, 2022
c253f60
Moved ansys_path retrieval logic to misc along with find_ansys, in ge…
PProfizi Jul 20, 2022
172d79f
remove rogue prints
PProfizi Jul 20, 2022
e5840cd
Fixture for server<4.0 now only use global server
PProfizi Jul 20, 2022
4239d25
Rename test_remote_workflow.py
TheGoldfish01 Jul 20, 2022
c99cdfe
Fix import
TheGoldfish01 Jul 20, 2022
c4b1f07
Conftest autouse fixture count_servers
PProfizi Jul 21, 2022
45f7a79
Set ansys_path argument of get_ansys_path to None by default
PProfizi Jul 21, 2022
8e8ad1e
Revert "Conftest autouse fixture count_servers"
PProfizi Jul 21, 2022
d72282f
Conftest actually count_servers with fixture
PProfizi Jul 21, 2022
831c2fb
Fix flake8
PProfizi Jul 21, 2022
8666f36
Merge branch 'merge/0.5.dev2' into merge/retro/fix_222
PProfizi Jul 21, 2022
0ef8e83
Fix flake8
PProfizi Jul 21, 2022
f3ca491
Remove code merged by error.
PProfizi Jul 21, 2022
1b343d3
Remove test_set_coordinates_field_meshed_region which should come wit…
PProfizi Jul 21, 2022
daa6393
Remove assert nb_servers=1 from count_servers fixture
PProfizi Jul 21, 2022
503ecde
Move and rename test_launch_server_not_install to test_launcher.py as…
PProfizi Jul 21, 2022
458b4b5
Fix GrpcServer.shutdown()
PProfizi Jul 21, 2022
3da0c1e
Add a version test before trying to launch an InProcess server
PProfizi Jul 21, 2022
1f84078
Remove version test, add warning to get info on ansys_path used.
PProfizi Jul 21, 2022
d1ae076
Merge branch 'merge/0.5.dev2' into merge/retro/fix_222
PProfizi Jul 21, 2022
c02c4a0
ADD WARNINGS FOR DEBUG
PProfizi Jul 22, 2022
4ce75de
ADD TIMESTAMP
PProfizi Jul 22, 2022
e8e5835
Use build_package@v2.2.1
PProfizi Jul 22, 2022
ce0e3b8
Revert "Use build_package@v2.2.1"
PProfizi Jul 22, 2022
ec55e9f
Revert "ADD TIMESTAMP"
PProfizi Jul 22, 2022
31f2d6e
Revert "ADD WARNINGS FOR DEBUG"
PProfizi Jul 22, 2022
d47f1f7
Merge branch 'merge/0.5.dev2' into merge/retro/fix_222
PProfizi Jul 22, 2022
da22494
Remove warning used for debug
PProfizi Jul 22, 2022
11e30e0
Fix test_start_local_failed_executable
PProfizi Jul 22, 2022
455bde9
Fix test_busy_port
PProfizi Jul 22, 2022
4d28452
Try actions@v2.2.1
PProfizi Jul 22, 2022
3ff9971
Up doc install-dpf-server to v2.2
PProfizi Jul 22, 2022
88bc7b5
Revert "Try actions@v2.2.1"
PProfizi Jul 22, 2022
a925b04
Set autouse of count_servers fixture to false
PProfizi Jul 22, 2022
b385bf6
Fix codacy errors
PProfizi Jul 25, 2022
23154f3
Add back test_launch_server_not_install and rename it as test_launche…
PProfizi Jul 25, 2022
60af04d
Refactor get_ansys_path and find_ansys
PProfizi Jul 25, 2022
d004206
Add back a print in test_print_data_sources_path
PProfizi Jul 25, 2022
056624d
find_ansys does not filter out the current ansys version for AWP_ROOT
PProfizi Jul 25, 2022
78894f6
Remove unused fixtures
PProfizi Jul 25, 2022
53ed94a
Set DOCTEST in retro back to true
PProfizi Jul 25, 2022
8d1dee8
Revert "Set DOCTEST in retro back to true"
PProfizi Jul 25, 2022
0150d2c
Test conditionals
PProfizi Jul 25, 2022
d83514c
Set wheelhouse to default (false)
PProfizi Jul 25, 2022
3c9460d
Set doctest to default (true)
PProfizi Jul 25, 2022
6cb2906
Revert "Set doctest to default (true)"
PProfizi Jul 25, 2022
55f1785
Set doctest to false
PProfizi Jul 25, 2022
e1de846
Revert "Remove unused fixtures"
PProfizi Jul 25, 2022
a9898a8
Remove fixture config_server_type
PProfizi Jul 25, 2022
0fceafc
Refactor test job using new smaller actions
PProfizi Jul 25, 2022
db7f308
fix ci
cbellot000 Jul 26, 2022
128d81d
dummy
cbellot000 Jul 26, 2022
8492887
revert dummy
cbellot000 Jul 26, 2022
bef994b
dummy
cbellot000 Jul 26, 2022
bfae322
Merge branch 'merge/0.5.dev2' of https://github.com/pyansys/DPF-Core …
cbellot000 Jul 26, 2022
ffa1982
pre command
cbellot000 Jul 26, 2022
9f3ae0f
doc and backward comp
cbellot000 Jul 26, 2022
5ca8524
backward comp fixes
cbellot000 Jul 26, 2022
4b5300f
update doc and ansys.grpc.dpf
cbellot000 Jul 26, 2022
90a0bcf
fix doc
cbellot000 Jul 26, 2022
deab988
fix merge
cbellot000 Jul 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .github/workflows/ansys_dpf_gate-0.1.dev1-py3-none-any.whl
Binary file not shown.
Binary file not shown.
114 changes: 79 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,85 @@ jobs:
- uses: actions/checkout@v3

- name: "Build Package"
uses: pyansys/pydpf-actions/build_package@v2.2
uses: pyansys/pydpf-actions/build_package@v2.2.dev1
with:
python-version: ${{ matrix.python-version }}
ANSYS_VERSION: ${{env.ANSYS_VERSION}}
PACKAGE_NAME: ${{env.PACKAGE_NAME}}
MODULE: ${{env.MODULE}}
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}}
install_extras: plotting
wheelhouse: "false"
wheelhouse: false
extra-pip-args: "--pre --find-links .github/workflows/"

- name: "Test Package"
uses: pyansys/pydpf-actions/test_package@v2.2.dev0
- name: "Prepare Testing Environment"
uses: pyansys/pydpf-actions/prepare_tests@v2.2
with:
DEBUG: true

- name: "Test Docstrings"
uses: pyansys/pydpf-actions/test_docstrings@v2.2
with:
MODULE: ${{env.MODULE}}
DEBUG: True
PACKAGE_NAME: ${{env.PACKAGE_NAME}}

- name: "Separate long Core tests"
shell: pwsh
run: |
New-Item -Path ".\" -Name "local_server_test" -ItemType "directory"
Copy link
Contributor

@anslpa anslpa Jul 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PProfizi @cbellot000 just that you know, pytest as an --ignore flag that can be used as:
pytest ./tests --ignore tests\test_server.py --ignore tests\test_launcher.py

New-Item -Path ".\" -Name "test_workflow" -ItemType "directory"
Copy-Item -Path "tests\conftest.py" -Destination ".\local_server_test\"
Copy-Item -Path "tests\conftest.py" -Destination ".\test_workflow\"
Copy-Item -Path "tests\test_launcher.py" -Destination ".\local_server_test\"
Copy-Item -Path "tests\test_server.py" -Destination ".\local_server_test\"
Copy-Item -Path "tests\test_local_server.py" -Destination ".\local_server_test\"
Copy-Item -Path "tests\test_multi_server.py" -Destination ".\local_server_test\"
Copy-Item -Path "tests\test_workflow.py" -Destination ".\test_workflow\"
Copy-Item -Path "tests\test_remote_workflow.py" -Destination ".\local_server_test\"
Copy-Item -Path "tests\test_remote_operator.py" -Destination ".\local_server_test\"
Remove-Item -Path "tests\test_server.py"
Remove-Item -Path "tests\test_launcher.py"
Remove-Item -Path "tests\test_local_server.py"
Remove-Item -Path "tests\test_multi_server.py"
Remove-Item -Path "tests\test_workflow.py"
Remove-Item -Path "tests\test_remote_workflow.py"
Remove-Item -Path "tests\test_remote_operator.py"

- name: "Test API"
shell: bash
working-directory: tests
run: |
pytest $DEBUG --cov=ansys.dpf.${{env.MODULE}} --cov-report=xml --cov-report=html --log-level=ERROR --junitxml=junit/test-results.xml --reruns 2 .

- name: "Kill all servers"
uses: pyansys/pydpf-actions/kill-dpf-servers@v2.2

- name: "Test API 2"
shell: bash
working-directory: local_server_test
run: |
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 .

- name: "Kill all servers"
uses: pyansys/pydpf-actions/kill-dpf-servers@v2.2

- name: "Test API 3"
shell: bash
working-directory: test_workflow
run: |
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 .

- name: "Kill all servers"
uses: pyansys/pydpf-actions/kill-dpf-servers@v2.2

- name: "Upload Test Results"
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }}_pytest
path: tests/junit/test-results.xml

- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v2

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

- id: install-dpf
uses: pyansys/pydpf-actions/install-dpf-server@v2.2
- name: "Build Package"
id: build-package
uses: pyansys/pydpf-actions/build_package@v2.2.dev1
with:
python-version: ${{ matrix.python-version }}
ANSYS_VERSION: ${{env.ANSYS_VERSION}}
PACKAGE_NAME: ${{env.PACKAGE_NAME}}
MODULE: ${{env.MODULE}}
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}}
ANSYS_VERSION : ${{env.ANSYS_VERSION}}

- name: Set AWP_ROOT$env:ANSYS_VERSION
run: echo "AWP_ROOT$env:ANSYS_VERSION=${{ steps.install-dpf.outputs.SERVER }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append

- name: Set SERVER
run: echo "SERVER=$env:AWP_ROOT221" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append

- name: "Install gatebin Windows"
working-directory: .github\workflows
run: pip install ansys_dpf_gatebin-0.1.dev1-py3-none-win_amd64.whl

- name: "Install pygate"
working-directory: .github\workflows
run: |
pip install ansys_dpf_gate-0.1.dev1-py3-none-any.whl
pip install ansys_grpc_dpf-0.5.dev1-py3-none-any.whl

- name: Install ansys-dpf-core
shell: cmd
run: |
pip install -r requirements/requirements_build.txt
python setup.py bdist_wheel
FOR /F %%a in ('dir /s/b dist\*.whl') do SET WHEELPATH=%%a
ECHO %WHEELPATH%
cd tests
pip install %WHEELPATH%
python -c "from ansys.dpf import core"
install_extras: plotting
wheelhouse: false
extra-pip-args: "--pre --find-links .github/workflows/"

- name: Install OpenGL
run: |
Expand Down
65 changes: 58 additions & 7 deletions .github/workflows/retro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,70 @@ jobs:
- uses: actions/checkout@v3

- name: "Build Package"
uses: pyansys/pydpf-actions/build_package@v2.2
uses: pyansys/pydpf-actions/build_package@v2.2.dev1
with:
python-version: ${{ matrix.python-version }}
ANSYS_VERSION: ${{env.ANSYS_VERSION}}
PACKAGE_NAME: ${{env.PACKAGE_NAME}}
MODULE: ${{env.MODULE}}
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}}
install_extras: plotting
wheel: "false"
wheelhouse: "false"
wheel: false
extra-pip-args: "--pre --find-links .github/workflows/"

- name: "Install ansys-grpc-dpf==0.4.0"
shell: pwsh
run: |
pip install ansys-grpc-dpf==0.4.0

- name: "Test Package"
uses: pyansys/pydpf-actions/test_package@v2.2.dev0
- name: "Prepare Testing Environment"
uses: pyansys/pydpf-actions/prepare_tests@v2.2
with:
MODULE: ${{env.MODULE}}
DOCTEST: "false"
DEBUG: true

- name: "Separate long Core tests"
shell: pwsh
run: |
New-Item -Path ".\" -Name "local_server_test" -ItemType "directory"
Copy-Item -Path "tests\conftest.py" -Destination ".\local_server_test\"
Copy-Item -Path "tests\test_launcher.py" -Destination ".\local_server_test\"
Copy-Item -Path "tests\test_server.py" -Destination ".\local_server_test\"
Copy-Item -Path "tests\test_local_server.py" -Destination ".\local_server_test\"
Copy-Item -Path "tests\test_multi_server.py" -Destination ".\local_server_test\"
Copy-Item -Path "tests\test_workflow.py" -Destination ".\local_server_test\"
Copy-Item -Path "tests\test_remote_workflow.py" -Destination ".\local_server_test\"
Copy-Item -Path "tests\test_remote_operator.py" -Destination ".\local_server_test\"
Remove-Item -Path "tests\test_server.py"
Remove-Item -Path "tests\test_launcher.py"
Remove-Item -Path "tests\test_local_server.py"
Remove-Item -Path "tests\test_multi_server.py"
Remove-Item -Path "tests\test_workflow.py"
Remove-Item -Path "tests\test_remote_workflow.py"
Remove-Item -Path "tests\test_remote_operator.py"

- name: "Test API"
shell: bash
working-directory: tests
run: |
pytest $DEBUG --cov=ansys.dpf.${{env.MODULE}} --cov-report=xml --cov-report=html --log-level=ERROR --junitxml=junit/test-results.xml --reruns 2 .

- name: "Kill all servers"
uses: pyansys/pydpf-actions/kill-dpf-servers@v2.2

- name: "Test API 2"
shell: bash
working-directory: local_server_test
run: |
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 .

- name: "Kill all servers"
uses: pyansys/pydpf-actions/kill-dpf-servers@v2.2

- name: "Upload Test Results"
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }}_pytest
path: tests/junit/test-results.xml

- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v2
4 changes: 2 additions & 2 deletions ansys/dpf/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
min_server_version = "2.0"

server_to_ansys_grpc_dpf_version = {
"1.0": "0.2.2",
"2.0": "0.3.0",
"1.0": "==0.2.2",
"2.0": "==0.3.0",
"3.0": ">=0.4.0",
"4.0": ">=0.5.0",
}
Expand Down
8 changes: 5 additions & 3 deletions ansys/dpf/core/data_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,15 @@ def __init__(self, data=None, data_tree=None, server=None):
# step 2: get api
self._api_instance = None # see property self._api

# step3: init environment
self._api.init_dpf_data_tree_environment(self) # creates stub when gRPC

# step4: if object exists, take the instance, else create it
if data_tree is not None:
if not isinstance(data_tree, dict):
# step3: init environment
self._api.init_dpf_data_tree_environment(self) # creates stub when gRPC
self._internal_obj = data_tree
else:
# step3: init environment
self._api.init_dpf_data_tree_environment(self) # creates stub when gRPC
if self._server.has_client():
self._internal_obj = self._api.dpf_data_tree_new_on_client(self._server.client)
else:
Expand Down
2 changes: 0 additions & 2 deletions ansys/dpf/core/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ def find_ansys():
for version in sorted(versions, reverse=True):
if not version.isnumeric():
continue
if version == __ansys_version__:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cbellot000 that means that in ansys_version = 222 case, find_ansys() method won't be able to return an ansys_path based on AWP_ROOT222 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cbellot000 @anslpa yes the next elif might have been left by mistake. The get_ansys_path does try AWP_ROOT222 before calling find_ansys(), but you might want to still try to get it within find_ansys() for retro-compatibility.

continue
elif version < __ansys_version__:
ansys_path = os.environ.get("AWP_ROOT" + version)
if ansys_path:
Expand Down
12 changes: 3 additions & 9 deletions ansys/dpf/core/server_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def _compare_ansys_grpc_dpf_version(right_grpc_module_version_str: str, grpc_mod
from packaging.version import parse as parse_version
right_version_first_numbers = re.search(r"\d", right_grpc_module_version_str)
right_version_numbers = right_grpc_module_version_str[
right_version_first_numbers.start():-1]
right_version_first_numbers.start():]
compare = "==" if right_version_first_numbers.start() == 0 else \
right_grpc_module_version_str[0:right_version_first_numbers.start()].strip()
if compare == "==":
Expand Down Expand Up @@ -282,7 +282,7 @@ def check_ansys_grpc_dpf_version(server, timeout):
f"{compatibility_link} while still using DPF server {server_version}, "
f"please install version {right_grpc_module_version} of ansys-grpc-dpf"
f" with the command: \n"
f" pip install ansys-grpc-dpf=={right_grpc_module_version}"
f" pip install ansys-grpc-dpf{right_grpc_module_version}"
)


Expand Down Expand Up @@ -754,13 +754,7 @@ def __init__(
def _create_shutdown_funcs(self):
self._core_api = data_processing_grpcapi.DataProcessingGRPCAPI
self._core_api.init_data_processing_environment(self)
from ansys.grpc.dpf import base_pb2
self._preparing_shutdown_func = (
data_processing_grpcapi._get_stub(self).PrepareShutdown, base_pb2.Empty()
)
self._shutdown_func = (
data_processing_grpcapi._get_stub(self).ReleaseServer, base_pb2.Empty()
)
self._core_api.bind_delete_server_func(self)

@property
def client(self):
Expand Down
41 changes: 21 additions & 20 deletions docs/source/_static/dpf.html

Large diffs are not rendered by default.

21 changes: 19 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,25 @@ def remote_config_server_type(request):
def server_type_legacy_grpc(request):
return core.start_local_server(config=request.param, as_global=False)

@pytest.fixture(scope="session", params=[ServerConfig(protocol=CommunicationProtocols.gRPC,
legacy=True),
ServerConfig(protocol=CommunicationProtocols.gRPC,
legacy=False)],
ids=[
"ansys-grpc-dpf config",
"gRPC CLayer config"
])
def remote_config_server_type(request):
cbellot000 marked this conversation as resolved.
Show resolved Hide resolved
return request.param

@pytest.fixture(scope="session", params=[ServerConfig(protocol=CommunicationProtocols.gRPC,
legacy=True)],
ids=[
"ansys-grpc-dpf",
])
def server_type_legacy_grpc(request):
return core.start_local_server(config=request.param, as_global=False)

else:

@pytest.fixture(scope="session")
Expand Down Expand Up @@ -339,8 +358,6 @@ def server_clayer(request):
):
core.settings.get_runtime_client_config(server).cache_enabled = False
return server


class LocalServers:
def __init__(self):
self._local_servers = []
Expand Down
21 changes: 0 additions & 21 deletions tests/test_meshregion.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,27 +198,6 @@ def test_get_connectivities_field_meshedregion(simple_bar_model):
assert np.allclose(connectivity.data, field_connect.data)


@conftest.raises_for_servers_version_under("3.0")
def test_set_connectivities_field_meshed_region(simple_bar_model):
mesh = simple_bar_model.metadata.meshed_region
connectivity = mesh.elements.connectivities_field
new_connectivity_data = connectivity.data
assert new_connectivity_data[0] == 1053
new_connectivity_data[0] = 0
connectivity.data = new_connectivity_data
mesh.elements.connectivities_field = connectivity
connectivity = mesh.elements.connectivities_field
assert connectivity.data[0] == 0

new_connectivity_data[0] = 1
connectivity.data = new_connectivity_data
mesh.set_property_field(
dpf.core.common.elemental_properties.connectivity, connectivity
)
connectivity = mesh.elements.connectivities_field
assert connectivity.data[0] == 1


def test_get_nodes_meshedregion(simple_bar_model):
mesh = simple_bar_model.metadata.meshed_region
node = mesh.nodes.node_by_id(1)
Expand Down