matlab-proxy 0.25.1__py3-none-any.whl → 0.27.0__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.py +68 -16
- matlab_proxy/app_state.py +8 -2
- matlab_proxy/constants.py +1 -0
- matlab_proxy/default_configuration.py +2 -2
- matlab_proxy/gui/index.html +1 -1
- matlab_proxy/gui/static/js/{index.CZgGkMCD.js → index.BcDShXfH.js} +16 -16
- matlab_proxy/settings.py +24 -2
- matlab_proxy/util/cookie_jar.py +72 -0
- matlab_proxy/util/list_servers.py +2 -2
- matlab_proxy/util/mwi/environment_variables.py +15 -0
- matlab_proxy/util/mwi/session_name.py +28 -0
- matlab_proxy/util/mwi/validators.py +2 -4
- {matlab_proxy-0.25.1.dist-info → matlab_proxy-0.27.0.dist-info}/METADATA +37 -23
- {matlab_proxy-0.25.1.dist-info → matlab_proxy-0.27.0.dist-info}/RECORD +29 -56
- {matlab_proxy-0.25.1.dist-info → matlab_proxy-0.27.0.dist-info}/WHEEL +1 -2
- matlab_proxy_manager/README.md +85 -0
- matlab_proxy_manager/lib/README.md +53 -0
- matlab_proxy_manager/lib/api.py +156 -114
- matlab_proxy_manager/storage/README.md +54 -0
- matlab_proxy_manager/storage/server.py +5 -2
- matlab_proxy_manager/utils/constants.py +2 -1
- matlab_proxy_manager/utils/environment_variables.py +6 -1
- matlab_proxy_manager/utils/exceptions.py +45 -0
- matlab_proxy_manager/utils/helpers.py +2 -2
- matlab_proxy_manager/utils/logger.py +4 -1
- matlab_proxy_manager/web/README.md +37 -0
- matlab_proxy_manager/web/app.py +71 -19
- matlab_proxy-0.25.1.dist-info/top_level.txt +0 -3
- tests/integration/__init__.py +0 -1
- tests/integration/integration_tests_with_license/__init__.py +0 -1
- tests/integration/integration_tests_with_license/conftest.py +0 -47
- tests/integration/integration_tests_with_license/test_http_end_points.py +0 -397
- tests/integration/integration_tests_without_license/__init__.py +0 -1
- tests/integration/integration_tests_without_license/conftest.py +0 -116
- tests/integration/integration_tests_without_license/test_matlab_is_down_if_unlicensed.py +0 -49
- tests/integration/utils/__init__.py +0 -1
- tests/integration/utils/integration_tests_utils.py +0 -352
- tests/integration/utils/licensing.py +0 -152
- tests/unit/__init__.py +0 -1
- tests/unit/conftest.py +0 -66
- tests/unit/test_app.py +0 -1200
- tests/unit/test_app_state.py +0 -1094
- tests/unit/test_constants.py +0 -7
- tests/unit/test_ddux.py +0 -22
- tests/unit/test_devel.py +0 -246
- tests/unit/test_non_dev_mode.py +0 -169
- tests/unit/test_settings.py +0 -659
- tests/unit/util/__init__.py +0 -3
- tests/unit/util/mwi/__init__.py +0 -1
- tests/unit/util/mwi/embedded_connector/__init__.py +0 -1
- tests/unit/util/mwi/embedded_connector/test_helpers.py +0 -29
- tests/unit/util/mwi/embedded_connector/test_request.py +0 -64
- tests/unit/util/mwi/test_custom_http_headers.py +0 -281
- tests/unit/util/mwi/test_download.py +0 -152
- tests/unit/util/mwi/test_logger.py +0 -82
- tests/unit/util/mwi/test_token_auth.py +0 -303
- tests/unit/util/mwi/test_validators.py +0 -364
- tests/unit/util/test_mw.py +0 -550
- tests/unit/util/test_util.py +0 -221
- tests/utils/__init__.py +0 -1
- tests/utils/logging_util.py +0 -81
- {matlab_proxy-0.25.1.dist-info → matlab_proxy-0.27.0.dist-info}/entry_points.txt +0 -0
- {matlab_proxy-0.25.1.dist-info → matlab_proxy-0.27.0.dist-info/licenses}/LICENSE.md +0 -0
matlab_proxy/settings.py
CHANGED
|
@@ -19,8 +19,9 @@ import matlab_proxy
|
|
|
19
19
|
from matlab_proxy import constants
|
|
20
20
|
from matlab_proxy.constants import MWI_AUTH_TOKEN_NAME_FOR_HTTP
|
|
21
21
|
from matlab_proxy.util import mwi, system
|
|
22
|
+
from matlab_proxy.util.cookie_jar import HttpOnlyCookieJar
|
|
22
23
|
from matlab_proxy.util.mwi import environment_variables as mwi_env
|
|
23
|
-
from matlab_proxy.util.mwi import token_auth
|
|
24
|
+
from matlab_proxy.util.mwi import token_auth, session_name
|
|
24
25
|
from matlab_proxy.util.mwi.exceptions import (
|
|
25
26
|
FatalError,
|
|
26
27
|
MatlabInstallError,
|
|
@@ -159,7 +160,7 @@ def get_mwi_config_folder(dev=False):
|
|
|
159
160
|
config_folder_path = config_folder_path / "hosts" / hostname
|
|
160
161
|
|
|
161
162
|
logger.debug(
|
|
162
|
-
f"{'Hostname could not be determined. ' if not hostname else ''
|
|
163
|
+
f"{'Hostname could not be determined. ' if not hostname else ''}Using the folder: {config_folder_path} for storing all matlab-proxy related session information"
|
|
163
164
|
)
|
|
164
165
|
|
|
165
166
|
return config_folder_path
|
|
@@ -220,6 +221,8 @@ def get_dev_settings(config):
|
|
|
220
221
|
"is_xvfb_available": False,
|
|
221
222
|
"is_windowmanager_available": False,
|
|
222
223
|
"mwi_idle_timeout": None,
|
|
224
|
+
"cookie_jar": _get_cookie_jar(),
|
|
225
|
+
"browser_title": session_name.get_browser_title("R2020b"),
|
|
223
226
|
}
|
|
224
227
|
|
|
225
228
|
|
|
@@ -321,6 +324,7 @@ def get_server_settings(config_name):
|
|
|
321
324
|
else f"{short_desc} - MATLAB Integration"
|
|
322
325
|
)
|
|
323
326
|
|
|
327
|
+
cookie_jar = _get_cookie_jar()
|
|
324
328
|
return {
|
|
325
329
|
"create_xvfb_cmd": create_xvfb_cmd,
|
|
326
330
|
"base_url": mwi.validators.validate_base_url(
|
|
@@ -359,6 +363,7 @@ def get_server_settings(config_name):
|
|
|
359
363
|
"mwi_idle_timeout": mwi.validators.validate_idle_timeout(
|
|
360
364
|
os.getenv(mwi_env.get_env_name_shutdown_on_idle_timeout())
|
|
361
365
|
),
|
|
366
|
+
"cookie_jar": cookie_jar,
|
|
362
367
|
}
|
|
363
368
|
|
|
364
369
|
|
|
@@ -401,6 +406,7 @@ def get_matlab_settings():
|
|
|
401
406
|
**mw_licensing_urls,
|
|
402
407
|
"nlm_conn_str": nlm_conn_str,
|
|
403
408
|
"has_custom_code_to_execute": has_custom_code_to_execute,
|
|
409
|
+
"browser_title": session_name.get_browser_title(matlab_version),
|
|
404
410
|
}
|
|
405
411
|
|
|
406
412
|
|
|
@@ -700,3 +706,19 @@ def _get_matlab_cmd(matlab_executable_path, code_to_execute, nlm_conn_str):
|
|
|
700
706
|
"-r",
|
|
701
707
|
code_to_execute,
|
|
702
708
|
]
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
def _get_cookie_jar():
|
|
712
|
+
"""Returns an instance of HttpOnly cookie jar if MWI_USE_COOKIE_CACHE environment variable is set to True
|
|
713
|
+
|
|
714
|
+
Returns:
|
|
715
|
+
HttpOnlyCookieJar: An instance of HttpOnly cookie jar if MWI_USE_COOKIE_CACHE environment variable is set to True, otherwise None.
|
|
716
|
+
"""
|
|
717
|
+
cookie_jar = None
|
|
718
|
+
if mwi_env.Experimental.should_use_cookie_cache():
|
|
719
|
+
logger.info(
|
|
720
|
+
f"Environment variable {mwi_env.Experimental.get_env_name_use_cookie_cache()} is set. matlab-proxy server will cache cookies from MATLAB"
|
|
721
|
+
)
|
|
722
|
+
cookie_jar = HttpOnlyCookieJar()
|
|
723
|
+
|
|
724
|
+
return cookie_jar
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Copyright 2025 The MathWorks, Inc.
|
|
2
|
+
|
|
3
|
+
from http.cookies import Morsel, SimpleCookie
|
|
4
|
+
from typing import Dict
|
|
5
|
+
|
|
6
|
+
from matlab_proxy.util import mwi
|
|
7
|
+
|
|
8
|
+
logger = mwi.logger.get()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# For more information about HttpOnly attribute
|
|
12
|
+
# of a cookie, check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie#httponly
|
|
13
|
+
class HttpOnlyCookieJar:
|
|
14
|
+
"""
|
|
15
|
+
A lightweight, HttpOnly, in-memory cookie store.
|
|
16
|
+
|
|
17
|
+
Its sole responsibility is to parse and store 'Set-Cookie' headers as Morsel objects and
|
|
18
|
+
store them in the cookie-jar only if they are marked as HttpOnly.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __init__(self):
|
|
22
|
+
self._cookie_jar: Dict[str, Morsel] = {}
|
|
23
|
+
logger.debug("Cookie Jar Initialized")
|
|
24
|
+
|
|
25
|
+
def _get_cookie_name(self, cookie: SimpleCookie) -> str:
|
|
26
|
+
"""
|
|
27
|
+
Returns the name of the cookie.
|
|
28
|
+
"""
|
|
29
|
+
return list(cookie.keys())[0]
|
|
30
|
+
|
|
31
|
+
def update_from_response_headers(self, headers) -> None:
|
|
32
|
+
"""
|
|
33
|
+
Parses 'Set-Cookie' headers from a response and stores the resulting
|
|
34
|
+
cookie objects (Morsels) only if they are HttpOnly cookies.
|
|
35
|
+
"""
|
|
36
|
+
for set_cookie_val in headers.getall("Set-Cookie", []):
|
|
37
|
+
cookie = SimpleCookie()
|
|
38
|
+
cookie.load(set_cookie_val)
|
|
39
|
+
cookie_name = self._get_cookie_name(cookie)
|
|
40
|
+
morsel = cookie[cookie_name]
|
|
41
|
+
|
|
42
|
+
if morsel["httponly"]:
|
|
43
|
+
self._cookie_jar[cookie_name] = morsel
|
|
44
|
+
logger.debug(
|
|
45
|
+
f"Stored cookie object for key '{cookie_name}'. Value: '{cookie[cookie_name]}'"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
else:
|
|
49
|
+
logger.warning(
|
|
50
|
+
f"Cookie {cookie_name} is not a HttpOnly cookie. Skipping it."
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
def get_cookies(self):
|
|
54
|
+
"""
|
|
55
|
+
Returns a copy of the internal dictionary of stored cookie Morsels.
|
|
56
|
+
"""
|
|
57
|
+
return list(self._cookie_jar.values())
|
|
58
|
+
|
|
59
|
+
def get_dict(self) -> Dict[str, str]:
|
|
60
|
+
"""
|
|
61
|
+
Returns the stored cookies as a simple dictionary of name-to-value strings,
|
|
62
|
+
which is compatible with aiohttp's 'LooseCookies' type.
|
|
63
|
+
"""
|
|
64
|
+
loose_cookies = {
|
|
65
|
+
name: morsel.value for name, morsel in self._cookie_jar.items()
|
|
66
|
+
}
|
|
67
|
+
return loose_cookies
|
|
68
|
+
|
|
69
|
+
def clear(self):
|
|
70
|
+
"""Clears all stored cookies."""
|
|
71
|
+
logger.info("Cookie Jar Cleared")
|
|
72
|
+
self._cookie_jar.clear()
|
|
@@ -31,8 +31,8 @@ def print_server_info():
|
|
|
31
31
|
for server in search_results:
|
|
32
32
|
server_number += 1
|
|
33
33
|
with open(server) as f:
|
|
34
|
-
server_info = f.
|
|
35
|
-
print_output += str(server_number) + ". " + str(server_info)
|
|
34
|
+
server_info = f.readline().strip()
|
|
35
|
+
print_output += str(server_number) + ". " + str(server_info) + "\n"
|
|
36
36
|
|
|
37
37
|
print_output += str(
|
|
38
38
|
mwi_util.prettify(
|
|
@@ -172,6 +172,11 @@ def get_env_name_shutdown_on_idle_timeout():
|
|
|
172
172
|
return "MWI_SHUTDOWN_ON_IDLE_TIMEOUT"
|
|
173
173
|
|
|
174
174
|
|
|
175
|
+
def get_env_name_session_name():
|
|
176
|
+
"""User specified session name for the MATLAB Proxy instance, used to set the browser title."""
|
|
177
|
+
return "MWI_SESSION_NAME"
|
|
178
|
+
|
|
179
|
+
|
|
175
180
|
class Experimental:
|
|
176
181
|
"""This class houses functions which are undocumented APIs and Environment variables.
|
|
177
182
|
Note: Never add any state to this class. Its only intended for use as an abstraction layer
|
|
@@ -198,3 +203,13 @@ class Experimental:
|
|
|
198
203
|
def is_matlab_startup_profiling_enabled():
|
|
199
204
|
"""Returns true if the startup profiling is enabled."""
|
|
200
205
|
return _is_env_set_to_true(Experimental.get_env_name_profile_matlab_startup())
|
|
206
|
+
|
|
207
|
+
@staticmethod
|
|
208
|
+
def get_env_name_use_cookie_cache():
|
|
209
|
+
"""Returns the environment variable name used to enable cookie jar support for matlab-proxy"""
|
|
210
|
+
return "MWI_USE_COOKIE_CACHE"
|
|
211
|
+
|
|
212
|
+
@staticmethod
|
|
213
|
+
def should_use_cookie_cache():
|
|
214
|
+
"""Returns true if the cookie jar support is enabled."""
|
|
215
|
+
return _is_env_set_to_true(Experimental.get_env_name_use_cookie_cache())
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Copyright 2025 The MathWorks, Inc.
|
|
2
|
+
"""This file provides functions to set a session name for the MATLAB Proxy instance."""
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
from matlab_proxy.util.mwi import environment_variables as mwi_env
|
|
6
|
+
from matlab_proxy.util.mwi import logger as mwi_logger
|
|
7
|
+
|
|
8
|
+
logger = mwi_logger.get()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _get_session_name():
|
|
12
|
+
"""Get the session name for the MATLAB Proxy instance.
|
|
13
|
+
|
|
14
|
+
Returns:
|
|
15
|
+
str: returns the user-defined session name if set, otherwise returns None.
|
|
16
|
+
"""
|
|
17
|
+
return os.getenv(mwi_env.get_env_name_session_name(), None)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def get_browser_title(matlab_version) -> str:
|
|
21
|
+
"""Get the browser title for the MATLAB Proxy instance."""
|
|
22
|
+
|
|
23
|
+
browser_title = "MATLAB " + (matlab_version or "")
|
|
24
|
+
session_name = _get_session_name()
|
|
25
|
+
if session_name:
|
|
26
|
+
browser_title = session_name + " - " + browser_title
|
|
27
|
+
logger.info("Session Name set to : %s", session_name)
|
|
28
|
+
return browser_title
|
|
@@ -214,11 +214,9 @@ def __get_configs():
|
|
|
214
214
|
Dict: Contains all the values present in 'matlab_web_desktop_configs' entry_point from all the packages
|
|
215
215
|
installed in the current environment.
|
|
216
216
|
"""
|
|
217
|
-
import importlib_metadata
|
|
217
|
+
import importlib_metadata as metadata
|
|
218
218
|
|
|
219
|
-
matlab_proxy_eps =
|
|
220
|
-
group=matlab_proxy.get_entrypoint_name()
|
|
221
|
-
)
|
|
219
|
+
matlab_proxy_eps = metadata.entry_points(group=matlab_proxy.get_entrypoint_name())
|
|
222
220
|
configs = {}
|
|
223
221
|
for entry_point in matlab_proxy_eps:
|
|
224
222
|
configs[entry_point.name.lower()] = entry_point.load()
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: matlab-proxy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.27.0
|
|
4
4
|
Summary: Python® package enables you to launch MATLAB® and access it from a web browser.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
Project-URL: Homepage, https://github.com/mathworks/matlab-proxy/
|
|
6
|
+
Project-URL: Documentation, https://github.com/mathworks/matlab-proxy/blob/main/README.md
|
|
7
|
+
Project-URL: Issues, https://github.com/mathworks/matlab-proxy/issues
|
|
8
|
+
Author-email: "The MathWorks Inc." <cloud@mathworks.com>
|
|
9
|
+
License-Expression: LicenseRef-MATHWORKS-CLOUD-REFERENCE-ARCHITECTURE-LICENSE
|
|
10
|
+
License-File: LICENSE.md
|
|
11
|
+
Keywords: MATLAB,MATLAB Javascript Desktop,MATLAB Proxy,MATLAB Web Desktop,Proxy,Remote MATLAB Web Access
|
|
10
12
|
Classifier: Intended Audience :: Developers
|
|
11
13
|
Classifier: Natural Language :: English
|
|
12
14
|
Classifier: Programming Language :: Python
|
|
@@ -14,28 +16,40 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
14
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
15
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
-
Requires-Python:
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
License-File: LICENSE.md
|
|
20
|
-
Requires-Dist: aiohttp>=3.7.4
|
|
19
|
+
Requires-Python: >=3.8
|
|
21
20
|
Requires-Dist: aiohttp-session[secure]
|
|
21
|
+
Requires-Dist: aiohttp>=3.7.4
|
|
22
22
|
Requires-Dist: importlib-metadata
|
|
23
23
|
Requires-Dist: importlib-resources
|
|
24
24
|
Requires-Dist: psutil
|
|
25
|
-
Requires-Dist: watchdog
|
|
26
25
|
Requires-Dist: requests
|
|
26
|
+
Requires-Dist: watchdog
|
|
27
27
|
Provides-Extra: dev
|
|
28
|
-
Requires-Dist: aiohttp-devtools; extra ==
|
|
29
|
-
Requires-Dist: black; extra ==
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
Requires-Dist: pytest
|
|
32
|
-
Requires-Dist: pytest-
|
|
33
|
-
Requires-Dist: pytest-
|
|
34
|
-
Requires-Dist: pytest-
|
|
35
|
-
Requires-Dist: pytest-
|
|
36
|
-
Requires-Dist:
|
|
37
|
-
Requires-Dist:
|
|
38
|
-
Requires-Dist: pytest-
|
|
28
|
+
Requires-Dist: aiohttp-devtools; extra == 'dev'
|
|
29
|
+
Requires-Dist: black; extra == 'dev'
|
|
30
|
+
Requires-Dist: psutil; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest-aiohttp; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest-asyncio==0.24.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest-env; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest-mock; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest-playwright; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest-timeout; extra == 'dev'
|
|
39
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
40
|
+
Requires-Dist: urllib3; extra == 'dev'
|
|
41
|
+
Provides-Extra: test
|
|
42
|
+
Requires-Dist: psutil; extra == 'test'
|
|
43
|
+
Requires-Dist: pytest; extra == 'test'
|
|
44
|
+
Requires-Dist: pytest-aiohttp; extra == 'test'
|
|
45
|
+
Requires-Dist: pytest-asyncio==0.24.0; extra == 'test'
|
|
46
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
47
|
+
Requires-Dist: pytest-env; extra == 'test'
|
|
48
|
+
Requires-Dist: pytest-mock; extra == 'test'
|
|
49
|
+
Requires-Dist: pytest-playwright; extra == 'test'
|
|
50
|
+
Requires-Dist: pytest-timeout; extra == 'test'
|
|
51
|
+
Requires-Dist: urllib3; extra == 'test'
|
|
52
|
+
Description-Content-Type: text/markdown
|
|
39
53
|
|
|
40
54
|
# MATLAB Proxy
|
|
41
55
|
[](https://github.com/mathworks/matlab-proxy/actions) [](https://pypi.python.org/pypi/matlab-proxy) [](https://codecov.io/gh/mathworks/matlab-proxy) [](https://pepy.tech/project/matlab-proxy)
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
matlab_proxy/__init__.py,sha256=6cwi8buKCMtw9OeWaOYUHEoqwl5MyJ_s6GxgNuqPuNg,1673
|
|
2
|
-
matlab_proxy/app.py,sha256
|
|
3
|
-
matlab_proxy/app_state.py,sha256=
|
|
4
|
-
matlab_proxy/constants.py,sha256=
|
|
5
|
-
matlab_proxy/default_configuration.py,sha256=
|
|
2
|
+
matlab_proxy/app.py,sha256=QPBSPDneHvqH7T6NHN-bGxluEjHS-fkYGDC0TVDZKvE,37490
|
|
3
|
+
matlab_proxy/app_state.py,sha256=oijVEr2iBSu1bf-Pc7Mr8-mVFsPDqE81xkDrOcwN504,73559
|
|
4
|
+
matlab_proxy/constants.py,sha256=gYpS3mls1i3cO4eExbqQO-z_h8QIWTkM9h2S_EAMWSU,1257
|
|
5
|
+
matlab_proxy/default_configuration.py,sha256=7xjsCzma4c6u0rEzio8xhHaDRy0wY2xtGXuARY2v0hc,1881
|
|
6
6
|
matlab_proxy/devel.py,sha256=nR6XPVBUEdQ-RZGtYvX1YHTp8gj9cuw5Hp8ahasMBc8,14310
|
|
7
|
-
matlab_proxy/settings.py,sha256=
|
|
7
|
+
matlab_proxy/settings.py,sha256=yKnjprDNml-wO4Ae-6MiGa9EG1NIzvh-HaCGu-loQBg,29480
|
|
8
8
|
matlab_proxy/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
matlab_proxy/gui/favicon.ico,sha256=7w7Ki1uQP2Rgwc64dOV4-NrTu97I3WsZw8OvRSoY1A0,130876
|
|
10
|
-
matlab_proxy/gui/index.html,sha256=
|
|
10
|
+
matlab_proxy/gui/index.html,sha256=DsOZs5RaM72cflhcqV8UUZ8NwS09JlcZG-zlN5XfUcE,720
|
|
11
11
|
matlab_proxy/gui/manifest.json,sha256=NwDbrALM5auYyj2bbEf4aGwAUDqNl1FzMFQpPiG2Ty4,286
|
|
12
12
|
matlab_proxy/gui/robots.txt,sha256=kNJLw79pisHhc3OVAimMzKcq3x9WT6sF9IS4xI0crdI,67
|
|
13
13
|
matlab_proxy/gui/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
matlab_proxy/gui/static/css/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
matlab_proxy/gui/static/css/index.BSVLACuY.css,sha256=LzuRvV10Z0pF0ugGSnj5zKJvT4AHwwBbCd-wSH4mHjg,305333
|
|
16
16
|
matlab_proxy/gui/static/js/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
-
matlab_proxy/gui/static/js/index.
|
|
17
|
+
matlab_proxy/gui/static/js/index.BcDShXfH.js,sha256=9_MsXzl9doo6Lniy_MxwMZe3VlJGepCDsdJ_3mxsKQk,280073
|
|
18
18
|
matlab_proxy/gui/static/media/MATLAB-env-blur.NupTbPv_.png,sha256=QpmQTLDvBu2-b7ev83Rvpt0Q72R6wdQGkuJMPPpjv7M,220290
|
|
19
19
|
matlab_proxy/gui/static/media/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
matlab_proxy/gui/static/media/glyphicons-halflings-regular.BKjkU69z.woff,sha256=omOU9-3hAMoRjv8u2ghZYnWpg5uVnCJuFUOVV6WoB0I,23424
|
|
@@ -40,75 +40,48 @@ matlab_proxy/icons/matlab.svg,sha256=xh5uYebQd8I-ISvenjU9A-PkClzW_lU9wvm3doXOFKM
|
|
|
40
40
|
matlab_proxy/matlab/evaluateUserMatlabCode.m,sha256=R8w6nPdGtadR4UUFJaspcrGQL7cJwUItdrfc531w3bM,2420
|
|
41
41
|
matlab_proxy/matlab/startup.m,sha256=UcA4i2lAMytwBsO783uPIQoP5Pzw1R0xrUywbBBtTjw,533
|
|
42
42
|
matlab_proxy/util/__init__.py,sha256=JkVIsTOae5giDK0cQ7jcxQSHa8zo1umdq-1C0grDZwk,11712
|
|
43
|
+
matlab_proxy/util/cookie_jar.py,sha256=GceKyB53lTX5r2wp9myvf0JDWDfvSamvjb4zmjkoOtY,2401
|
|
43
44
|
matlab_proxy/util/event_loop.py,sha256=sX_0tKlirCY5ImLxkss_XO4Ksj65u6JHtwMj25oGL94,1816
|
|
44
|
-
matlab_proxy/util/list_servers.py,sha256=
|
|
45
|
+
matlab_proxy/util/list_servers.py,sha256=vdagTACoNM9zxJHeagAF7EbQNV-BjFsinf4JSX8H3SE,1388
|
|
45
46
|
matlab_proxy/util/mw.py,sha256=dLGSdfcTZiwKR1MMZA-39o-8na13IEPZOGBqcaHmKVI,11086
|
|
46
47
|
matlab_proxy/util/system.py,sha256=XoT3Rv5MwPkdfhk2oMvUwxxlzZmADMlxzi9IRQyGgbA,1692
|
|
47
48
|
matlab_proxy/util/windows.py,sha256=_5gl2IyHIfw8-D3_G5uHkycZVGGFVXtjkd6_aP3g2Ts,3785
|
|
48
49
|
matlab_proxy/util/mwi/__init__.py,sha256=zI-X1lafr8H3j17PyA0oSZ0q5nINfK-WDA7VmJKmSAQ,158
|
|
49
50
|
matlab_proxy/util/mwi/custom_http_headers.py,sha256=kfDjSnEXEVzoF2pZuEn76LKayeD2WKoQEDu2Y9EMOAo,7154
|
|
50
51
|
matlab_proxy/util/mwi/download.py,sha256=-GJj3yOsL4vF_9baqRXkgBI-vu_OwjZMQVkJXFS8GMc,4965
|
|
51
|
-
matlab_proxy/util/mwi/environment_variables.py,sha256=
|
|
52
|
+
matlab_proxy/util/mwi/environment_variables.py,sha256=1toY2D1vybmNin0jq-vhx86B2bXAUpb5Njw0soyaiTQ,7134
|
|
52
53
|
matlab_proxy/util/mwi/exceptions.py,sha256=8o4PZmira_ZonnOROzu8ERIiSn9y-456JO89gqjCags,5446
|
|
53
54
|
matlab_proxy/util/mwi/logger.py,sha256=GoisSphy3Jyi5-6-X0WRl1YkdrKx2xzjSxBN_w3oTU8,3802
|
|
55
|
+
matlab_proxy/util/mwi/session_name.py,sha256=HQAGMlJo6KMb2f9MBcavni48nw9H-cHWMeJKmXxpeys,915
|
|
54
56
|
matlab_proxy/util/mwi/token_auth.py,sha256=UbIWqo7qADaZdijFvorLYsZbxzaB8TycGP8nk305ru0,9997
|
|
55
|
-
matlab_proxy/util/mwi/validators.py,sha256=
|
|
57
|
+
matlab_proxy/util/mwi/validators.py,sha256=tofVI81DT0KinxZ99XeN96ybkwz-6Lt-e-tN7PXkolk,13235
|
|
56
58
|
matlab_proxy/util/mwi/embedded_connector/__init__.py,sha256=Vfl2hNC7V1IwoK9_wrwfENs4BC8P-Mvvqh4BNGi2n48,119
|
|
57
59
|
matlab_proxy/util/mwi/embedded_connector/helpers.py,sha256=kpIgJN0AqYLeX56UylWgB0t07fg8sh0RhIlUH_8JitM,3654
|
|
58
60
|
matlab_proxy/util/mwi/embedded_connector/request.py,sha256=RXoVvrm5fibVb2A6EZnkMWwAQkYX3J5kqDTGQDZo9p0,4316
|
|
61
|
+
matlab_proxy_manager/README.md,sha256=7F9KyrilUWhPH5qZtKHB_6iZK5cVRuccJr0LroP1hXo,3431
|
|
59
62
|
matlab_proxy_manager/__init__.py,sha256=CMqm2aSYUWo5sxV3vyqWudrQU31muouSqZRDesJNJSA,178
|
|
63
|
+
matlab_proxy_manager/lib/README.md,sha256=233q4O0NzLzeOTWsCrHIboU-i-NAMb-SBq5SBMDwyhk,2193
|
|
60
64
|
matlab_proxy_manager/lib/__init__.py,sha256=KfwQxxM5a1kMRtNbhz8tb7YfHp8e2d0tNLB55wYvDS8,37
|
|
61
|
-
matlab_proxy_manager/lib/api.py,sha256=
|
|
65
|
+
matlab_proxy_manager/lib/api.py,sha256=rDnxA599DZI73TUBSn8JPCbmKM_kn_T_J0dw0z4Kg5M,14380
|
|
66
|
+
matlab_proxy_manager/storage/README.md,sha256=OmToUE1lD7evUtmg0yCc9oHlqg5mN4rzmePfHwuXYC0,2106
|
|
62
67
|
matlab_proxy_manager/storage/__init__.py,sha256=KfwQxxM5a1kMRtNbhz8tb7YfHp8e2d0tNLB55wYvDS8,37
|
|
63
68
|
matlab_proxy_manager/storage/file_repository.py,sha256=U4FAw0zFN9z7YNlaMsYZXWm5ccs3rp3bzZL-W2BNhxA,5187
|
|
64
69
|
matlab_proxy_manager/storage/interface.py,sha256=pnRRD0Ku3gzbruAOM3J3NI2Kk8do3-_yRw9Pag1IqnE,1883
|
|
65
|
-
matlab_proxy_manager/storage/server.py,sha256=
|
|
70
|
+
matlab_proxy_manager/storage/server.py,sha256=DuYl9Q-gYA71WElBHcKMd1N5LW5k_Ey0PGABuLAQrgM,6150
|
|
66
71
|
matlab_proxy_manager/utils/__init__.py,sha256=KfwQxxM5a1kMRtNbhz8tb7YfHp8e2d0tNLB55wYvDS8,37
|
|
67
72
|
matlab_proxy_manager/utils/auth.py,sha256=60vi16eQ7LWp3I4CNv2easTjObw50irEm518fiMA5YI,2526
|
|
68
|
-
matlab_proxy_manager/utils/constants.py,sha256=
|
|
69
|
-
matlab_proxy_manager/utils/environment_variables.py,sha256=
|
|
70
|
-
matlab_proxy_manager/utils/
|
|
71
|
-
matlab_proxy_manager/utils/
|
|
73
|
+
matlab_proxy_manager/utils/constants.py,sha256=jI6g31m7xt9DFoe5Qj2Axb3lz6O_wTBvRqHz8RnUKKA,226
|
|
74
|
+
matlab_proxy_manager/utils/environment_variables.py,sha256=A1E4RfSR21vWlWuoFy0JrRXbNsDtmlXI2tRqJT8jzcc,1612
|
|
75
|
+
matlab_proxy_manager/utils/exceptions.py,sha256=t_LykVJx7A4M-G6vg43PgzK7u7zE8i1c6aMhLSpqQOQ,1217
|
|
76
|
+
matlab_proxy_manager/utils/helpers.py,sha256=_BH4qvJwfJYdfdv0I6dbugQjNJ_wxnUsfD5OrsPvCCM,9989
|
|
77
|
+
matlab_proxy_manager/utils/logger.py,sha256=HCQNjF0rHbDBvKhMBxGWs-FVH_GLTUDKIyXDqzLMAzc,1986
|
|
78
|
+
matlab_proxy_manager/web/README.md,sha256=_RADHyuBhVZiZmHV7vKXkKkxyh9c-z-rzxr67pssxQI,2578
|
|
72
79
|
matlab_proxy_manager/web/__init__.py,sha256=KfwQxxM5a1kMRtNbhz8tb7YfHp8e2d0tNLB55wYvDS8,37
|
|
73
|
-
matlab_proxy_manager/web/app.py,sha256
|
|
80
|
+
matlab_proxy_manager/web/app.py,sha256=-sfeJ4ltvcT1-8m0rOZkn357XQTSSNSPIUb3fidT71Y,20643
|
|
74
81
|
matlab_proxy_manager/web/monitor.py,sha256=PWkwV0kP3XHCxDRHpurPh74Zg-SgaIXnCnX2xZSW_R8,1541
|
|
75
82
|
matlab_proxy_manager/web/watcher.py,sha256=89JHjBAQtOrllstaJFxqrjHwckpRmu3qfUqeqPLmH2Q,2130
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
tests/integration/integration_tests_without_license/conftest.py,sha256=n-oppKWxavyy1O0J6DywO3DnOHuYc7yUZRXm3Bt4szU,3526
|
|
82
|
-
tests/integration/integration_tests_without_license/test_matlab_is_down_if_unlicensed.py,sha256=tkdyhfZBpfJpbnEzjURyV-GE0p43YxOa9xooJf-JoM4,1653
|
|
83
|
-
tests/integration/utils/__init__.py,sha256=ttzJ8xKWGxOJZz56qOiWOn6sp5LGomkZMn_w4KJLRMU,42
|
|
84
|
-
tests/integration/utils/integration_tests_utils.py,sha256=IbJ9CedFHiz3k85FBY-8GwotTnjPF3jF4AHdKio7jqk,10321
|
|
85
|
-
tests/integration/utils/licensing.py,sha256=rEBjvMXO8R3mL6KnePu2lojmOsjD4GXl9frf9N0Wacs,4842
|
|
86
|
-
tests/unit/__init__.py,sha256=KfwQxxM5a1kMRtNbhz8tb7YfHp8e2d0tNLB55wYvDS8,37
|
|
87
|
-
tests/unit/conftest.py,sha256=FIL7bhw2-9B5OEspqt9toZ2ZlN18pOsPEFjeQmVNcSk,1916
|
|
88
|
-
tests/unit/test_app.py,sha256=VZt64uhdhsdmZL3Pb9LGtxxgt0H18mzRZRzSyiud6nQ,40028
|
|
89
|
-
tests/unit/test_app_state.py,sha256=ZhywxbZb9HCxLQjgW1QEHccaydCeGKX20YOFFjpKWYM,38047
|
|
90
|
-
tests/unit/test_constants.py,sha256=2nXxTmDP8utr8krsfZ4c_Bh4_mWPcDO5uI8MXeq4Usg,158
|
|
91
|
-
tests/unit/test_ddux.py,sha256=a2J2iM8j_nnfJVuMI38p5AjwrRdoMj3N88gFgS2I4hg,713
|
|
92
|
-
tests/unit/test_devel.py,sha256=A-1iVhSSwmywaW65QIRcUS2Fk7nJxceCcCm7CJtNdEc,7982
|
|
93
|
-
tests/unit/test_non_dev_mode.py,sha256=Jqs5W-ax6WNM9v5SeTjpmVsojjA95itPC8Lqhs2U3Oc,5533
|
|
94
|
-
tests/unit/test_settings.py,sha256=CZDopczxa7zMC1LIpRckwnG4v2Ag4RBLqPE1TaypNYM,23271
|
|
95
|
-
tests/unit/util/__init__.py,sha256=GInSQBb2SoVD5LZfmSCQa9-UZJT_UP-jNfrojkgCybU,87
|
|
96
|
-
tests/unit/util/test_mw.py,sha256=hweBw3ijcdh_2QdECjAWNkmh_7P5Df728cgD51DFkT8,18571
|
|
97
|
-
tests/unit/util/test_util.py,sha256=n-xSkwdqXfq550jWYsmjhGjx6L98URhWeLJLKhGekOw,7476
|
|
98
|
-
tests/unit/util/mwi/__init__.py,sha256=pl5jqyCHEwZEviiL8OC-SHulb1rBecstQCFF6qVjL9Y,37
|
|
99
|
-
tests/unit/util/mwi/test_custom_http_headers.py,sha256=UfrhclS0j6WhShtg1ki2oF1kK8JqRC29uevH4tuDqF4,11182
|
|
100
|
-
tests/unit/util/mwi/test_download.py,sha256=jYwPJFYGrPKqnkIJW42XYSe1fowmzChAkOx0k0xVldo,4779
|
|
101
|
-
tests/unit/util/mwi/test_logger.py,sha256=S0Q5TirFxysrH2YSxRzGY9mWoWB83hG3q3XpGENCpcw,3150
|
|
102
|
-
tests/unit/util/mwi/test_token_auth.py,sha256=0gp41Y7zZFqeFDCA0V3Arv_CqnQKo5RZqijIccvezYM,10562
|
|
103
|
-
tests/unit/util/mwi/test_validators.py,sha256=GvLP3lSvoOQAjoclYunKPfxPIagUsnVGHRskHELResE,11765
|
|
104
|
-
tests/unit/util/mwi/embedded_connector/__init__.py,sha256=pl5jqyCHEwZEviiL8OC-SHulb1rBecstQCFF6qVjL9Y,37
|
|
105
|
-
tests/unit/util/mwi/embedded_connector/test_helpers.py,sha256=vYTWNUTuDeaygo16JGMTvWeI_CLOnvPkwNJmLndvJhE,890
|
|
106
|
-
tests/unit/util/mwi/embedded_connector/test_request.py,sha256=PR-jddnXDEiip-lD7A_QSvRwEkwo3eQ8owZlk-r9vnk,1867
|
|
107
|
-
tests/utils/__init__.py,sha256=ttzJ8xKWGxOJZz56qOiWOn6sp5LGomkZMn_w4KJLRMU,42
|
|
108
|
-
tests/utils/logging_util.py,sha256=VBy_NRvwau3C_CVTBjK5RMROrQimnJYHO2U0aKSZiRw,2234
|
|
109
|
-
matlab_proxy-0.25.1.dist-info/LICENSE.md,sha256=oF0h3UdSF-rlUiMGYwi086ZHqelzz7yOOk9HFDv9ELo,2344
|
|
110
|
-
matlab_proxy-0.25.1.dist-info/METADATA,sha256=TGXteKmTuOYE0iJL7VSG16c4522mPBGBqcpX7bRMwuU,10576
|
|
111
|
-
matlab_proxy-0.25.1.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
112
|
-
matlab_proxy-0.25.1.dist-info/entry_points.txt,sha256=3wztwXpt6wdGfTwscc4qHbCeWzi0E2XhyJbMDndyQKc,304
|
|
113
|
-
matlab_proxy-0.25.1.dist-info/top_level.txt,sha256=KF-347aoRGsfHTpiSqfIPUZ95bzK5-oMIu8S_TUcu-w,40
|
|
114
|
-
matlab_proxy-0.25.1.dist-info/RECORD,,
|
|
83
|
+
matlab_proxy-0.27.0.dist-info/METADATA,sha256=80E3g1CABuNM_zS6w8lhzJ8IbkfzvM1Nny7pui82kO4,11323
|
|
84
|
+
matlab_proxy-0.27.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
85
|
+
matlab_proxy-0.27.0.dist-info/entry_points.txt,sha256=3wztwXpt6wdGfTwscc4qHbCeWzi0E2XhyJbMDndyQKc,304
|
|
86
|
+
matlab_proxy-0.27.0.dist-info/licenses/LICENSE.md,sha256=oF0h3UdSF-rlUiMGYwi086ZHqelzz7yOOk9HFDv9ELo,2344
|
|
87
|
+
matlab_proxy-0.27.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# MATLAB Proxy Manager
|
|
2
|
+
|
|
3
|
+
----
|
|
4
|
+
This README is intended for MathWorks® developers only.
|
|
5
|
+
`matlab-proxy-manager` is part of the `matlab-proxy` package and it helps in managing the lifecycle and proxying of MATLAB proxy processes.
|
|
6
|
+
|
|
7
|
+
It provides a seamless integration with Jupyter environments, allowing MATLAB to be accessed and controlled via a proxy.
|
|
8
|
+
|
|
9
|
+
Upon installation, this package introduces an executable `matlab-proxy-manager-app`, which is utilized by the Jupyter Server Proxy to initiate `matlab-proxy-manager`.
|
|
10
|
+
|
|
11
|
+
----
|
|
12
|
+
|
|
13
|
+
**Table of Contents**
|
|
14
|
+
- [Project Structure](#structure)
|
|
15
|
+
- [Installation](#installation)
|
|
16
|
+
- [PyPI](#pypi)
|
|
17
|
+
- [Building From Sources](#building-from-sources)
|
|
18
|
+
- [Usage](#usage)
|
|
19
|
+
- [Security](#security)
|
|
20
|
+
|
|
21
|
+
## Structure
|
|
22
|
+
`matlab-proxy-manager` is organized into several key sub-folders:
|
|
23
|
+
|
|
24
|
+
1. lib:
|
|
25
|
+
|
|
26
|
+
* This directory contains the library APIs that facilitate the invocation of MATLAB proxy processes. It supports API calls, enabling the MATLAB Kernel to manage proxy instances effectively. For detailed information, refer to the README within the lib folder.
|
|
27
|
+
|
|
28
|
+
2. storage:
|
|
29
|
+
* The file system serves as the source of truth for `matlab-proxy-manager`, storing metadata about each MATLAB proxy server in dedicated files. A new file is generated whenever a proxy instance is launched and is removed upon termination of the instance or deletion of the Kernel that initiated it.
|
|
30
|
+
|
|
31
|
+
3. web:
|
|
32
|
+
* This component handles proxy workflows through HTTP/WebSocket requests, which are part of the executable process spawned by clients using the `matlab-proxy-manager-app`. For specific requirements and constraints, consult the README located in the web folder.
|
|
33
|
+
|
|
34
|
+
4. utils:
|
|
35
|
+
* A collection of helper functions utilized across various parts of the project, ensuring modularity and code reuse.
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
### PyPI
|
|
40
|
+
`matlab-proxy-manager` is included in the `matlab-proxy` repository and can be easily installed from the Python Package Index:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
python -m pip install matlab-proxy
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Building From Sources
|
|
47
|
+
Building from sources requires Node.js® version 16 or higher. [Click here to install Node.js](https://nodejs.org/en/)
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/mathworks/matlab-proxy.git
|
|
51
|
+
|
|
52
|
+
cd matlab-proxy
|
|
53
|
+
|
|
54
|
+
python -m pip install .
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Installing the package creates an executable called `matlab-proxy-app`, which is placed onto your system PATH by `pip`, usually in: `$HOME/.local/bin/`
|
|
58
|
+
```bash
|
|
59
|
+
# Verify its presence on the PATH
|
|
60
|
+
which matlab-proxy-manager-app
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
`matlab-proxy-manager` can be deployed in two modes:
|
|
65
|
+
|
|
66
|
+
1. Library Mode: Import the relevant module within your client code to invoke public APIs directly.
|
|
67
|
+
|
|
68
|
+
Example:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import matlab_proxy_manager.lib.api as mpm_lib
|
|
72
|
+
response = await mpm_lib.start_matlab_proxy_for_kernel(...)
|
|
73
|
+
await mpm_lib.shutdown(...)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
2. Process Mode: This mode is primarily managed by Jupyter-Server-Proxy for proxy workflows involving web-based MATLAB desktop access.
|
|
77
|
+
|
|
78
|
+
## Security
|
|
79
|
+
Security is paramount in matlab-proxy-manager. Communication between the Kernel, proxy manager, and Jupyter Server Proxy is secured using authentication tokens. These tokens are mandatory for API invocations and proxy workflows. They are passed via environment variables when the proxy manager is initiated by the Jupyter Server Proxy and are included in the arguments during Kernel API calls.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
Copyright 2024 The MathWorks, Inc.
|
|
84
|
+
|
|
85
|
+
---
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# MATLAB Proxy Manager - Library
|
|
2
|
+
|
|
3
|
+
This README is intended for MathWorks® developers only.
|
|
4
|
+
`matlab-proxy-manager` module is designed to be flexible and robust, supporting both direct library calls and process-based workflows. The lib folder contains the code blocks providing the core library APIs that facilitate the management of MATLAB proxy instances.
|
|
5
|
+
|
|
6
|
+
# Key Features
|
|
7
|
+
## API Invocation:
|
|
8
|
+
|
|
9
|
+
The lib module allows for the invocation of MATLAB proxy processes through a well-defined set of APIs. These APIs are designed to be intuitive and easy to integrate into existing workflows, enabling developers to start, stop, and manage MATLAB proxy instances programmatically.
|
|
10
|
+
|
|
11
|
+
## Integration with MATLAB Kernel:
|
|
12
|
+
|
|
13
|
+
The APIs in the lib directory are used by the MATLAB Kernel to manage the lifecycle of MATLAB proxy instances. This includes starting new instances and shutting them down when they are no longer needed.
|
|
14
|
+
|
|
15
|
+
## Error Handling and Logging:
|
|
16
|
+
|
|
17
|
+
Comprehensive error handling mechanisms are in place to ensure that any issues encountered during the management of proxy instances are logged and reported. This aids in troubleshooting and ensures the reliability of the system.
|
|
18
|
+
|
|
19
|
+
Users are required to set `MWI_MPM_LOG_LEVEL` environment variable to their desired log level (`INFO`, `DEBUG` etc.) to enable logging in `matlab-proxy-manager`.
|
|
20
|
+
|
|
21
|
+
# Usage
|
|
22
|
+
To use the lib APIs, you can import the relevant module in your Python code and invoke the provided functions. Here’s a basic example of how you might start and stop a MATLAB proxy instance:
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
|
|
26
|
+
import matlab_proxy_manager.lib.api as mpm_lib
|
|
27
|
+
|
|
28
|
+
# Start a MATLAB proxy instance
|
|
29
|
+
response = await mpm_lib.start_matlab_proxy_for_kernel(
|
|
30
|
+
caller_id=self.kernel_id,
|
|
31
|
+
parent_id=self.parent_pid,
|
|
32
|
+
is_shared_matlab=True,
|
|
33
|
+
)
|
|
34
|
+
return (
|
|
35
|
+
response.get("absolute_url"),
|
|
36
|
+
response.get("mwi_base_url"),
|
|
37
|
+
response.get("headers"),
|
|
38
|
+
response.get("mpm_auth_token"),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# Perform operations with the MATLAB instance...
|
|
42
|
+
|
|
43
|
+
# Shut down the MATLAB proxy instance
|
|
44
|
+
await mpm_lib.shutdown(
|
|
45
|
+
self.parent_pid, self.kernel_id, self.mpm_auth_token
|
|
46
|
+
)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
Copyright 2024 The MathWorks, Inc.
|
|
52
|
+
|
|
53
|
+
---
|