license_manager module¶
Definition of the Matlab license manager.
Overview¶
This module contains the LicenseManager
which enables to check the presence of any toolbox licenses
of the Matlab installation.
Classes:
|
Manage Matlab License. |
- class gemseo.wrappers.matlab.engine.license_manager.LicenseManager(engine)[source]¶
Bases:
object
Manage Matlab License.
The licenseManager was created to enables de-synchronised launch of optimization using matlab_discipline. The goal is to wait until all licenses that are needed are available in Matlab workspace. Parallel computing launch can be used with this tool.
- Attributes
engine – The MatlabEngine instance.
licenses – The list of license toolbox that must be used.
- Parameters
engine (__MatlabEngine) –
- Return type
None
Examples
>>> # Build a new matlab engine >>> eng = get_matlab_engine() >>> # add a toolbox to the engine >>> eng.add_toolbox("signal_toolbox") >>> # build a license manager from the previous engine >>> lm = LicenseManager(eng) >>> # check licenses of the engine until all are available >>> lm.check_licenses()
# noqa: D205,D212,D415 :param engine: The MatlabEngine instance.
Attributes:
Get and set all licences.
Methods:
check_licenses
([licenses, pause_frac, …])Check that the Matlab licenses exist.
Stop parallel computing in matlab engine.
Start parallel computing in MatlabEngine.
- CURVE_FIT_TOOL = 'Curve_Fitting_Toolbox'¶
- DISTRIB_COMP_TOOL = 'distrib_computing_toolbox'¶
- SIGNAL_TOOL = 'signal_toolbox'¶
- check_licenses(licenses=None, pause_frac=60, pause_const=20)[source]¶
Check that the Matlab licenses exist.
The method fetches all the needed licenses thanks to the matlab function licenseControl and the class Logger. Note that the MATLAB function will be looping until the given toolboxes are available.
- Parameters
licenses (Optional[list[str]]) – The list of matlab toolboxes. If
None
, use the already existing engine licenses.pause_frac (float) – The time used between each try to get licenses.
pause_const (float) – The time added in order to estimate the waiting time. The waiting time is estimated at each try with the following formula:
Wt = pause_const + random([0,1])*pause_frac
.
- Return type
None
- property licenses¶
Get and set all licences.
- start_parallel_computing(n_parallel_workers=4, cluster_name='local')[source]¶
Start parallel computing in MatlabEngine.
- Parameters
n_parallel_workers (int) – The number of “workers” to the parallel pool. Maximum number allowed is 12
cluster_name (str) – The matlab parallel pool cluster name. If None, the given name is the same as the engine.
- Return type
bool