|
13 | 13 | from requests.exceptions import HTTPError |
14 | 14 |
|
15 | 15 | from jupyter_matlab_kernel import mwi_comm_helpers |
| 16 | +from matlab_proxy import util as mwi_util |
| 17 | +from matlab_proxy import settings as mwi_settings |
| 18 | + |
| 19 | + |
| 20 | +_MATLAB_STARTUP_TIMEOUT = mwi_settings.get_process_startup_timeout() |
16 | 21 |
|
17 | 22 |
|
18 | 23 | class MATLABConnectionError(Exception): |
@@ -142,7 +147,7 @@ def start_matlab_proxy(): |
142 | 147 | # Thus we need to go one level higher to acquire the process id of the jupyter server. |
143 | 148 | # Note: conda environments do not require this, and for these environments sys.prefix == sys.base_prefix |
144 | 149 | is_virtual_env = sys.prefix != sys.base_prefix |
145 | | - if sys.platform == "win32" and is_virtual_env: |
| 150 | + if mwi_util.system.is_windows() and is_virtual_env: |
146 | 151 | jupyter_server_pid = psutil.Process(jupyter_server_pid).ppid() |
147 | 152 |
|
148 | 153 | nb_server = dict() |
@@ -465,10 +470,9 @@ def perform_startup_checks(self): |
465 | 470 |
|
466 | 471 | # Wait until MATLAB is started before sending requests. |
467 | 472 | timeout = 0 |
468 | | - MATLAB_STARTUP_MAX_TIMEOUT = 120 |
469 | 473 | while ( |
470 | 474 | self.matlab_status != "up" |
471 | | - and timeout != MATLAB_STARTUP_MAX_TIMEOUT |
| 475 | + and timeout != _MATLAB_STARTUP_TIMEOUT |
472 | 476 | and not self.matlab_proxy_has_error |
473 | 477 | ): |
474 | 478 | if self.is_matlab_licensed: |
@@ -496,7 +500,7 @@ def perform_startup_checks(self): |
496 | 500 | # If MATLAB is not available after 15 seconds of licensing information |
497 | 501 | # being available either through user input or through matlab-proxy cache, |
498 | 502 | # then display connection error to the user. |
499 | | - if timeout == MATLAB_STARTUP_MAX_TIMEOUT or self.matlab_proxy_has_error: |
| 503 | + if timeout == _MATLAB_STARTUP_TIMEOUT or self.matlab_proxy_has_error: |
500 | 504 | raise MATLABConnectionError |
501 | 505 |
|
502 | 506 | def display_output(self, out): |
|
0 commit comments