Skip to content

Commit 45d1a6d

Browse files
authored
Always connect to a server via LegacyGrpc when on macOS (#1275)
* Force LegacyGrpc connection when on macOS and connecting to a server * Force LegacyGrpc connection when on macOS and using start_local_server
1 parent de0a677 commit 45d1a6d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/ansys/dpf/core/server.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import socket
88
import weakref
99
import copy
10+
import platform
1011
import inspect
1112
import warnings
1213
import traceback
@@ -225,6 +226,9 @@ def start_local_server(
225226
timed_out = False
226227
for _ in range(n_attempts):
227228
try:
229+
# Force LegacyGrpc when on macOS
230+
if platform.system() == "Darwin":
231+
config = dpf.core.AvailableServerConfigs.LegacyGrpcServer
228232
server_type = ServerFactory.get_server_type_from_config(
229233
config, ansys_path, docker_config
230234
)
@@ -309,7 +313,7 @@ def connect_to_server(
309313
The default is ``10``. Once the specified number of seconds
310314
passes, the connection fails.
311315
config: ServerConfig, optional
312-
Manages the type of server connection to use.
316+
Manages the type of server connection to use. Forced to LegacyGrpc on macOS.
313317
context: ServerContext, optional
314318
Defines the settings that will be used to load DPF's plugins.
315319
A DPF xml file can be used to list the plugins and set up variables. Default is
@@ -355,6 +359,10 @@ def connect():
355359
dpf.core._server_instances.append(weakref.ref(server))
356360
return server
357361

362+
# Enforce LegacyGrpc when on macOS
363+
if platform.system() == 'Darwin':
364+
config = dpf.core.AvailableServerConfigs.LegacyGrpcServer
365+
358366
server_type = ServerFactory.get_remote_server_type_from_config(config)
359367
try:
360368
return connect()

0 commit comments

Comments
 (0)