Skip to content

Commit 52ae14d

Browse files
committed
fix
1 parent b23d4ec commit 52ae14d

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/ansys/dpf/core/server_types.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def _run_launch_server_process(
133133
executable = "Ans.Dpf.Grpc.bat"
134134
run_cmd = f"{executable} --address {ip} --port {port}"
135135
if context is not None:
136-
run_cmd += f" --context {context.licensing_context_type}"
136+
run_cmd += f" --context {int(context.licensing_context_type)}"
137137
else:
138138
executable = "./Ans.Dpf.Grpc.sh" # pragma: no cover
139139
run_cmd = [
@@ -142,7 +142,7 @@ def _run_launch_server_process(
142142
f"--port {port}",
143143
] # pragma: no cover
144144
if context is not None:
145-
run_cmd.append(f"--context {context.licensing_context_type}")
145+
run_cmd.append(f"--context {int(context.licensing_context_type)}")
146146
path_in_install = load_api._get_path_in_install(internal_folder="bin")
147147
dpf_run_dir = _verify_ansys_path_is_valid(ansys_path, executable, path_in_install)
148148

@@ -1047,18 +1047,14 @@ def __init__(
10471047
)
10481048
raise e
10491049
if context:
1050-
if context == core.AvailableServerContexts.no_context:
1051-
self._base_service.initialize()
1052-
self._context = context
1053-
else:
1054-
try:
1055-
self.apply_context(context)
1056-
except errors.DpfVersionNotSupported:
1057-
self._base_service.initialize_with_context(
1058-
server_context.AvailableServerContexts.premium
1059-
)
1060-
self._context = server_context.AvailableServerContexts.premium
1061-
pass
1050+
try:
1051+
self.apply_context(context)
1052+
except errors.DpfVersionNotSupported:
1053+
self._base_service.initialize_with_context(
1054+
server_context.AvailableServerContexts.premium
1055+
)
1056+
self._context = server_context.AvailableServerContexts.premium
1057+
pass
10621058
self.set_as_global(as_global=as_global)
10631059
# Update the python os.environment
10641060
if not os.name == "posix":

0 commit comments

Comments
 (0)