Skip to content

Commit 38e6099

Browse files
authored
fix/pool v202 (#334)
* allow launcher to use v202 * fix trigger config on github workflow * hotfix for mapdl pool 2020R2 * patch corba testing for windows
1 parent c9e5fcc commit 38e6099

File tree

9 files changed

+33
-33
lines changed

9 files changed

+33
-33
lines changed

.github/workflows/ci-build.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
# Build documentation
22
name: Documentation Build
33

4-
on:
5-
push:
6-
branches-ignore:
7-
- 'gh-pages'
8-
pull_request:
4+
on: [push, pull_request, workflow_dispatch]
95

106
jobs:
117
# This workflow contains a single job called "build"

.github/workflows/style.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
# check spelling, codestyle
22
name: Style Check
33

4-
on:
5-
push:
6-
branches-ignore:
7-
# Push events to branches matching refs/heads/mona/octocat
8-
- 'gh-pages'
9-
pull_request:
4+
on: [push, pull_request, workflow_dispatch]
105

116
jobs:
127
build:

ansys/mapdl/core/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Version of ansys-mapdl-core module."""
22

33
# major, minor, patch
4-
version_info = 0, 57, 1
4+
version_info = 0, 57, 2
55

66
# Nice string for the version
77
__version__ = '.'.join(map(str, version_info))

ansys/mapdl/core/launcher.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,11 @@ def check_mode(mode, version):
893893
mode = mode.lower()
894894
if mode == 'grpc':
895895
if version < 211:
896-
raise VersionError('gRPC mode requires MAPDL 2021R1 or newer.')
896+
if version < 202 and os.name == 'nt':
897+
raise VersionError('gRPC mode requires MAPDL 2020R2 or newer '
898+
'on Windows.')
899+
elif os.name == 'posix':
900+
raise VersionError('gRPC mode requires MAPDL 2021R1 or newer.')
897901
elif mode == 'corba':
898902
if version < 170:
899903
raise VersionError('CORBA AAS mode requires MAPDL v17.0 or newer.')
@@ -913,6 +917,9 @@ def check_mode(mode, version):
913917
else: # auto-select based on best version
914918
if version >= 211:
915919
mode = 'grpc'
920+
elif version == 202 and os.name == 'nt':
921+
# Windows supports it as of 2020R2
922+
mode = 'grpc'
916923
elif version >= 170:
917924
mode = 'corba'
918925
else:

ansys/mapdl/core/pool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def __init__(self, n_instances, wait=True, run_location=None,
9393
self._instances = []
9494
self._root_dir = run_location
9595
kwargs['remove_temp_files'] = remove_temp_files
96+
kwargs['mode'] = 'grpc'
9697
self._spawn_kwargs = kwargs
9798

9899
# grab available ports

tests/conftest.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,27 @@ def pytest_addoption(parser):
4141

4242

4343
def pytest_collection_modifyitems(config, items):
44-
if config.getoption("--corba"):
44+
if not config.getoption("--corba"):
4545
# --corba given in cli: run CORBA interface tests
46-
return
47-
skip_corba = pytest.mark.skip(reason="need --corba option to run")
48-
for item in items:
49-
if "corba" in item.keywords:
50-
item.add_marker(skip_corba)
46+
skip_corba = pytest.mark.skip(reason="need --corba option to run")
47+
for item in items:
48+
if "corba" in item.keywords:
49+
item.add_marker(skip_corba)
5150

52-
if config.getoption("--console"):
51+
if not config.getoption("--console"):
5352
# --console given in cli: run console interface tests
54-
return
55-
skip_console = pytest.mark.skip(reason="need --console option to run")
56-
for item in items:
57-
if "console" in item.keywords:
58-
item.add_marker(skip_console)
53+
skip_console = pytest.mark.skip(reason="need --console option to run")
54+
for item in items:
55+
if "console" in item.keywords:
56+
item.add_marker(skip_console)
5957

6058

6159
@pytest.fixture(scope="session")
6260
def mapdl_console(request):
63-
ansys_base_paths = _get_available_base_ansys()
64-
6561
if os.name != 'posix':
6662
raise RuntimeError('"--console" testing option unavailable. '
6763
'Only Linux is supported.')
64+
ansys_base_paths = _get_available_base_ansys()
6865

6966
# find a valid version of corba
7067
console_path = None
@@ -78,6 +75,8 @@ def mapdl_console(request):
7875
'Valid versions are up to 2020R2.')
7976

8077
mapdl = launch_mapdl(console_path)
78+
from ansys.mapdl.core.mapdl_console import MapdlConsole
79+
assert isinstance(mapdl, MapdlConsole)
8180
mapdl._show_matplotlib_figures = False # CI: don't show matplotlib figures
8281

8382
# using yield rather than return here to be able to test exit
@@ -98,7 +97,7 @@ def mapdl_corba(request):
9897
# find a valid version of corba
9998
corba_path = None
10099
for version in ansys_base_paths:
101-
if version >= 170 and version < 211:
100+
if version >= 170 and version < 202:
102101
corba_path = get_ansys_bin(str(version))
103102

104103
if corba_path is None:
@@ -107,6 +106,8 @@ def mapdl_corba(request):
107106
'Valid versions are ANSYS 17.0 up to 2020R2.')
108107

109108
mapdl = launch_mapdl(corba_path)
109+
from ansys.mapdl.core.mapdl_corba import MapdlCorba
110+
assert isinstance(mapdl, MapdlCorba)
110111
mapdl._show_matplotlib_figures = False # CI: don't show matplotlib figures
111112

112113
# using yield rather than return here to be able to test exit

tests/test_console.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
"""Test legacy MAPDL CORBA interface
1+
"""Test legacy MAPDL console interface
22
3-
This has been copied from ma
3+
This has been copied from test_mapdl.py
44
55
"""
66
import time
@@ -21,7 +21,7 @@
2121
skip_no_xserver = pytest.mark.skipif(not system_supports_plotting(),
2222
reason="Requires active X Server")
2323

24-
# skip entire module unless --corba is enabled
24+
# skip entire module unless --console is enabled
2525
pytestmark = pytest.mark.console
2626

2727

tests/test_corba.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Test legacy MAPDL CORBA interface
22
3-
This has been copied from ma
3+
This has been copied from test_mapdl.py
44
55
"""
66
import time
@@ -24,6 +24,7 @@
2424
# skip entire module unless --corba is enabled
2525
pytestmark = pytest.mark.corba
2626

27+
2728
@pytest.fixture(scope='function')
2829
def cleared(mapdl_corba):
2930
mapdl_corba.finish()

tests/test_launcher.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ def test_find_ansys_linux():
5252
assert isinstance(ver, float)
5353

5454

55-
@pytest.mark.skipif(not get_start_instance(), reason="Requires ANSYS install")
5655
def test_invalid_mode():
5756
with pytest.raises(ValueError):
5857
exec_file = get_ansys_bin(valid_versions[0])

0 commit comments

Comments
 (0)