shared matlab-engine python connections occationally fail with an Unable to connect to MATLAB session error
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
Is matlab_eng.quit() the correct way to disconnect from the shared matlab-engine?
Can you confirm that each of the 3 python systemd services will have it’s own MATLAB workspace?
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?
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)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
Is matlab_eng.quit() the correct way to disconnect from the shared matlab-engine?
Can you confirm that each of the 3 python systemd services will have it’s own MATLAB workspace?
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?
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) 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
Is matlab_eng.quit() the correct way to disconnect from the shared matlab-engine?
Can you confirm that each of the 3 python systemd services will have it’s own MATLAB workspace?
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?
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) matlab-engine python MATLAB Answers — New Questions