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
1 change: 1 addition & 0 deletions doc/changelog.d/5172.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Include UDS path in connection properties.
53 changes: 39 additions & 14 deletions src/ansys/fluent/core/fluent_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,35 @@ def clear(self):
self._details = ""


@dataclass(frozen=True)
@dataclass(frozen=True, kw_only=True)
class FluentConnectionProperties:
"""Stores Fluent connection properties, including connection IP, port and password;
"""Stores Fluent connection properties, including connection IP/port or UDS path and password;
Fluent Cortex working directory, process ID and hostname; and whether Fluent was
launched in a docker container.

Attributes
----------
ip : str | None
IP address used to connect to Fluent.
port : int | None
Port used to connect to Fluent.
uds_fullpath : str | Path | None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uds_fullpath : str | Path | None
uds_full_path : str | Path | None

@mkundu1 mkundu1 Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanpearsonuk The naming followed the parameter name in the cyberchannel module documentation. The create_channel within cyberchannel is exposed to users and we also support passing the channel within the FluentConnection constructor while directly initializing the session classes (although this is not a mainstream usage pattern). Should we change the parameter name in PyFluent or be consistent with the cyberchannel module?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RobPasMue I think that the name of the parameter in cyberchannel could be updated. WDYT?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @seanpearsonuk! We can update the cyberchannel if needed - but the update would imply accepting both options in fact, at least for a while. We could then move to deprecating the old version.

Nonetheless - what's the main driver? I'm guessing readability but just in case =)

Full path to the Unix Domain Socket used for local connections on Linux.
password : str | None
Password used for authentication when calling Fluent services.
cortex_pwd : str | None
Fluent Cortex working directory.
cortex_pid : int | None
Process ID of the Cortex process.
cortex_host : str | None
Hostname of the Cortex process.
fluent_host_pid : int | None
Process ID of the Fluent solver host process.
inside_container : bool | ContainerT | None
Container context for Fluent.
Returns ``False`` when not running in a container,
and the container instance when running in one.

Examples
--------
These properties are also available through the session object and can be accessed as:
Expand All @@ -267,6 +290,7 @@ class FluentConnectionProperties:

ip: str | None = None
port: int | None = None
uds_fullpath: str | Path | None = None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uds_fullpath: str | Path | None = None
uds_full_path: str | Path | None = None

password: str | None = None
cortex_pwd: str | None = None
cortex_pid: int | None = None
Expand Down Expand Up @@ -583,14 +607,14 @@ def __init__(
self._channel_str = None
self._slurm_job_id = None
self.finalizer_cbs = []
self._uds_fullpath = None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self._uds_fullpath = None
self._uds_full_path = None

if channel is not None:
self._channel = channel
else:
uds_fullpath = None
if address is not None:
self._channel_str = address
uds_fullpath = get_uds_path(address)
if uds_fullpath is None:
self._uds_fullpath = get_uds_path(address)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self._uds_fullpath = get_uds_path(address)
self._uds_full_path = get_uds_path(address)

if self._uds_fullpath is None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if self._uds_fullpath is None:
if self._uds_full_path is None:

ip, port = address.rsplit(":", 1)
port = int(port)
else:
Expand All @@ -599,7 +623,7 @@ def __init__(
self._channel = _get_channel(
ip=ip,
port=port,
uds_fullpath=uds_fullpath,
uds_fullpath=self._uds_fullpath,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uds_fullpath=self._uds_fullpath,
uds_full_path=self._uds_full_path,

allow_remote_host=allow_remote_host,
certificates_folder=certificates_folder,
insecure_mode=insecure_mode,
Expand Down Expand Up @@ -664,14 +688,15 @@ def __init__(
)

self.connection_properties = FluentConnectionProperties(
ip,
port,
password,
cortex_pwd,
cortex_pid,
cortex_host,
fluent_host_pid,
inside_container,
ip=ip,
port=port,
uds_fullpath=self._uds_fullpath,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uds_fullpath=self._uds_fullpath,
uds_full_path=self._uds_full_path,

password=password,
cortex_pwd=cortex_pwd,
cortex_pid=cortex_pid,
cortex_host=cortex_host,
fluent_host_pid=fluent_host_pid,
inside_container=inside_container,
)

self._remote_instance = remote_instance
Expand Down