MATLAB Answers

Force all licenses checks at beginning of code in Azure Server

2 views (last 30 days)
JackCrusoe47 on 13 Feb 2021
Commented: Walter Roberson on 14 Feb 2021
I have a few azure clusters running a heavy code that uses different tool boxes. But as the code progresses I get a 4402 license error some times at the very end of the code and basically loose all data (Unfortunatly most of the code is inside a function and thus as the code crashes the variables are lost too and I didnt implement a saving feature till the end). This bascially makes me loose compute costs.
4/3 times this does not happen. But for very large computations it seems risky.
What could be a good method to solve this?

Answers (1)

Raymond Norris
Raymond Norris on 14 Feb 2021
You can force a checkout for each toolbox with the license command
% [TF errmsg] = LICENSE('checkout', FEATURE) checks out a license for the
% product specified by the text string FEATURE, returning 1 if the
% license is checked out or 0 if the license could not be checked out. If
% you specify the optional second output argument, errmsg, LICENSE
% returns the text of any error message encountered, or an empty string
% if the checkout succeeded.
The tricky part is knowing the FEATURE name for each of the toolboxes you want. If you have access to a license file (which you might not if you're using onlinine licensing), you might be able to run the lmutil license utility. Might be easiest to contact Support ( for the FEATURE names for each toolboxes you want.
Loop through each toolbox and checkout the license at the top of your code.
  1 Comment
Walter Roberson
Walter Roberson on 14 Feb 2021
Most of the feature names are listed at . But only ones I had access to or was able to deduce from documentation; and I have not tried to update it for any recent changes.

Sign in to comment.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by