Skip to content
Merged
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
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include src/ansys/fluent/core/launcher/fluent_launcher_options.json
include src/ansys/fluent/core/docs/README.rst
include src/ansys/fluent/core/logging_config.yaml
include src/ansys/fluent/core/diagnostics/logging_config.yaml
include src/ansys/fluent/core/quantity/cfg.yaml
include src/ansys/fluent/core/launcher/watchdog_exec
recursive-include src/ansys/fluent/core *.pyi
1 change: 1 addition & 0 deletions doc/changelog.d/5415.miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Create 'diagnostics' section.
4 changes: 2 additions & 2 deletions doc/source/user_guide/beta_feature_access.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Example usage:
>>> assert "topology_based" in dir(meshing_session)

>>> topo_meshing = meshing_session.topology_based()
ansys.fluent.core.exceptions.BetaFeaturesNotEnabled: The feature 'topology_based' requires 'enable_beta_features' flag to be enabled.
ansys.fluent.core.diagnostics.exceptions.BetaFeaturesNotEnabled: The feature 'topology_based' requires 'enable_beta_features' flag to be enabled.

>>> # Enable beta features
>>> meshing_session.enable_beta_features()
Expand Down Expand Up @@ -59,7 +59,7 @@ Example usage:
>>> assert hasattr(solver_session, "switch_to_meshing")

>>> switched_meshing_session = solver_session.switch_to_meshing()
ansys.fluent.core.exceptions.BetaFeaturesNotEnabled: The feature 'switch_to_meshing' requires 'enable_beta_features' flag to be enabled.
ansys.fluent.core.diagnostics.exceptions.BetaFeaturesNotEnabled: The feature 'switch_to_meshing' requires 'enable_beta_features' flag to be enabled.

>>> # Enable beta features
>>> solver_session.enable_beta_features()
Expand Down
9 changes: 5 additions & 4 deletions src/ansys/fluent/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,19 @@
from ansys.fluent.core.module_config import *

# Logging has to be imported before importing other PyFluent modules
from ansys.fluent.core.logger import *
from ansys.fluent.core.diagnostics.logger import *

# isort: on

from ansys.fluent.core.context_manager import *
from ansys.fluent.core.exceptions import *
from ansys.fluent.core.diagnostics import logger # noqa: E402
from ansys.fluent.core.diagnostics.exceptions import *
from ansys.fluent.core.diagnostics.search import *
from ansys.fluent.core.fields.field_data import *
from ansys.fluent.core.launcher.launch_options import *
from ansys.fluent.core.launcher.launcher import *
from ansys.fluent.core.local_parametric_study import *
from ansys.fluent.core.meshing import *
from ansys.fluent.core.search import *
from ansys.fluent.core.services.batch_ops import *
from ansys.fluent.core.services.streaming_services.events_streaming import *
from ansys.fluent.core.session import *
Expand Down Expand Up @@ -72,8 +73,8 @@
from ansys.fluent.core import ( # noqa: E402
local_parametric_study as _local_parametric_study,
)
from ansys.fluent.core import exceptions as _exceptions # noqa: E402
from ansys.fluent.core import file_reader as _file_reader # noqa: E402
from ansys.fluent.core.diagnostics import exceptions as _exceptions # noqa: E402
from ansys.fluent.core.session import file as _session_file # noqa: E402

_sys.modules["ansys.fluent.core.file_session"] = _session_file
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/codegen/builtin_settingsgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def _generate_py_file(root, version) -> None:
" _SingletonSetting, _CreatableNamedObjectSetting,"
" _NonCreatableNamedObjectSetting, _CommandSetting, Solver\n"
"from ansys.fluent.core.solver.flobject import SettingsBase\n"
"from ansys.fluent.core.exceptions import PyFluentDeprecationWarning\n"
"from ansys.fluent.core.diagnostics.exceptions import PyFluentDeprecationWarning\n"
"import warnings\n\n\n"
)
f.write("__all__ = [\n")
Expand Down
21 changes: 21 additions & 0 deletions src/ansys/fluent/core/diagnostics/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (C) 2021 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def list_loggers():
-------
list of str
Each list element is a PyFluent logger name that can be individually controlled
through :func:`ansys.fluent.core.logging.get_logger`.
through :func:`ansys.fluent.core.diagnostics.logging.get_logger`.

Notes
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from typing import TYPE_CHECKING, Iterable
import warnings

from ansys.fluent.core.exceptions import DisallowedValuesError
from ansys.fluent.core.diagnostics.exceptions import DisallowedValuesError

if TYPE_CHECKING:

Expand Down Expand Up @@ -356,7 +356,7 @@ def valid_name(self, field_name):
FieldUnavailableError
If field name is valid but not currently available.
"""
from ansys.fluent.core.exceptions import DisallowedValuesError
from ansys.fluent.core.diagnostics.exceptions import DisallowedValuesError

if validate_inputs:
names = self
Expand Down Expand Up @@ -387,7 +387,7 @@ def valid_name(self, surface_name: str) -> str:
DisallowedValuesError
If surface name is invalid.
"""
from ansys.fluent.core.exceptions import DisallowedValuesError
from ansys.fluent.core.diagnostics.exceptions import DisallowedValuesError

try:
valid_names = self() # Fetch once, upfront
Expand Down
4 changes: 2 additions & 2 deletions src/ansys/fluent/core/fields/field_data/_return_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _surface_data(
surface_ids[count]
][SurfaceDataType.FacesConnectivity.value]
else:
from ansys.fluent.core.exceptions import (
from ansys.fluent.core.diagnostics.exceptions import (
PyFluentDeprecationWarning,
)

Expand Down Expand Up @@ -121,7 +121,7 @@ def _pathlines_data(
if flatten_connectivity:
lines_data = pathlines_data[surface_ids[count]]["lines"]
else:
from ansys.fluent.core.exceptions import (
from ansys.fluent.core.diagnostics.exceptions import (
PyFluentDeprecationWarning,
)

Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/fields/reduction/reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from typing import Any
import weakref

from ansys.fluent.core.exceptions import DisallowedValuesError
from ansys.fluent.core.diagnostics.exceptions import DisallowedValuesError
from ansys.fluent.core.fields.reduction.abstract_reduction import AbstractReduction
from ansys.fluent.core.solver.function.reduction import Weight

Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/file_transfer_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
from typing import Any, Protocol
import warnings

from ansys.fluent.core.exceptions import PyFluentUserWarning
from ansys.fluent.core.diagnostics.exceptions import PyFluentUserWarning
from ansys.fluent.core.utils import get_user_data_dir
from ansys.fluent.core.utils.deprecate import deprecate_arguments
import ansys.platform.instancemanagement as pypim
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/fluent_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from deprecated.sphinx import deprecated
import grpc

from ansys.fluent.core.exceptions import InsecureGrpcWarning
from ansys.fluent.core.diagnostics.exceptions import InsecureGrpcWarning
from ansys.fluent.core.file_transfer_service import ContainerFileTransferStrategy
from ansys.fluent.core.launcher.error_warning_messages import (
ALLOW_REMOTE_HOST_NOT_PROVIDED_IN_REMOTE,
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/launcher/fluent_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
from typing import Any
import warnings

from ansys.fluent.core.diagnostics.exceptions import PyFluentDeprecationWarning
from ansys.fluent.core.docker.docker_compose import ComposeBasedLauncher
from ansys.fluent.core.docker.utils import get_ghcr_fluent_image_name
from ansys.fluent.core.exceptions import PyFluentDeprecationWarning
from ansys.fluent.core.launcher.error_handler import (
LaunchFluentError,
)
Expand Down
5 changes: 4 additions & 1 deletion src/ansys/fluent/core/launcher/launch_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
from ansys.fluent.core.session.solver_icing import SolverIcing

from ansys.fluent.core._types import LauncherArgsBase
from ansys.fluent.core.exceptions import DisallowedValuesError, PyFluentUserWarning
from ansys.fluent.core.diagnostics.exceptions import (
DisallowedValuesError,
PyFluentUserWarning,
)
import ansys.fluent.core.launcher.error_handler as exceptions
from ansys.fluent.core.launcher.error_warning_messages import (
BOTH_CERTIFICATES_FOLDER_AND_INSECURE_MODE_PROVIDED,
Expand Down
58 changes: 55 additions & 3 deletions src/ansys/fluent/core/launcher/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from typing_extensions import Required, Unpack, assert_never

from ansys.fluent.core._types import LauncherArgsBase, PathType
from ansys.fluent.core.exceptions import DisallowedValuesError
from ansys.fluent.core.diagnostics.exceptions import DisallowedValuesError
from ansys.fluent.core.fluent_connection import FluentConnection
from ansys.fluent.core.launcher.container_launcher import DockerLauncher
from ansys.fluent.core.launcher.error_warning_messages import (
Expand All @@ -58,7 +58,9 @@
get_remote_grpc_options,
)
from ansys.fluent.core.launcher.launcher_utils import (
_build_case_data_arguments,
_confirm_watchdog_start,
_validate_lightweight_with_case_data,
is_windows,
)
from ansys.fluent.core.launcher.pim_launcher import PIMLauncher
Expand Down Expand Up @@ -441,6 +443,43 @@ def _normalize_path(value: "PathType | None") -> str | None:

match fluent_launch_mode:
case LaunchMode.CONTAINER:
container_case_file_name = case_file_name_val
container_case_data_file_name = case_data_file_name_val
container_additional_arguments = additional_arguments
if not dry_run:
if file_transfer_service:
# Upload host files so Fluent can see them under the mount.
for file_name in (
container_case_file_name,
container_case_data_file_name,
):
if file_name:
file_transfer_service.upload(file_name=file_name)
# Fluent resolves case/data files by basename: they either arrive
# under the container's working dir via the mounted host download
# directory, or were just uploaded by the file transfer service.
if container_case_file_name:
container_case_file_name = os.path.basename(
container_case_file_name
)
if container_case_data_file_name:
container_case_data_file_name = os.path.basename(
container_case_data_file_name
)
should_disable, warning_msg = _validate_lightweight_with_case_data(
lightweight_mode, container_case_data_file_name
)
if should_disable:
warn(warning_msg, UserWarning)
lightweight_mode = False
if (
not dry_run
and not lightweight_mode
and (container_case_file_name or container_case_data_file_name)
):
container_additional_arguments += _build_case_data_arguments(
container_case_file_name, container_case_data_file_name
)
launcher = DockerLauncher(
mode=mode,
ui_mode=ui_mode,
Expand All @@ -450,7 +489,7 @@ def _normalize_path(value: "PathType | None") -> str | None:
precision=precision,
processor_count=processor_count,
start_timeout=start_timeout_val,
additional_arguments=additional_arguments,
additional_arguments=container_additional_arguments,
container_dict=container_dict,
dry_run=dry_run,
cleanup_on_exit=cleanup_on_exit,
Expand Down Expand Up @@ -542,7 +581,20 @@ def _normalize_path(value: "PathType | None") -> str | None:
case _:
assert_never(fluent_launch_mode)

return launcher()
session = launcher()
# Lightweight case loading requires the running session's file-transfer handling.
if (
fluent_launch_mode == LaunchMode.CONTAINER
and lightweight_mode
and case_file_name_val
and not dry_run
):
session.read_case_lightweight(
case_file_name_val
if file_transfer_service
else os.path.basename(case_file_name_val)
)
return session


def connect_to_fluent(
Expand Down
5 changes: 4 additions & 1 deletion src/ansys/fluent/core/launcher/launcher_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
from typing import Any
import warnings

from ansys.fluent.core.exceptions import InvalidArgument, PyFluentDeprecationWarning
from ansys.fluent.core.diagnostics.exceptions import (
InvalidArgument,
PyFluentDeprecationWarning,
)
from ansys.fluent.core.launcher.error_warning_messages import (
LIGHTWEIGHT_MODE_IGNORED_WITH_CASE_DATA,
LIGHTWEIGHT_MODE_IGNORED_WITH_JOURNAL,
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/launcher/slurm_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
from typing_extensions import TypeVar, Unpack

from ansys.fluent.core._types import LauncherArgsBase, PathType
from ansys.fluent.core.exceptions import InvalidArgument
from ansys.fluent.core.diagnostics.exceptions import InvalidArgument
from ansys.fluent.core.launcher.error_warning_messages import (
CERTIFICATES_FOLDER_NOT_PROVIDED_AT_LAUNCH,
)
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/launcher/standalone_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
from typing_extensions import Unpack

from ansys.fluent.core._types import LauncherArgsBase
from ansys.fluent.core.exceptions import InvalidArgument
from ansys.fluent.core.diagnostics.exceptions import InvalidArgument
from ansys.fluent.core.launcher.error_handler import (
LaunchFluentError,
)
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/meshing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import warnings

from ansys.fluent.core.exceptions import PyFluentUserWarning
from ansys.fluent.core.diagnostics.exceptions import PyFluentUserWarning
from ansys.fluent.core.session import Meshing, PureMeshing
from ansys.fluent.core.session.meshing import BaseMeshing
from ansys.fluent.core.utils.fluent_version import FluentVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from enum import Enum
import warnings

from ansys.fluent.core.exceptions import PyFluentDeprecationWarning
from ansys.fluent.core.diagnostics.exceptions import PyFluentDeprecationWarning


def _missing_for_events(cls, value):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
from typing import Generic, TypeVar
import warnings

from ansys.fluent.core.exceptions import InvalidArgument, PyFluentDeprecationWarning
from ansys.fluent.core.diagnostics.exceptions import (
InvalidArgument,
PyFluentDeprecationWarning,
)
from ansys.fluent.core.services.streaming_services._events_info_store import (
AboutToInitializeSolutionEventInfo,
AboutToLoadCaseEventInfo,
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/session/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import logging

from ansys.fluent.core.exceptions import warning_for_fluent_dev_version
from ansys.fluent.core.diagnostics.exceptions import warning_for_fluent_dev_version
from ansys.fluent.core.module_config import config
from ansys.fluent.core.services.text_interface import TUIMenu
from ansys.fluent.core.utils import load_module
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/session/base_meshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from ansys.fluent.core._data_model_cache import DataModelCache, NameKey
from ansys.fluent.core._types import PathType
from ansys.fluent.core.data_transfer import transfer_case
from ansys.fluent.core.exceptions import BetaFeaturesNotEnabled
from ansys.fluent.core.diagnostics.exceptions import BetaFeaturesNotEnabled
from ansys.fluent.core.fluent_connection import FluentConnection
from ansys.fluent.core.module_config import config
from ansys.fluent.core.services.scheme_interpreter import SchemeInterpreter
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/session/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from deprecated.sphinx import deprecated
import numpy as np

from ansys.fluent.core.exceptions import PyFluentDeprecationWarning
from ansys.fluent.core.diagnostics.exceptions import PyFluentDeprecationWarning
from ansys.fluent.core.fields.field_data._field_data_interfaces import (
_AllowedScalarFieldNames,
_AllowedSurfaceNames,
Expand Down
4 changes: 2 additions & 2 deletions src/ansys/fluent/core/session/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
)
from ansys.fluent.core.launcher.pim_launcher import PIMArgsWithoutMode

from ansys.fluent.core.exceptions import (
from ansys.fluent.core.diagnostics.exceptions import (
PyFluentDeprecationWarning,
PyFluentUserWarning,
)
from ansys.fluent.core.diagnostics.journaling import Journal
from ansys.fluent.core.fluent_connection import FluentConnection
from ansys.fluent.core.journaling import Journal
from ansys.fluent.core.rpvars import RPVars
from ansys.fluent.core.services.scheme_interpreter import SchemeInterpreter
from ansys.fluent.core.utils.deprecate import deprecate_function
Expand Down
Loading
Loading