Skip to content

Commit 1b86a5d

Browse files
author
Prabhakar Kumar
committed
Support Server triads - Network License Management
1 parent a76ec9d commit 1b86a5d

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![codecov](https://codecov.io/gh/mathworks/jupyter-matlab-proxy/branch/main/graph/badge.svg?token=ZW3SESKCSS)](https://codecov.io/gh/mathworks/jupyter-matlab-proxy)
55
The `jupyter-matlab-proxy` Python® package allows you to integrate MATLAB® with Jupyter®. The MATLAB integration for Jupyter enables you to open a MATLAB desktop in a web browser tab, directly from your Jupyter environment. This is not a kernel integration.
66

7-
The MATLAB Integration for Jupyter is under active development and you might find issues with the MATLAB graphical user interface. For support or to report issues, see the [Feedback](#feedback) section.
7+
The MATLAB Integration for Jupyter is under active development and you might find issues with the MATLAB graphical user interface. For support or to report issues, see the [Feedback](https://github.com/mathworks/jupyter-matlab-proxy#feedback) section.
88

99

1010
## Use the MATLAB Integration for Jupyter
@@ -19,7 +19,7 @@ Once you have a Jupyter environment with the `jupyter-matlab-proxy` package inst
1919
<img width="600" src="https://github.com/mathworks/jupyter-matlab-proxy/raw/main/img/combined_launchers.png">
2020
</p>
2121

22-
3. If prompted to do so, enter credentials for a MathWorks account associated with a MATLAB license. If you are using a network license manager, change to the _Network License Manager_ tab and enter the license server address instead. To determine the appropriate method for your license type, consult [MATLAB Licensing Info](./MATLAB-Licensing-Info.md).
22+
3. If prompted to do so, enter credentials for a MathWorks account associated with a MATLAB license. If you are using a network license manager, change to the _Network License Manager_ tab and enter the license server address instead. To determine the appropriate method for your license type, consult [MATLAB Licensing Info](https://github.com/mathworks/jupyter-matlab-proxy/blob/main/MATLAB-Licensing-Info.md).
2323

2424
<p align="center">
2525
<img width="400" src="https://github.com/mathworks/jupyter-matlab-proxy/raw/main/img/licensing_GUI.png">

gui/src/components/LicensingGatherer/NLM.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ import {
66
fetchSetLicensing
77
} from '../../actionCreators';
88

9-
const connStrRegex = /^\d+@(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$/
9+
// Regular expression to match port@hostname,
10+
// where port is any number and hostname is alphanumeric
11+
// Regex FOR
12+
// Start of Line, Any number of 0-9 digits , @, any number of nonwhite space characters with "- _ ." allowed, and EOL
13+
// IS:
14+
// ^[0-9]+[@](\w|\_|\-|\.)+$
15+
// Server triad is of the form : port@host1,port@host2,port@host3
16+
const connStrRegex = /^[\d]+@[\w|\-|\_|\.]+$|^[\d]+@[\w|\-|\_|\.]+,[\d]+@[\w|\-|\_|\.]+,[\d]+@[\w|\-|\_|\.]+$/
1017

1118
function validateInput(str) {
1219
return connStrRegex.test(str);

jupyter_matlab_proxy/util/mwi_validators.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ def validate_mlm_license_file(nlm_conn_str):
3434
# Regular expression to match port@hostname,
3535
# where port is any number and hostname is alphanumeric
3636
# regex = Start of Line, Any number of 0-9 digits , @, any number of nonwhite space characters with "- _ ." allowed
37-
regex = "^[0-9]+[@](\w|\_|\-|\.)+$"
37+
# "^[0-9]+[@](\w|\_|\-|\.)+$"
38+
# Server triad is of the form : port@host1,port@host2,port@host3
39+
regex = "(^[0-9]+[@](\w|\_|\-|\.)+$)|(^[0-9]+[@](\w|\_|\-|\.)+),([0-9]+[@](\w|\_|\-|\.)+),([0-9]+[@](\w|\_|\-|\.)+$)"
3840
if not re.search(regex, nlm_conn_str):
3941
logger.debug("NLM info is not in the form of port@hostname")
4042
if not os.path.isfile(nlm_conn_str):

tests/util/test_mwi_validators.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ def test_validate_mlm_license_file_for_valid_server_syntax(monkeypatch):
2929
assert conn_str == license_manager_address
3030

3131

32+
def test_validate_mlm_license_file_for_valid_server_triad_syntax(monkeypatch):
33+
"""Check if port@hostname passes validation"""
34+
env_name = mwi_env.get_env_name_network_license_manager()
35+
license_manager_address = (
36+
"[email protected]_any-alphanumeric,[email protected]_any-alphanumeric,[email protected]_any-alphanumeric"
37+
)
38+
monkeypatch.setenv(env_name, license_manager_address)
39+
conn_str = mwi_validators.validate_mlm_license_file(os.getenv(env_name))
40+
assert conn_str == license_manager_address
41+
42+
3243
def test_get_with_environment_variables(monkeypatch):
3344
"""Check if path to license file passes validation"""
3445
env_name = mwi_env.get_env_name_network_license_manager()

0 commit comments

Comments
 (0)