Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions ansys/dpf/core/server_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ def __init__(self,
launch_server=True,
docker_name=None,
use_pypim=True,
num_connection_tryouts=3,
):
# Load DPFClientAPI
from ansys.dpf.core.misc import is_pypim_configured
Expand Down Expand Up @@ -563,8 +564,19 @@ def __init__(self,
self._input_port = port
self.live = True
self._create_shutdown_funcs()
self._check_first_call(num_connection_tryouts)
self.set_as_global(as_global=as_global)

def _check_first_call(self, num_connection_tryouts):
for i in range(num_connection_tryouts):
try:
self.version
break
except errors.DPFServerException as e:
if ("GOAWAY" not in str(e.args) and "unavailable" not in str(e.args)) \
or i == (num_connection_tryouts - 1):
raise e

@property
def version(self):
from ansys.dpf.gate import data_processing_capi, integral_types
Expand Down
13 changes: 0 additions & 13 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,6 @@ def test_start_local_server_with_config(self, server_config):
assert has_local_server()
shutdown_all_session_servers()

def test_connect_to_server(self, server_config):
set_server_configuration(server_config)
print(dpf.core.SERVER_CONFIGURATION)
shutdown_all_session_servers()
start_local_server(timeout=10.)
print("has_local_server", has_local_server())
if hasattr(dpf.core.SERVER, "ip"):
connect_to_server(ip=dpf.core.SERVER.ip, port=dpf.core.SERVER.port, timeout=10.,
as_global=False)
else:
connect_to_server(timeout=10., as_global=False)
assert has_local_server()

def test_shutdown_all_session_servers(self, server_config):
set_server_configuration(server_config)
print(dpf.core.SERVER_CONFIGURATION)
Expand Down