Skip to content

Commit

Permalink
Merge branch 'main' into feat/chamfer
Browse files Browse the repository at this point in the history
  • Loading branch information
RobPasMue authored Nov 5, 2024
2 parents 45116ea + 1ce28f7 commit e442584
Show file tree
Hide file tree
Showing 45 changed files with 225 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exclude: "tests/integration/files"
repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.1
rev: v0.7.2
hooks:
- id: ruff
- id: ruff-format
Expand Down
1 change: 0 additions & 1 deletion doc/changelog.d/1454.added.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1476.maintenance.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1478.fixed.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1479.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1482.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1485.documentation.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1486.fixed.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1487.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1489.maintenance.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1490.documentation.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1492.maintenance.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1493.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1494.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1496.added.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1497.maintenance.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1499.added.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1501.documentation.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1502.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1504.maintenance.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1505.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1506.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1507.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1508.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1509.documentation.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1510.added.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1511.documentation.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1512.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1513.added.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1516.maintenance.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1517.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/1518.dependencies.md

This file was deleted.

1 change: 1 addition & 0 deletions doc/changelog.d/1519.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
update CHANGELOG for v0.7.5
1 change: 1 addition & 0 deletions doc/changelog.d/1520.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bump ansys-sphinx-theme[autoapi] from 1.1.7 to 1.2.0 in the docs-deps group
1 change: 1 addition & 0 deletions doc/changelog.d/1521.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bump ansys-tools-visualization-interface from 0.4.7 to 0.5.0
1 change: 1 addition & 0 deletions doc/changelog.d/1522.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bump numpy from 2.1.2 to 2.1.3
File renamed without changes.
1 change: 1 addition & 0 deletions doc/changelog.d/1524.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typo with the docstrings
1 change: 1 addition & 0 deletions doc/changelog.d/1525.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bump ansys-api-geometry from 0.4.13 to 0.4.14
59 changes: 59 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,65 @@ This document contains the release notes for the PyAnsys Geometry project.
.. towncrier release notes start
`0.7.5 <https://github.com/ansys/pyansys-geometry/releases/tag/v0.7.5>`_ - 2024-10-31
=====================================================================================

Added
^^^^^

- create body from surface `#1454 <https://github.com/ansys/pyansys-geometry/pull/1454>`_
- performance enhancements to plotter `#1496 <https://github.com/ansys/pyansys-geometry/pull/1496>`_
- allow picking from easy access methods `#1499 <https://github.com/ansys/pyansys-geometry/pull/1499>`_
- implement cut operation in extrude sketch `#1510 <https://github.com/ansys/pyansys-geometry/pull/1510>`_
- caching bodies to avoid unnecessary object creation `#1513 <https://github.com/ansys/pyansys-geometry/pull/1513>`_
- enable retrieval of service logs (via API) `#1515 <https://github.com/ansys/pyansys-geometry/pull/1515>`_


Dependencies
^^^^^^^^^^^^

- bump sphinx from 8.1.0 to 8.1.3 in the docs-deps group `#1479 <https://github.com/ansys/pyansys-geometry/pull/1479>`_
- bump ansys-sphinx-theme[autoapi] from 1.1.4 to 1.1.5 in the docs-deps group `#1482 <https://github.com/ansys/pyansys-geometry/pull/1482>`_
- bump the grpc-deps group across 1 directory with 3 updates `#1487 <https://github.com/ansys/pyansys-geometry/pull/1487>`_
- bump ansys-sphinx-theme[autoapi] from 1.1.5 to 1.1.6 in the docs-deps group `#1493 <https://github.com/ansys/pyansys-geometry/pull/1493>`_
- bump trame-vtk from 2.8.10 to 2.8.11 `#1494 <https://github.com/ansys/pyansys-geometry/pull/1494>`_
- bump ansys-api-geometry from 0.4.11 to 0.4.12 `#1502 <https://github.com/ansys/pyansys-geometry/pull/1502>`_
- bump protobuf from 5.28.2 to 5.28.3 in the grpc-deps group `#1505 <https://github.com/ansys/pyansys-geometry/pull/1505>`_
- bump ansys-sphinx-theme[autoapi] from 1.1.6 to 1.1.7 in the docs-deps group `#1506 <https://github.com/ansys/pyansys-geometry/pull/1506>`_
- bump ansys-tools-visualization-interface from 0.4.6 to 0.4.7 `#1507 <https://github.com/ansys/pyansys-geometry/pull/1507>`_
- bump panel from 1.5.2 to 1.5.3 `#1508 <https://github.com/ansys/pyansys-geometry/pull/1508>`_
- bump ansys-api-geometry from 0.4.12 to 0.4.13 `#1512 <https://github.com/ansys/pyansys-geometry/pull/1512>`_
- bump the grpc-deps group with 2 updates `#1517 <https://github.com/ansys/pyansys-geometry/pull/1517>`_
- bump pytest-cov from 5.0.0 to 6.0.0 `#1518 <https://github.com/ansys/pyansys-geometry/pull/1518>`_


Documentation
^^^^^^^^^^^^^

- avoid having a drop down in the top navigation bar `#1485 <https://github.com/ansys/pyansys-geometry/pull/1485>`_
- provide information on how to build a single example `#1490 <https://github.com/ansys/pyansys-geometry/pull/1490>`_
- add example file to download in the test `#1501 <https://github.com/ansys/pyansys-geometry/pull/1501>`_
- revisit examples to make sure they are properly styled `#1509 <https://github.com/ansys/pyansys-geometry/pull/1509>`_
- align landing page layout with UI/UX requirements `#1511 <https://github.com/ansys/pyansys-geometry/pull/1511>`_


Fixed
^^^^^

- static search options `#1478 <https://github.com/ansys/pyansys-geometry/pull/1478>`_
- respect product_version when launching geometry service `#1486 <https://github.com/ansys/pyansys-geometry/pull/1486>`_


Maintenance
^^^^^^^^^^^

- update CHANGELOG for v0.7.4 `#1476 <https://github.com/ansys/pyansys-geometry/pull/1476>`_
- pre-commit automatic update `#1480 <https://github.com/ansys/pyansys-geometry/pull/1480>`_, `#1516 <https://github.com/ansys/pyansys-geometry/pull/1516>`_
- avoid linkcheck on changelog (unnecessary) `#1489 <https://github.com/ansys/pyansys-geometry/pull/1489>`_
- update CONTRIBUTORS `#1492 <https://github.com/ansys/pyansys-geometry/pull/1492>`_
- allowing new tags for Windows Core Service `#1497 <https://github.com/ansys/pyansys-geometry/pull/1497>`_
- simplify vulnerabilities check `#1504 <https://github.com/ansys/pyansys-geometry/pull/1504>`_

`0.7.4 <https://github.com/ansys/pyansys-geometry/releases/tag/v0.7.4>`_ - 2024-10-11
=====================================================================================

Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
]

dependencies = [
"ansys-api-geometry==0.4.13",
"ansys-api-geometry==0.4.14",
"ansys-tools-path>=0.3,<1",
"ansys-tools-visualization-interface>=0.2.6,<1",
"beartype>=0.11.0,<0.20",
Expand All @@ -49,12 +49,12 @@ all = [
tests = [
"ansys-platform-instancemanagement==1.1.2",
"ansys-tools-path==0.6.0",
"ansys-tools-visualization-interface==0.4.7",
"ansys-tools-visualization-interface==0.5.0",
"beartype==0.19.0",
"docker==7.1.0",
"grpcio==1.67.1",
"grpcio-health-checking==1.67.1",
"numpy==2.1.2",
"numpy==2.1.3",
"Pint==0.24.3",
"protobuf==5.28.3",
"pytest==8.3.3",
Expand All @@ -75,9 +75,9 @@ tests-minimal = [
"pytest-xvfb==3.0.0",
]
doc = [
"ansys-sphinx-theme[autoapi]==1.1.7",
"ansys-sphinx-theme[autoapi]==1.2.0",
"ansys-tools-path==0.6.0",
"ansys-tools-visualization-interface==0.4.7",
"ansys-tools-visualization-interface==0.5.0",
"beartype==0.19.0",
"docker==7.1.0",
"grpcio==1.67.1",
Expand All @@ -90,7 +90,7 @@ doc = [
"nbsphinx==0.9.5",
"notebook==7.2.2",
"numpydoc==1.8.0",
"numpy==2.1.2",
"numpy==2.1.3",
"panel==1.5.3",
"Pint==0.24.3",
"protobuf==5.28.3",
Expand Down
77 changes: 76 additions & 1 deletion src/ansys/geometry/core/connection/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
from typing import Optional
import warnings

from ansys.geometry.core.errors import protect_grpc

# TODO: Remove this context and filter once the protobuf UserWarning issue is downgraded to INFO
# https://github.com/grpc/grpc/issues/37609
with warnings.catch_warnings():
Expand All @@ -43,7 +45,12 @@
from beartype import beartype as check_input_types
import semver

from ansys.api.dbu.v0.admin_pb2 import BackendType as GRPCBackendType
from ansys.api.dbu.v0.admin_pb2 import (
BackendType as GRPCBackendType,
LogsRequest,
LogsTarget,
PeriodType,
)
from ansys.api.dbu.v0.admin_pb2_grpc import AdminStub
from ansys.geometry.core.connection.backend import BackendType
from ansys.geometry.core.connection.defaults import DEFAULT_HOST, DEFAULT_PORT, MAX_MESSAGE_LENGTH
Expand Down Expand Up @@ -327,3 +334,71 @@ def target(self) -> str:
def get_name(self) -> str:
"""Get the target name of the connection."""
return self._target

@check_input_types
@protect_grpc
def _get_service_logs(
self,
all_logs: bool = False,
dump_to_file: bool = False,
logs_folder: str | Path | None = None,
) -> str | dict[str, str] | Path:
"""Get the service logs.
Parameters
----------
all_logs : bool, default: False
Flag indicating whether all logs should be retrieved. By default,
only the current logs are retrieved.
dump_to_file : bool, default: False
Flag indicating whether the logs should be dumped to a file.
By default, the logs are not dumped to a file.
logs_folder : str, Path or None, default: None
Name of the folder where the logs should be dumped. This parameter
is only used if the ``dump_to_file`` parameter is set to ``True``.
Returns
-------
str
Service logs as a string. This is returned if the ``dump_to_file`` parameter
is set to ``False``.
dict[str, str]
Dictionary containing the logs. The keys are the logs names,
and the values are the logs as strings. This is returned if the ``all_logs``
parameter is set to ``True`` and the ``dump_to_file`` parameter
is set to ``False``.
Path
Path to the folder containing the logs (if the ``all_logs``
parameter is set to ``True``) or the path to the log file (if only
the current logs are retrieved). The ``dump_to_file`` parameter
must be set to ``True``.
"""
request = LogsRequest(
target=LogsTarget.CLIENT,
period_type=PeriodType.CURRENT if not all_logs else PeriodType.ALL,
null_path=None,
null_period=None,
)
logs_generator = self._admin_stub.GetLogs(request)
logs: dict[str, str] = {}

for chunk in logs_generator:
if chunk.log_name not in logs:
logs[chunk.log_name] = ""
logs[chunk.log_name] += chunk.log_chunk.decode()

# Let's handle the various scenarios...
if not dump_to_file:
return logs if all_logs else next(iter(logs.values()))
else:
if logs_folder is None:
logs_folder = Path.cwd()
elif isinstance(logs_folder, str):
logs_folder = Path(logs_folder)

logs_folder.mkdir(parents=True, exist_ok=True)
for log_name, log_content in logs.items():
with (logs_folder / log_name).open("w") as f:
f.write(log_content)

return (logs_folder / log_name) if len(logs) == 1 else logs_folder
41 changes: 41 additions & 0 deletions src/ansys/geometry/core/modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,3 +504,44 @@ def measurement_tools(self) -> MeasurementTools:
def pull_tools(self) -> PullTools:
"""Access to pull tools."""
return self._pull_tools

@min_backend_version(25, 1, 0)
def get_service_logs(
self,
all_logs: bool = False,
dump_to_file: bool = False,
logs_folder: str | Path | None = None,
) -> str | dict[str, str] | Path:
"""Get the service logs.
Parameters
----------
all_logs : bool, default: False
Flag indicating whether all logs should be retrieved. By default,
only the current logs are retrieved.
dump_to_file : bool, default: False
Flag indicating whether the logs should be dumped to a file.
By default, the logs are not dumped to a file.
logs_folder : str, Path or None, default: None
Name of the folder where the logs should be dumped. This parameter
is only used if the ``dump_to_file`` parameter is set to ``True``.
Returns
-------
str
Service logs as a string. This is returned if the ``dump_to_file`` parameter
is set to ``False``.
dict[str, str]
Dictionary containing the logs. The keys are the logs names,
and the values are the logs as strings. This is returned if the ``all_logs``
parameter is set to ``True`` and the ``dump_to_file`` parameter
is set to ``False``.
Path
Path to the folder containing the logs (if the ``all_logs``
parameter is set to ``True``) or the path to the log file (if only
the current logs are retrieved). The ``dump_to_file`` parameter
must be set to ``True``.
"""
return self.client._get_service_logs(
all_logs=all_logs, dump_to_file=dump_to_file, logs_folder=logs_folder
)
Loading

0 comments on commit e442584

Please sign in to comment.