Jump to navigation Jump to search
Revision as of 13:24, 8 October 2014 by Olchansk (Created page with "== Note on Programs auto start, auto stop, auto restart == == From https://midas.triumf.ca/elog/Midas/919 == <pre> MIDAS "programs" settings include: /programs/xxx/"auto sta...")
Note on Programs auto start, auto stop, auto restart
MIDAS "programs" settings include: /programs/xxx/"auto start", "auto restart" and "auto stop". What do they do? "auto start": if set to "y", the program's "start command" will be unconditionally executed at the beginning of the run start transition. Because there are no checks or tests, the "start command" will be executed even if the program is already running. It means that this function cannot be used to start frontend programs - a new copy will be started each time, and a previously running copy will be killed. Also the timing of the program startup and run transition is wrong - in my tests, the program starts too late to see the run transition. If the program is a frontend, it will never see the begin-of-run transition. 1st conclusion: "auto start" should be "n" for frontend programs and for any other programs that are supposed to be continuously running (mlogger, lazylogger, etc). 2nd conclusion: "auto start" does the same thing as "/programs/execute on start run". "auto stop": if set to "y", the program will be stopped after the end of run. (using cm_shutdown). "auto restart": this has nothing to do with starting and stopping runs. Instead, it works in conjunction with the alarm system and the "program is not running" alarm. The alarm system periodically calls al_check(). al_check() checks all programs defined under /Programs to see if they are running (using cm_exist()). If a program is not running and an alarm is defined, the alarm is raised ("program is not running" alarm). If there is a start command and "auto restart" is set to "y", the start command is executed. When using these "auto start" and "auto restart" functions, one needs to be careful about the context where the start command will be executed: midas clients may be running from different directories, under different user names and on different computers. In "auto start", the start command is executed from cm_transition. For remote clients, this will happen on the remote computer. (against the expectation that the program will be started on the main computer). In "auto restart", the start command is executed by al_check() which always runs locally (for remote clients, it runs inside the mserver). So the started program will always run on the main computer, but maybe not in the same directory as when started from the mhttpd "programs -> start" button. Conclusion: "programs auto start" : works but has strange interactions and side effects, do not use it. "programs auto stop" : works, can be used to stop programs at the end of run (but what for?) "programs auto restart" : works, seems to work correctly, can be used to auto restart mlogger, frontends, etc. K.O.
> "programs auto start" : works but has strange interactions and side effects, do not use it. > "programs auto stop" : works, can be used to stop programs at the end of run (but what for?) > "programs auto restart" : works, seems to work correctly, can be used to auto restart mlogger, frontends, auto start and auto stop have been requested by PAA loooong time ago. Maybe he remembers if/where this has been used at all. I never used it. So if this is the case for others, we can easily change it and won't break anything. Like auto start can be executed before the run transition happens, check for a previous version of the program, and only continue when the program is actually running. Should be only a few lines of code. Auto restart is used successfully here at PSI, for example for the lazy logger. /Stefan