Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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/4572.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'wait_process_finished' in sessions.
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any):

def __dir__(self):
if self._fluent_connection is None:
return ["is_active"]
return ["is_active", "wait_process_finished"]
dir_list = set(list(self.__dict__.keys()) + dir(type(self))) - {
"field_data",
"field_info",
Expand Down
2 changes: 2 additions & 0 deletions src/ansys/fluent/core/session_meshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def __getattribute__(self, item: str):
) is None and item not in [
"is_active",
"_fluent_connection",
"_fluent_connection_backup",
"wait_process_finished",
]:
raise AttributeError(
f"'{__class__.__name__}' object has no attribute '{item}'"
Expand Down
11 changes: 11 additions & 0 deletions src/ansys/fluent/core/session_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,17 @@ def __call__(self):
return self.get_state()

def __getattr__(self, name):
if super(Solver, self).__getattribute__(
"_fluent_connection"
) is None and name not in [
"is_active",
"_fluent_connection",
"_fluent_connection_backup",
"wait_process_finished",
]:
raise AttributeError(
f"'{__class__.__name__}' object has no attribute '{name}'"
)
try:
return super().__getattribute__(name)
except AttributeError as ex:
Expand Down
24 changes: 24 additions & 0 deletions tests/test_fluent_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,27 @@ def test_fluent_exit_wait():
with pytest.raises(WaitTypeError):
session4 = pyfluent.launch_fluent()
session4.exit(wait="wait")


def test_wait_process_finished():
meshing_session = pyfluent.launch_fluent(mode="meshing")
assert len(dir(meshing_session)) > 2
assert meshing_session.is_active()
assert meshing_session.tui
meshing_session.exit()
assert dir(meshing_session) == ["is_active", "wait_process_finished"]
assert not meshing_session.is_active()
with pytest.raises(AttributeError):
meshing_session.tui
assert meshing_session.wait_process_finished(wait=5)

solver_session = pyfluent.launch_fluent()
assert len(dir(solver_session)) > 2
assert solver_session.is_active()
assert solver_session.settings
solver_session.exit()
assert dir(solver_session) == ["is_active", "wait_process_finished"]
assert not solver_session.is_active()
with pytest.raises(AttributeError):
solver_session.settings
assert solver_session.wait_process_finished(wait=5)
Loading