9) Sometimes there aren't enough licenses free to execute your program. This is a pain. However, someone has solved this Stupid Cluster Tricks . Good luck with this.
10) To solve the point above for matlab licenses, one may include the following line of execution into your matlab code:
% halt execution for a minute if we can't get the image toolbox
while (~license('checkout','image_toolbox'))
pause(60);
end;
Note: This can be done for every single toolbox required. However, to prevent possible license-required deadlocks , I highly suggest one manually (within your matlab script, and most probably during your initilisation procedure) control the checking out of required matlab toolbox licenses as the matlab license() function does not allow one to release a toolbox license. But, of course, this only works if one can initiate a maltab session.
11) To solve the above 2 problems, one can take the ultimate step and compile the M-file into a system executable. This is done via matlab's compiler . However, one must be aware of the licensing limitations associated with a stand-alone system executable from the matlab compiler. Of course, if one uses a call in the "Can not be compiled" column, then one must revert back to the solution above. Gee, this is getting complicated.
12) The ultimate matlab licensing solution would involved a system executable which attempts to launch a matlab engine . Whilst monitoring the standard error output stream (ie: stderr), if it detects an error "-4" (the error number associated with insufficient matlab licenses), then it can relaunch the matlab engine until it doesn't fail. The problem with this solution is that it is racing against all the other processes in a polling manner-- quite inelegant. So really this isn't the ultimate solution. |