ansys / ansys/pyfluent

Add better error messages for license failures

Open
#4,770 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
497
Forks
77
Avg merge
22h 37m
Merged PRs (30d)
45

Description

### 📝 Description of the feature

Currently you get a fairly opaque error message when starting pyfluent without a license server connection and you have to go through the .trn to find the root cause. It might be nice to have a higher level exception for this related #3634

### 💡 Steps for implementing the feature

Not really sure where the best place to check the license server is. I imagine the checking needs to go somewhere in this tb
```py
pyfluent.launcher ERROR: Exception caught - RuntimeError: failed to connect to all addresses; last error: UNKNOWN: unix:/tmp/934c9791-4073-41cb-a626-2dca15a0ce60.sock: connect: Connection refused (111)
Traceback (most recent call last):
File "/home/jhilton-/PyFBU/.venv/lib/python3.12/site-packages/ansys/fluent/core/launcher/standalone_launcher.py", line 278, in __call__
session = self.new_session._create_from_server_info_file(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jhilton-/PyFBU/.venv/lib/python3.12/site-packages/ansys/fluent/core/session.py", line 349, in _create_from_server_info_file
fluent_connection = FluentConnection(
^^^^^^^^^^^^^^^^^
File "/home/jhilton-/PyFBU/.venv/lib/python3.12/site-packages/ansys/fluent/core/fluent_connection.py", line 553, in __init__
self._health_check.check_health()
File "/home/jhilton-/PyFBU/.venv/lib/python3.12/site-packages/ansys/fluent/core/services/health_check.py", line 82, in check_health
response = self._stub.Check(
^^^^^^^^^^^^^^^^^
File "/home/jhilton-/PyFBU/.venv/lib/python3.12/site-packages/grpc/_interceptor.py", line 276, in __call__
response, ignored_call = self._with_call(
^^^^^^^^^^^^^^^^
File "/home/jhilton-/PyFBU/.venv/lib/python3.12/site-packages/grpc/_interceptor.py", line 328, in _with_call
call = self._interceptor.intercept_unary_unary(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jhilton-/PyFBU/.venv/lib/python3.12/site-packages/ansys/fluent/core/services/interceptors.py", line 174, in intercept_unary_unary
return self._intercept_call(continuation, client_call_details, request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jhilton-/PyFBU/.venv/lib/python3.12/site-packages/ansys/fluent/core/services/interceptors.py", line 164, in _intercept_call
raise new_ex from None
RuntimeError: failed to connect to all addresses; last error: UNKNOWN: unix:/tmp/934c9791-4073-41cb-a626-2dca15a0ce60.sock: connect: Connection refused (111)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/jhilton-/PyFBU/test_session.py", line 7, in
solver = pyfluent.Solver.from_install()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jhilton-/PyFBU/.venv/lib/python3.12/site-packages/ansys/fluent/core/session_utilities.py", line 170, in from_install
return launcher()
^^^^^^^^^^
File "/home/jhilton-/PyFBU/.venv/lib/python3.12/site-packages/ansys/fluent/core/launcher/standalone_launcher.py", line 322, in __call__
raise LaunchFluentError(self._launch_cmd) from ex
ansys.fluent.core.launcher.error_handler.LaunchFluentError:
Fluent Launch command: nohup /home/ANSYSDev/v261/fluent/bin/fluent 3ddp -py -gu -driver null -sifile=/tmp/serverinfo-qw9qqacy.txt -nm &
```

### 🔗 Useful links and references

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in ansys/fluent/core/launcher/standalone_launcher.py at the server-info-file session creation, then trace the failure through session.py, fluent_connection.py, services/health_check.py, and launcher/error_handler.py. Review the related issue #3634 and existing launcher tests if present. Done means license-server connection failures produce a clear higher-level error instead of the opaque traceback.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.