Open stefanmarth opened 1 year ago
This issue also applies if no license is available, or if optiSLang fails to start due to other reasons.
Regarding the RuntimeError("Cannot get the optiSLang server port.")
:
Regarding the licensing error, this one is currenly captured in warning level of log (stderr
stream is redirected there)
Regarding the listener timeout in general, this is captured as well in warning level of log.
Not sure though, if we can safely determine why the server didn't send response with port, if it was insufficient timeout or another reason.
Some ideas:
(A) Extend the message in RuntimeError
to "Cannot get the optiSLang server port. Please check the license. If license is available try increasing the ini_timeout and/or loglevel parameter. See documentation for more details."
(B) Check that license is available before starting osl as ansDArnold proposed. Is there any easy way, how to check the license beforehand?
(C) Scan stderr
for "ANSYS license error" and pass this to the main thread.
(D) Check whether the process is running before raising RuntimeError
and if not, modify this to "OptiSLang process is not running.".
Hi @PanekOndrej, I'd suggest to monitor the osl process (smtng like option (D)), during startup. When the oSL process terminates, immediately leave the "wait for server port" loop and raise an "optiSLang process could not be started (ErrorCode: xyz)" error, with optiSLang StdErr messages attached. As for the (ErrorCode: xyz), there are a few known error codes, e.g. there is a specific one for missing license, I will check and get back to you.
🔍 Before submitting the issue
🐞 Description of the bug
calling
osl = Optislang()
returns RuntimeError: Cannot get optiSLang server port.The problem is solved by setting the ini_timeout
osl = Optislang(ini_timeout=60)
so the error message doesn't fit the problem.
📝 Steps to reproduce
💻 Which operating system are you using?
Windows
📀 Which ANSYS version are you using?
23R1
🐍 Which Python version are you using?
3.10
📦 Installed packages