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.
- class gemseo.wrappers.matlab.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.
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()
- Parameters
engine (gemseo.wrappers.matlab.engine.MatlabEngine) – The MatlabEngine instance.
- Return type
None
- 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
The list of matlab toolboxes. If
None
, use the already existing engine licenses.By default it is set to None.
pause_frac (float) –
The time used between each try to get licenses.
By default it is set to 60.
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
.By default it is set to 20.
- Return type
None
- start_parallel_computing(n_parallel_workers=4, cluster_name='local')[source]¶
Start parallel computing in MatlabEngine.
- CURVE_FIT_TOOL = 'Curve_Fitting_Toolbox'¶
- DISTRIB_COMP_TOOL = 'distrib_computing_toolbox'¶
- SIGNAL_TOOL = 'signal_toolbox'¶
- engine: gemseo.wrappers.matlab.engine.MatlabEngine¶
The MatlabEngine instance.
- property licenses¶
The licences.