Skip to content

Commit

Permalink
Always connect to a server via LegacyGrpc when on macOS (#1275)
Browse files Browse the repository at this point in the history
* Force LegacyGrpc connection when on macOS and connecting to a server

* Force LegacyGrpc connection when on macOS and using start_local_server
  • Loading branch information
PProfizi authored Nov 28, 2023
1 parent de0a677 commit 45d1a6d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ansys/dpf/core/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import socket
import weakref
import copy
import platform
import inspect
import warnings
import traceback
Expand Down Expand Up @@ -225,6 +226,9 @@ def start_local_server(
timed_out = False
for _ in range(n_attempts):
try:
# Force LegacyGrpc when on macOS
if platform.system() == "Darwin":
config = dpf.core.AvailableServerConfigs.LegacyGrpcServer
server_type = ServerFactory.get_server_type_from_config(
config, ansys_path, docker_config
)
Expand Down Expand Up @@ -309,7 +313,7 @@ def connect_to_server(
The default is ``10``. Once the specified number of seconds
passes, the connection fails.
config: ServerConfig, optional
Manages the type of server connection to use.
Manages the type of server connection to use. Forced to LegacyGrpc on macOS.
context: ServerContext, optional
Defines the settings that will be used to load DPF's plugins.
A DPF xml file can be used to list the plugins and set up variables. Default is
Expand Down Expand Up @@ -355,6 +359,10 @@ def connect():
dpf.core._server_instances.append(weakref.ref(server))
return server

# Enforce LegacyGrpc when on macOS
if platform.system() == 'Darwin':
config = dpf.core.AvailableServerConfigs.LegacyGrpcServer

server_type = ServerFactory.get_remote_server_type_from_config(config)
try:
return connect()
Expand Down

0 comments on commit 45d1a6d

Please sign in to comment.