@@ -640,12 +640,20 @@ def __del__(self):
640640
641641
642642class GrpcClient :
643- def __init__ (self , address = None ):
643+ def __init__ (self ):
644644 from ansys .dpf .gate import client_capi
645645
646- self ._internal_obj = client_capi .ClientCAPI .client_new_full_address (address )
647646 client_capi .ClientCAPI .init_client_environment (self )
648647
648+ def set_address (self , address , server ):
649+ from ansys .dpf .core import misc , settings
650+ if misc .RUNTIME_CLIENT_CONFIG is not None :
651+ self_config = settings .get_runtime_client_config (server = server )
652+ misc .RUNTIME_CLIENT_CONFIG .copy_config (self_config )
653+ from ansys .dpf .gate import client_capi
654+ self ._internal_obj = client_capi .ClientCAPI .client_new_full_address (address )
655+
656+
649657 def __del__ (self ):
650658 try :
651659 self ._deleter_func [0 ](self ._deleter_func [1 ](self ))
@@ -676,6 +684,8 @@ def __init__(
676684 super ().__init__ (ansys_path = ansys_path , load_operators = load_operators )
677685 # Load Ans.Dpf.GrpcClient
678686 self ._grpc_client_path = load_api .load_grpc_client (ansys_path = ansys_path )
687+
688+ self ._client = GrpcClient ()
679689 self ._own_process = launch_server
680690 self ._local_server = False
681691 self ._os = None
@@ -709,8 +719,8 @@ def __init__(
709719 launch_dpf (ansys_path , ip , port , timeout = timeout )
710720 self ._local_server = True
711721
712- self ._client = GrpcClient (address )
713722 # store port and ip for later reference
723+ self ._client .set_address (address , self )
714724 self ._address = address
715725 self ._input_ip = ip
716726 self ._input_port = port
@@ -1011,6 +1021,8 @@ def __init__(
10111021 self ._own_process = launch_server
10121022 self .live = False
10131023 self ._local_server = False
1024+ self ._stubs = {}
1025+ self .channel = None
10141026
10151027 # Load Ans.Dpf.Grpc?
10161028 import grpc
@@ -1048,7 +1060,10 @@ def __init__(
10481060 else :
10491061 launch_dpf (ansys_path , ip , port , timeout = timeout )
10501062 self ._local_server = True
1051-
1063+ from ansys .dpf .core import misc , settings
1064+ if misc .RUNTIME_CLIENT_CONFIG is not None :
1065+ self_config = settings .get_runtime_client_config (server = self )
1066+ misc .RUNTIME_CLIENT_CONFIG .copy_config (self_config )
10521067 self .channel = grpc .insecure_channel (address )
10531068
10541069 # store the address for later reference
@@ -1057,7 +1072,6 @@ def __init__(
10571072 self ._input_port = port
10581073 self .live = True
10591074 self .ansys_path = ansys_path
1060- self ._stubs = {}
10611075
10621076 self ._create_shutdown_funcs ()
10631077
@@ -1086,7 +1100,7 @@ def get_api_for_type(self, capi, grpcapi):
10861100 return grpcapi
10871101
10881102 def create_stub_if_necessary (self , stub_name , stub_type ):
1089- if not ( stub_name in self ._stubs . keys ()) :
1103+ if self . channel and not stub_name in self ._stubs :
10901104 self ._stubs [stub_name ] = stub_type (self .channel )
10911105
10921106 def get_stub (self , stub_name ):
0 commit comments