Skip to content
Open
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
5 changes: 4 additions & 1 deletion src/ansys/dpf/core/server_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ def _run_launch_server_process(
AvailableServerContexts.entry,
AvailableServerContexts.premium,
):
run_cmd.append(f"--context {int(context.licensing_context_type)}")
if context.licensing_context_type == 2 and len(context.xml_path) > 0: # 2 == custom xml
run_cmd.append(f"--context {context.xml_path}")
else:
run_cmd.append(f"--context {int(context.licensing_context_type)}")

if grpc_mode == server_factory.GrpcMode.Insecure:
run_cmd.append("--mode 0")
Expand Down
13 changes: 13 additions & 0 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,19 @@ def test_server_context_custom_xml(remote_config_server_type, testfiles_dir):
assert sorted(list(server_plugins.keys())) == ref


@pytest.mark.skipif(
not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0, reason="not working properly before 25R2"
)
@pytest.mark.skipif(running_docker, reason="server start using custom xml not working on Docker")
def test_server_context_custom_xml_check_operators(remote_config_server_type):
from pathlib import Path

context = dpf.core.AvailableServerContexts.no_context
context.xml_path = Path(dpf.core.misc.get_ansys_path()) / "dpf" / "utilities" / "DpfEmpty.xml"
server = start_local_server(config=remote_config_server_type, context=context, as_global=False)
assert len(server.plugins) == 1


@pytest.mark.skipif(
os.name == "posix" or running_docker,
reason="lin issue: 2 processes can be run with same port",
Expand Down
Loading