shared matlab-engine python connections occationally fail with an Unable to connect to MATLAB session error

2 次查看(过去 30 天)
On a RHEL7 platform, we are running a shared (synchronous) MATLAB session as a systemd service. We are also running 3 python systemd services that connect to the shared matlab engine using matlab_eng = matlab.engine.connect_matlab("OUR_SESSION_NAME_HERE"). After successfully connecting to the shared matlab-engine, the python service will do some MATLAB processing, then do a matlab_eng.quit() to disconnect from the shared matlab-engine. I have 4 questions that I hope somebody could answer. See below.
Regards Debbie
  1. Is matlab_eng.quit() the correct way to disconnect from the shared matlab-engine?
  2. Can you confirm that each of the 3 python systemd services will have it's own MATLAB workspace?
  3. After our python services have run awhile, we start seeing trouble connecting to the shared matlab-engine. The stack trace looks similar to as shown below. Why would these connection errors only occationally occur and how can we fix this? We have assumed that each of our python processes can use the shared matlab-engine concurrently, is this not correct?
  4. As a follow-up to question 3, why is _future.result showing up in the trace? We started a synchronous matlab-engine, the documentation mentions future results only with respect to asynchronous matlab-engines.
<class 'matlab.engine.EngineError'>
Unable to connect to MATLAB session 'OUR_SESSION_NAME_HERE'.
matlab_eng = matlab.engine.connect_matlab('OUR_SESSION_NAME_HERE')
!! File "/usr/lib/python2.7/site-packages/matlab/engine/__init__.py", line 182, in connect_matlab
eng = future.result()
!! File "/usr/lib/python2.7/site-packages/matlab/engine/futureresult.py", line 67, in result
return self.__future.result(timeout)
!! File "/usr/lib/python2.7/site-packages/matlab/engine/matlabfuture.py", line 87, in result
handle = pythonengine.getMATLAB(self._future)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Call MATLAB from Python 的更多信息

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by