Difference between revisions of "/Programs ODB tree"

From MidasWiki
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
==== Links ====
+
{{Pagelinks}}
 +
 
 +
= Links =
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* [[mhttpd]] program page
+
* [[Programs Page]]
 +
* [[mhttpd]]
 
* [[Alarm System]]
 
* [[Alarm System]]
 +
* [[/Alarms ODB tree]]
 
*  
 
*  
 
</div>
 
</div>
  
== Purpose  ==
+
= Purpose  =
 
The ODB /Programs tree contains user and system information related to client programs.
 
The ODB /Programs tree contains user and system information related to client programs.
  
== Creating the /Programs tree ==
+
= Creating the /Programs tree =
 
The <span style="color:purple; font-style:italic">/Programs</span>  ODB tree is created by the system. It contains
 
The <span style="color:purple; font-style:italic">/Programs</span>  ODB tree is created by the system. It contains
 
*    key <span style="color:purple; font-style:italic">Execute on start run</span>
 
*    key <span style="color:purple; font-style:italic">Execute on start run</span>
Line 18: Line 22:
 
Each client will have its own subtree in the <span style="color:purple; font-style:italic">/Programs</span> tree. The subtree will be named for the client, and contains system information as well as task-specific characteristics, such as the watchdog timeout, and a number of optional features, such as a commands to start the task, alarm condition etc.  
 
Each client will have its own subtree in the <span style="color:purple; font-style:italic">/Programs</span> tree. The subtree will be named for the client, and contains system information as well as task-specific characteristics, such as the watchdog timeout, and a number of optional features, such as a commands to start the task, alarm condition etc.  
  
== Example of /Programs tree ==
+
= Example of /Programs tree =
 
The following is an example of the /Programs tree from an experiment obtained with the [[odbedit|odbedit ls command]] :
 
The following is an example of the /Programs tree from an experiment obtained with the [[odbedit|odbedit ls command]] :
  
Line 57: Line 61:
  
  
== Keys in the  <span  style="color: purple;">''/Programs''</span> ODB tree  ==
+
= Keys in the  <span  style="color: purple;">''/Programs''</span> ODB tree  =
  
===  <span  style="color: purple;">''Execute on start run''</span>  ===
+
==  <span  style="color: purple;">''Execute on start run''</span>  ==
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
* '''Type:''' STRING
 
* '''Type:''' STRING
Line 72: Line 76:
 
<br>
 
<br>
  
===  <span  style="color: purple;">''Execute on stop run''</span>  ===
+
==  <span  style="color: purple;">''Execute on stop run''</span>  ==
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
* '''Type:''' STRING
 
* '''Type:''' STRING
Line 84: Line 88:
 
<br>
 
<br>
  
===  <span  style="color: purple;">''<client-name>'' subtree</span>  ===
+
==  <span  style="color: purple;">''<client-name>'' subtree</span>  ==
  
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
Line 97: Line 101:
 
<br>
 
<br>
  
====  <span  style="color: purple;">''Required'' </span>  ====
+
===  <span  style="color: purple;">''Required'' </span>  ===
  
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
Line 106: Line 110:
 
If this key in the  [[#<client-name> subtree|<client-name> subtree]] is set to "y", this client is designated as '''required'''.  
 
If this key in the  [[#<client-name> subtree|<client-name> subtree]] is set to "y", this client is designated as '''required'''.  
  
It should be combined with setting [[#Auto start|Auto start]] and/or [[#Auto restart|Auto restart]] to "y", and supplying a [[#Start command|Start command]]. If set to "n", the run will start successfully without this client running. Note that this field also changes the display in the [[mhttpd]] Programs page.  
+
It should be combined with setting [[#Auto start|Auto start]] and/or [[#Auto restart|Auto restart]] to "y", and supplying a [[#Start command|Start command]]. This field also changes the display in the {{Utility|name=mhttpd}} [[Programs Page]].  
  
A run will be prevented from starting if this client is not running providing the [[/Experiment ODB tree#Prevent start on required program|Prevent start on required program]] key is also set.
+
A run will be prevented from starting if this client is not running, providing
 +
# The <span  style="color: purple;">''Required'' </span> key is set to "y"
 +
# The [[/Experiment ODB tree#Prevent start on required program|Prevent start on required program]] key is also set to "y".
  
This key should be set to "y" for essential programs only; typically the logger and all front-end programs should be required programs.
+
This key should be set to "y" for essential programs only; typically the [[mlogger]] and all [[Frontend Operation|frontend]] programs should be required programs.
  
 
<br>
 
<br>
Line 116: Line 122:
 
<br>
 
<br>
  
====  <span  style="color: purple;">''Watchdog timeout'' </span>  ====
+
===  <span  style="color: purple;">''Watchdog timeout'' </span>  ===
  
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
Line 130: Line 136:
 
<br>
 
<br>
  
====  <span  style="color: purple;">''Check interval'' </span>  ====
+
===  <span  style="color: purple;">''Check interval'' </span>  ===
  
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
Line 145: Line 151:
 
<br>
 
<br>
  
====  <span  style="color: purple;">''Start command'' </span>  ====
+
===  <span  style="color: purple;">''Start command'' </span>  ===
  
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
Line 153: Line 159:
  
 
This key in the  [[#<client-name> subtree|<client-name> subtree]] optionally contains the command used to restart the client. It is required if either [[#Auto start|Auto start]] or  
 
This key in the  [[#<client-name> subtree|<client-name> subtree]] optionally contains the command used to restart the client. It is required if either [[#Auto start|Auto start]] or  
[[#Auto restart|Auto restart]] is set to "y", or the user wishes to start or restart the client using the mhttpd restart button on the Programs page. If no start command is supplied, the user can restart the client by hand.  
+
[[#Auto restart|Auto restart]] is set to "y", or the user wishes to start or restart the client using the {{Utility|name=mhttpd}} restart button on the [[Programs Page#Features of the Programs page| Programs Page]].  
 +
 
 +
If no {{Odbpath|path=Start command}} is supplied, the user is responsible for  restarting the client.  
  
 
<br>
 
<br>
Line 160: Line 168:
  
  
====  <span  style="color: purple;">''Auto start'' </span>  ====
+
===  <span  style="color: purple;">''Auto start'' </span>  ===
  
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
Line 167: Line 175:
 
</div>
 
</div>
  
If this key in the  [[#<client-name> subtree|<client-name> subtree]] is set to "y", the client will be started automatically using the [[#Start command|Start command]]. This will occur when an experiment is first started after killing all clients. If the client then dies (or times out - see [[#Watchdog timeout||Watchdog timeout]]) the client will not be restarted unless Auto restart is set to "y".  
+
 
 +
 
 +
<dl>
 +
<dt><span style="color:red;font-style:bold;">Warning</span></dt>
 +
<dd><span style="color:red;">This key works but has strange interactions and side effects. It is recommended that this key be left at the default value of "n".</span></dd>
 +
</dl>
 +
 
 +
 
 +
If this key in the  [[#<client-name> subtree|<client-name> subtree]] is set to "y", the client's [[#Start command|Start command]] will be unconditionally executed at the beginning of the run start transition. Because there are no checks or tests, the {{Odbpath|path=Start command}} will be executed even if the program is already
 +
running. It means that this function cannot be used to start [[Frontend Operation|frontend]] programs - a new copy will be
 +
started each time, and a previously running copy will be killed. 
 +
 
 +
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).
 +
 
 +
;Note 
 +
: in tests by KO ...
 +
The timing of the program startup and run transition is wrong - in tests, the program starts too late to see the run transition. If the program is a [[Frontend Operation|frontend]], it will never see the begin-of-run transition.
 +
 
 +
* "auto start" should be "n" for frontend programs and for any other programs that are supposed to be continuously running ([[mlogger]], [[lazylogger]], etc).
 +
* "auto start" does the same thing as [[#Execute on start run|Execute on start run]]".
 +
 
  
  
Line 176: Line 204:
  
  
====  <span  style="color: purple;">''Auto stop'' </span>  ====
+
===  <span  style="color: purple;">''Auto stop'' </span>  ===
  
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
Line 183: Line 211:
 
</div>
 
</div>
  
If this key in the  [[#<client-name> subtree|<client-name> subtree]] is set to "y", the client will be automatically shut down on a [[Run States and Transitions|STOP transition]].
+
If this key in the  [[#<client-name> subtree|<client-name> subtree]] is set to "y", the client will be automatically shut down on a [[Run States and Transitions|STOP transition]] (using cm_shutdown).  
  
  
Line 190: Line 218:
 
<br>
 
<br>
  
====  <span  style="color: purple;">''Auto restart'' </span>  ====
+
 
 +
===  <span  style="color: purple;">''Auto restart'' </span>  ===
  
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
Line 197: Line 226:
 
</div>
 
</div>
  
If this key in the [[#<client-name> subtree|<client-name> subtree]] is set to "y"  
+
This key works in conjunction with the [[Alarm System]] and the "program not running" alarm - see [[Alarm System#Program Alarm|Program Alarm]] for details.
the client will be restarted automatically using the [[#Start command|Start command]]. This will occur if the client dies or times out (see [[#Watchdog timeout||Watchdog timeout]]). If set to "n", the client must be restarted by the user. See also [[#Auto start|Auto start]].  
 
  
 +
If this key in the  [[#<client-name> subtree|<client-name> subtree]] is set to "y", if a [[Alarm System#Program Alarm|program alarm]] is detected for this client, it will be restarted automatically using the [[#Start command|Start command]] (assuming a valid {{Odbpath|path=Start command}} is supplied). 
  
 +
If set to "n", the client must be restarted by the user. See also  {{Utility|name=mhttpd}} [[Programs Page#Features of the Programs page]].
  
  
 +
;Note
 +
: this key has nothing to do with starting and stopping runs.
 +
: this key can be used for automatically restarting [[mlogger]], [[Frontend Operation|frontends]] etc.
 
<br>
 
<br>
 
---------
 
---------
Line 208: Line 241:
  
  
====  <span  style="color: purple;">''Alarm class'' </span>  ====
+
===  <span  style="color: purple;">''Alarm class'' </span>  ===
  
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
Line 215: Line 248:
 
</div>
 
</div>
  
If this key in the  [[#<client-name> subtree|<client-name> subtree]] is set to one of the existing [[/Alarms ODB tree#alarm class|alarm classes]], an entry in the [[/Alarms ODB tree]] will be automatically created for this program (see [[/Alarms ODB tree#Program Alarm|Program alarm]]. The [[/Alarms ODB tree#Alarm Type|Alarm Type]] will be '''Program Alarm''' . This will cause an alarm to go off if the program is not running (provided both the  [[/Alarms ODB tree#Alarm system active|alarm system is enabled]], and the  
+
If this key in the  [[#<client-name> subtree|<client-name> subtree]] is set to one of the existing [[/Alarms ODB tree#alarm class|alarm classes]], an entry in the [[/Alarms ODB tree]] will be automatically created for this program. The [[/Alarms ODB tree#Alarm Type|Alarm Type]] will be [[/Alarms ODB tree#Program Alarm|Program alarm]] . This will cause an alarm to go off if the program is not running (provided both the   
 +
[[Alarm System]] is
 +
[[/Alarms ODB tree#Alarm system active|enabled]], and the  
 
[[/Alarms ODB tree#Active|individual alarm enabled]]).  
 
[[/Alarms ODB tree#Active|individual alarm enabled]]).  
  
Line 227: Line 262:
  
  
====  <span  style="color: purple;">''First failed'' </span>  ====
+
===  <span  style="color: purple;">''First failed'' </span>  ===
  
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
Line 238: Line 273:
  
 
[[Category:ODB Tree]]
 
[[Category:ODB Tree]]
 +
[[Category:Programs]]

Latest revision as of 17:33, 6 August 2015


Links

Purpose

The ODB /Programs tree contains user and system information related to client programs.

Creating the /Programs tree

The /Programs ODB tree is created by the system. It contains

  • key Execute on start run
  • key Execute on stop run
  • a subdirectory for each client that runs on the experiment, created by the system the first time a client runs


Each client will have its own subtree in the /Programs tree. The subtree will be named for the client, and contains system information as well as task-specific characteristics, such as the watchdog timeout, and a number of optional features, such as a commands to start the task, alarm condition etc.

Example of /Programs tree

The following is an example of the /Programs tree from an experiment obtained with the odbedit ls command :

[local:bnmr:S]/>ls -lt /programs

Key name                        Type    #Val  Size  Last Opn Mode Value
---------------------------------------------------------------------------
Execute on start run            STRING  1     256   18h  0   RWD  /home/bnmr/online/bnmr/bin/at_start_run.csh
Execute on stop run             STRING  1     256   18h  0   RWD  /home/bnmr/online/bnmr/bin/at_end_run.csh
ODBEdit                         DIR
Logger                          DIR
Epics                           DIR
rf_config                       DIR
mheader                         DIR
Mdarc                           DIR
autorun                         DIR
feBNMR                          DIR
camplog                         DIR
Lcrplot                         DIR
mhttpd                          DIR
mdump                           DIR
Speaker                         DIR
mdarc_cleanup                   DIR

The following example shows the subdirectory for the mlogger client:

[local:bnmr:S]/>ls -lt /programs/logger
Key name                        Type    #Val  Size  Last Opn Mode Value
---------------------------------------------------------------------------
Required                        BOOL    1     4     4h   0   RWD  y
Watchdog timeout                INT     1     4     4h   0   RWD  10000
Check interval                  DWORD   1     4     4h   0   RWD  180000
Start command                   STRING  1     256   4h   0   RWD  mlogger -D
Auto start                      BOOL    1     4     4h   0   RWD  n
Auto stop                       BOOL    1     4     4h   0   RWD  n
Auto restart                    BOOL    1     4     4h   0   RWD  y
Alarm class                     STRING  1     32    4h   0   RWD  Caution
First failed                    DWORD   1     4     4h   0   RWD  1259294464


Keys in the /Programs ODB tree

Execute on start run

  • Type: STRING
  • Default: ""

This key in the /Programs ODB tree may contain a command or script to be executed on a START transition.





Execute on stop run

  • Type: STRING
  • Default: ""

This key in the /Programs ODB tree may contain a command or script to be executed on a STOP transition.




<client-name> subtree

  • Type: DIR

This subdirectory in the /Programs ODB tree is repeated for each client that has been run on the experiment, whether MIDAS utilities or user-written frontends. The subtree will be named for the client.





Required

  • Type: BOOL
  • Default: "n"

If this key in the <client-name> subtree is set to "y", this client is designated as required.

It should be combined with setting Auto start and/or Auto restart to "y", and supplying a Start command. This field also changes the display in the mhttpd Programs Page.

A run will be prevented from starting if this client is not running, providing

  1. The Required key is set to "y"
  2. The Prevent start on required program key is also set to "y".

This key should be set to "y" for essential programs only; typically the mlogger and all frontend programs should be required programs.




Watchdog timeout

  • Type: INT
  • Default: 10000

This key in the <client-name> subtree contains the the watchdog timeout set in milliseconds. A watchdog runs automatically checking (every Check interval ms) whether the client responds. If the client has not been responded for Watchdog timeout ms, the client will be assumed to have timed out, and it will be killed. The watchdog time for each client should be adjusted as required. For example, clients that contact external hardware that is slow to respond should have a longer time set, or they may time out before the operation is complete.




Check interval

  • Type: DWORD
  • Default: 180000

This key in the <client-name> subtree contains the time interval in milliseconds that the Watchdog checks the client to see if it is responding. See Watchdog timeout.





Start command

  • Type: STRING
  • Default: ""

This key in the <client-name> subtree optionally contains the command used to restart the client. It is required if either Auto start or Auto restart is set to "y", or the user wishes to start or restart the client using the mhttpd restart button on the Programs Page.

If no Start command is supplied, the user is responsible for restarting the client.





Auto start

  • Type: BOOL
  • Default: "n"


Warning
This key works but has strange interactions and side effects. It is recommended that this key be left at the default value of "n".


If this key in the <client-name> subtree is set to "y", the client'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.

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).

Note
in tests by KO ...

The timing of the program startup and run transition is wrong - in 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.

  • "auto start" should be "n" for frontend programs and for any other programs that are supposed to be continuously running (mlogger, lazylogger, etc).
  • "auto start" does the same thing as Execute on start run".







Auto stop

  • Type: BOOL
  • Default: "n"

If this key in the <client-name> subtree is set to "y", the client will be automatically shut down on a STOP transition (using cm_shutdown).






Auto restart

  • Type: BOOL
  • Default: "n"

This key works in conjunction with the Alarm System and the "program not running" alarm - see Program Alarm for details.

If this key in the <client-name> subtree is set to "y", if a program alarm is detected for this client, it will be restarted automatically using the Start command (assuming a valid Start command is supplied).

If set to "n", the client must be restarted by the user. See also mhttpd Programs Page#Features of the Programs page.


Note
this key has nothing to do with starting and stopping runs.
this key can be used for automatically restarting mlogger, frontends etc.





Alarm class

  • Type: STRING
  • Default: ""

If this key in the <client-name> subtree is set to one of the existing alarm classes, an entry in the /Alarms ODB tree will be automatically created for this program. The Alarm Type will be Program alarm . This will cause an alarm to go off if the program is not running (provided both the Alarm System is enabled, and the individual alarm enabled).

If the Prevent start on alarms is also set to "y", the run will be prevented from starting if an alarm has been triggered.






First failed

  • Type: DWORD
  • Default: ""

This key in the <client-name> subtree is filled by the System to indicate when the client first failed.