Skip to content

Commit 477a2f7

Browse files
committed
not set as global if apply context didn't work
1 parent 9ad39f5 commit 477a2f7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ansys/dpf/core/server_types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,11 @@ def __init__(self,
651651
self.live = True
652652
self._create_shutdown_funcs()
653653
self._check_first_call(num_connection_tryouts)
654-
self.set_as_global(as_global=as_global)
655654
try:
656655
self.apply_context(server_context.SERVER_CONTEXT)
657656
except errors.DpfVersionNotSupported:
658657
pass
658+
self.set_as_global(as_global=as_global)
659659

660660
def _check_first_call(self, num_connection_tryouts):
661661
for i in range(num_connection_tryouts):
@@ -816,7 +816,6 @@ def __init__(self,
816816
f"DPF directory not found at {os.path.dirname(path)}"
817817
f"Unable to locate the following file: {path}")
818818
raise e
819-
self.set_as_global(as_global=as_global)
820819
try:
821820
self.apply_context(server_context.SERVER_CONTEXT)
822821
except errors.DpfVersionNotSupported:
@@ -825,6 +824,7 @@ def __init__(self,
825824
)
826825
self._context = server_context.AvailableServerContexts.premium
827826
pass
827+
self.set_as_global(as_global=as_global)
828828

829829
@property
830830
def version(self):
@@ -963,11 +963,11 @@ def __init__(
963963
self._create_shutdown_funcs()
964964

965965
check_ansys_grpc_dpf_version(self, timeout)
966-
self.set_as_global(as_global=as_global)
967966
try:
968967
self.apply_context(server_context.SERVER_CONTEXT)
969968
except errors.DpfVersionNotSupported:
970969
pass
970+
self.set_as_global(as_global=as_global)
971971

972972
def _create_shutdown_funcs(self):
973973
self._core_api = data_processing_grpcapi.DataProcessingGRPCAPI

0 commit comments

Comments
 (0)