Skip to content

Commit 497b0dd

Browse files
RobPasMuepyansys-ci-botpre-commit-ci[bot]
authored
fix: change Core Service path to executable/DLL after renaming (#1841)
Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 6b7844c commit 497b0dd

File tree

5 files changed

+43
-15
lines changed

5 files changed

+43
-15
lines changed

doc/changelog.d/1841.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
change Core Service path to executable/DLL after renaming

doc/source/getting_started/docker/common_docker.jinja

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ The Geometry service requires this mandatory environment variable for its use:
1616

1717
You can also specify other optional environment variables:
1818

19-
* ``ENABLE_TRACE``: Whether to set up the trace level for debugging purposes. The default
20-
is ``0``, in which case the trace level is not set up. Options are ``1`` and ``0``.
2119
* ``LOG_LEVEL``: Sets the Geometry service logging level. The default is ``2``, in which case
22-
the logging level is ``INFO``.
20+
the logging level is ``WARNING``.
2321

2422
Here are some terms to keep in mind:
2523

docker/linux/coreservice/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ ENV LD_LIBRARY_PATH=/app:/app/CADIntegration/bin:/app/Native/Linux
2929
ENV ANS_DSCO_REMOTE_PORT=50051
3030
ENV ANS_DSCO_REMOTE_IP="0.0.0.0"
3131
ENV LOG_LEVEL=2
32-
ENV ENABLE_TRACE=0
3332
ENV ANSYSLMD_LICENSE_FILE=""
34-
ENV ANS_DSCO_REMOTE_LOGS_CONFIG="linux"
3533
ENV ANSYS_CI_INSTALL=/app/CADIntegration
3634
ENV P_SCHEMA=/app/Schema/
3735
ENV ANSYSCL251_DIR=/app/licensingclient/
36+
ENV ANSYSCL252_DIR=/app/licensingclient/
3837

3938
# Add container labels
4039
LABEL org.opencontainers.image.authors="ANSYS Inc."
@@ -44,4 +43,4 @@ LABEL org.opencontainers.image.vendor="ANSYS Inc."
4443
EXPOSE 50051
4544

4645
# Define the entrypoint for the Geometry service
47-
ENTRYPOINT ["dotnet", "/app/Presentation.ApiServerLinux.dll"]
46+
ENTRYPOINT ["dotnet", "/app/Presentation.ApiServerCoreService.dll"]

docker/windows/coreservice/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@ RUN setx Path "%Path%;C:\app;C:\app\Native\Windows;C:\app\CADIntegration\bin"
3131
ENV ANS_DSCO_REMOTE_PORT=50051
3232
ENV ANS_DSCO_REMOTE_IP="0.0.0.0"
3333
ENV LOG_LEVEL=2
34-
ENV ENABLE_TRACE=0
3534
ENV ANSYSLMD_LICENSE_FILE=""
3635
ENV ANSYS_CI_INSTALL=C:/app/CADIntegration
3736
ENV P_SCHEMA=C:/app/Schema
38-
ENV ANS_DSCO_REMOTE_LOGS_CONFIG="linux"
3937
ENV ANSYSCL251_DIR=C:/app/licensingclient
4038
ENV ANSYSCL252_DIR=C:/app/licensingclient
4139

@@ -48,4 +46,4 @@ EXPOSE 50051
4846

4947
# Define the entrypoint for the Geometry service
5048
# hadolint ignore=DL3025
51-
ENTRYPOINT dotnet C:\app\Presentation.ApiServerLinux.dll
49+
ENTRYPOINT dotnet C:\app\Presentation.ApiServerCoreService.dll

src/ansys/geometry/core/connection/product_instance.py

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
GEOMETRY_SERVICE_EXE = "Presentation.ApiServerDMS.exe"
6868
"""The Windows Geometry Service's filename (DMS)."""
6969

70-
CORE_GEOMETRY_SERVICE_EXE = "Presentation.ApiServerLinux.exe"
70+
CORE_GEOMETRY_SERVICE_EXE = "Presentation.ApiServerCoreService.exe"
7171
"""The Windows Geometry Service's filename (Core Service)."""
7272

7373
DISCOVERY_EXE = "Discovery.exe"
@@ -316,6 +316,15 @@ def prepare_and_start_backend(
316316
# Verify that the minimum version is installed.
317317
_check_minimal_versions(product_version, specific_minimum_version)
318318

319+
# If Windows Service is requested, BUT version is not 2025R1 or earlier, we will have
320+
# to change the backend type to CORE_WINDOWS and throw a warning.
321+
if backend_type == BackendType.WINDOWS_SERVICE and product_version > 251:
322+
LOG.warning(
323+
"DMS Windows Service is not available for Ansys versions 2025R2 and later. "
324+
"Switching to Core Windows Service."
325+
)
326+
backend_type = BackendType.CORE_WINDOWS
327+
319328
if server_logs_folder is not None:
320329
# Verify that the user has write permissions to the folder and that it exists.
321330
try:
@@ -399,12 +408,29 @@ def prepare_and_start_backend(
399408
# ANS_DSCO_REMOTE_IP should be variable "host" directly, but not working...
400409
env_copy["ANS_DSCO_REMOTE_IP"] = "127.0.0.1" if host == "localhost" else host
401410
env_copy["ANS_DSCO_REMOTE_PORT"] = str(port)
402-
env_copy["ANS_DSCO_REMOTE_LOGS_CONFIG"] = "linux"
403411
env_copy["P_SCHEMA"] = schema_folder.as_posix()
404412
env_copy["ANSYS_CI_INSTALL"] = cad_integration_folder.as_posix()
405-
env_copy[f"ANSYSCL{product_version}_DIR"] = (
406-
root_service_folder / "licensingclient"
407-
).as_posix()
413+
if product_version:
414+
env_copy[f"ANSYSCL{product_version}_DIR"] = (
415+
root_service_folder / "licensingclient"
416+
).as_posix()
417+
else:
418+
# Env var is passed... but no product version is defined. We define all of them.
419+
# Starting on 251... We can use the values in the enum ApiVersions.
420+
for version in ApiVersions:
421+
if version.value < 251:
422+
continue
423+
env_copy[f"ANSYSCL{version.value}_DIR"] = (
424+
root_service_folder / "licensingclient"
425+
).as_posix()
426+
427+
# License server - for Core Geometry Service. If not defined, it will use the default one.
428+
if "LICENSE_SERVER" in os.environ:
429+
pass # Do nothing... the user has defined the license server.
430+
elif "ANSRV_GEO_LICENSE_SERVER" in os.environ:
431+
env_copy["LICENSE_SERVER"] = os.getenv("ANSRV_GEO_LICENSE_SERVER")
432+
else:
433+
env_copy["LICENSE_SERVER"] = os.getenv("ANSYSLMD_LICENSE_FILE", "1055@localhost")
408434

409435
if os.name == "nt":
410436
# Modify the PATH variable to include the path to the Ansys Geometry Core Service
@@ -662,9 +688,15 @@ def _get_common_env(
662688

663689
env_copy[BACKEND_HOST_VARIABLE] = host
664690
env_copy[BACKEND_PORT_VARIABLE] = f"{port}"
665-
env_copy[BACKEND_TRACE_VARIABLE] = f"{enable_trace:d}"
666691
env_copy[BACKEND_LOG_LEVEL_VARIABLE] = f"{server_log_level}"
692+
667693
if server_logs_folder is not None:
668694
env_copy[BACKEND_LOGS_FOLDER_VARIABLE] = f"{server_logs_folder}"
669695

696+
if enable_trace:
697+
env_copy[BACKEND_TRACE_VARIABLE] = "1" # for backward compatibility
698+
if server_log_level > 0:
699+
LOG.warning("Enabling trace mode will override the log level to 0 (Chatterbox).")
700+
env_copy[BACKEND_LOG_LEVEL_VARIABLE] = "0"
701+
670702
return env_copy

0 commit comments

Comments
 (0)