matlab-proxy 0.24.1__py3-none-any.whl → 0.24.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of matlab-proxy might be problematic. Click here for more details.

matlab_proxy/app_state.py CHANGED
@@ -10,15 +10,15 @@ import time
10
10
  import uuid
11
11
  from collections import deque
12
12
  from datetime import datetime, timedelta, timezone
13
- from typing import Final, Optional, Callable
13
+ from typing import Callable, Final, Optional
14
14
 
15
15
  from matlab_proxy import util
16
16
  from matlab_proxy.constants import (
17
+ CHECK_MATLAB_STATUS_INTERVAL_SECONDS,
17
18
  CONNECTOR_SECUREPORT_FILENAME,
18
19
  IS_CONCURRENCY_CHECK_ENABLED,
19
20
  MATLAB_LOGS_FILE_NAME,
20
21
  USER_CODE_OUTPUT_FILE_NAME,
21
- CHECK_MATLAB_STATUS_INTERVAL_SECONDS,
22
22
  )
23
23
  from matlab_proxy.settings import get_process_startup_timeout
24
24
  from matlab_proxy.util import mw, mwi, system, windows
@@ -30,10 +30,10 @@ from matlab_proxy.util.mwi.exceptions import (
30
30
  FatalError,
31
31
  LicensingError,
32
32
  MatlabError,
33
+ MatlabInstallError,
33
34
  OnlineLicensingError,
34
35
  UIVisibleFatalError,
35
36
  XvfbError,
36
- LockAcquisitionError,
37
37
  log_error,
38
38
  )
39
39
 
@@ -90,10 +90,6 @@ class AppState:
90
90
  self.error = settings["error"]
91
91
  self.warnings = settings["warnings"]
92
92
 
93
- if self.error is not None:
94
- self.logs["matlab"].clear()
95
- return
96
-
97
93
  # Keep track of when the Embedded connector starts.
98
94
  # Would be initialized appropriately by get_embedded_connector_state() task.
99
95
  self.embedded_connector_start_time = None
@@ -1109,6 +1105,12 @@ class AppState:
1109
1105
  Returns:
1110
1106
  (asyncio.subprocess.Process | psutil.Process): If process creation is successful, else return None.
1111
1107
  """
1108
+ # If there's no matlab_cmd available, it means that MATLAB is not available on system PATH.
1109
+ if not self.settings["matlab_cmd"]:
1110
+ raise MatlabInstallError(
1111
+ "Unable to find MATLAB on the system PATH. Add MATLAB to the system PATH, and restart matlab-proxy."
1112
+ )
1113
+
1112
1114
  if system.is_posix():
1113
1115
  import pty
1114
1116
 
@@ -1328,7 +1330,14 @@ class AppState:
1328
1330
  # Start MATLAB Process
1329
1331
  logger.debug("Starting MATLAB")
1330
1332
 
1331
- matlab = await self.__start_matlab_process(matlab_env)
1333
+ try:
1334
+ matlab = await self.__start_matlab_process(matlab_env)
1335
+
1336
+ # If there's an error with starting MATLAB, set the error to the state and matlab to None
1337
+ except MatlabInstallError as err:
1338
+ log_error(logger, err)
1339
+ self.error = err
1340
+ matlab = None
1332
1341
 
1333
1342
  # Release the lock after MATLAB process has started.
1334
1343
  await self.matlab_state_updater_lock.release()
@@ -11,7 +11,7 @@
11
11
  <meta name="internal_mw_identifier" content="MWI_MATLAB_PROXY_IDENTIFIER" />
12
12
  <link rel="manifest" href="./manifest.json" />
13
13
  <title>MATLAB</title>
14
- <script type="module" crossorigin src="./static/js/index.Cm14Eqsb.js"></script>
14
+ <script type="module" crossorigin src="./static/js/index.c3NLxnRM.js"></script>
15
15
  <link rel="stylesheet" crossorigin href="./static/css/index.BSVLACuY.css">
16
16
  </head>
17
17
  <body>