/Programs ODB tree

From MidasWiki
Revision as of 14:49, 12 August 2014 by Suz (talk | contribs)
Jump to navigation Jump to search

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

A run will be prevented from starting if this client is not running providing the Prevent start on required program key is also set.

This key should be set to "y" for essential programs only; typically the logger and all front-end 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 can restart the client by hand.





Auto start

  • Type: BOOL
  • Default: "n"

If this key in the <client-name> subtree is set to "y", the client will be started automatically using the 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) the client will not be restarted unless Auto restart is set to "y".






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.





Auto restart

  • Type: BOOL
  • Default: "n"

If this key in the <client-name> subtree is set to "y" the client will be restarted automatically using the Start command. This will occur if the client dies or times out (see |Watchdog timeout). If set to "n", the client must be restarted by the user. See also Auto start.







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.