python - How can I start matlab with a daemon when I'm not active on the computer? -


i need execute several matlab functions on daily basis. of these functions download data internet. fail if data not ready yet example , want them try again after time. in order implement have python script calling matlab functions several times until success or send me e-mail if fail repeatedly. not "state of art" implementation don't know better. python script called each day daemon. now, works if i'm logged computer fails return value 1 , following message (daemon error log) when computer (imac) rests while (i forbid sleep though in energy saver preferences. @ least think did ticking "prevent computer sleeping automatically when display off". however, "enable power nap" on.)

traceback (most recent call last):   file "/users/<username>/documents/daemontest/matlab_batcher.py", line 108, in <module>     eng = matlab.engine.start_matlab()   file "/library/python/2.7/site-packages/matlab/engine/__init__.py", line 92, in start_matlab     eng = matlabengine(option)   file "/library/python/2.7/site-packages/matlab/engine/matlabengine.py", line 230, in __init__     self.__dict__["_matlab"] = pythonengine.creatematlab(tokens) matlab.engine.engineerror: matlab process can not created. 

matlab writes crash dump segmentation violation (with cannot myself).

i guess computer somehow goes sleep anyway , cannot start matlab then. case? if so, how can prevent sleeping or configure wake start daemon?

i searched keywords , title-question in different varieties in google , read through various suggested topics here on stack exchange. in docu mathwork license manager found maybe have start matlab daemon before can call matlab. however, don't understand lm-libraries in matlab distribution , hesitate run them.

this copy of plist (stored under /library/launchdaemons) wrote based on launchd tutorial:

<?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict>         <key>label</key>         <string>org.<app_name>.testdaemon</string>         <key>programarguments</key>         <array>                 <string>/usr/bin/python</string>                 <string>/users/<username>/documents/daemontest/matlab_batcher.py</string>         </array>         <key>standardoutpath</key>         <string>/users/<username>/documents/daemontest/test.stdout</string>         <key>standarderrorpath</key>         <string>/users/<username>/documents/daemontest/test.stderr</string>         <key>workingdirectory</key>         <string>/users/<username>/documents/daemontest</string>         <key>startcalendarinterval</key>         <array>                 <dict>                         <key>hour</key>                         <integer>16</integer>                         <key>minute</key>                         <integer>0</integer>                 </dict>         </array>         <key>keepalive</key>         <false/> </dict> </plist> 

storing plist under ~/library/launchagents works long i'm using computer. moved plist /library/launchdaemons because thought these run when user logged in or when computer running nobody using it. i'd appreciate help.

i run daemon under different user account working account failed trial copied working directory , changed file paths other user account , added key username plist. daemon did not start returned 78 instead (i didn't find out exit value might mean). bit off topic i'd appreciate comments on if have suggestions anyway.

finally figured out solution, well, rather work around.

in python script using matlabengine matlab. apparently starts when user active. details still don't know must ado matlab license , model imac switches few minutes after user becomes inactive. interesting though understand properly...

what works use bash commands instead of matlabengine calling matlab. doesn't offer direct interaction matlab function matlabengine case totally sufficient.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -