BNMR: Scripts: Difference between revisions

From DaqWiki
Jump to navigation Jump to search
en>Suz
(New page: {{Pagelinks}} ==Introduction == A number of scripts are used in the DAQ for the {{bnmqr|join=and}}. The most important of these will be described in this page. == start-all == ''start-al...)
 
en>Suz
mNo edit summary
Line 1: Line 1:
{{Pagelinks}}
{{Pagelinks}}


==Introduction ==
A number of scripts are used in the DAQ for the {{bnmqr|join=and}}. The most important of these will be described in this page.


== start-all ==
== Links ==
''start-all'' is an alias to the shell script
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* <span style="color:navy;font-weight:bold; font-style:italic;">start-daq-tasks-bnmr</span> at path <span style="color:#214200 ; font-weight:normal; font-style:italic ">/home/bnmr/online/bnmr/bin/</span> (for <span style="color:#7b68ee; font-style=italic">bnmr</span> ) or
* [[BNMR]]
* <span style="color:navy;font-weight:bold; font-style:italic;">start-daq-tasks-bnqr</span> at path <span style="color:#214200 ; font-weight:normal; font-style:italic ">/home/bnqr/online/bnqr/bin/</span> (for <span style="color:#20b2aa; font-style=italic">bnqr</span> ).
* [[BNMR: Midas Host#Environment Variables|Environment variables]]
This script is run to start all the MIDAS clients for the  {{bnmqr|join=or}} experiments. It can also be run at any time to start missing clients.  To clean up and restart the experiment, run ''[[#kill-all]]'' followed by ''start-all''.
* [[BNMR: Experimental Modes|Experimental Modes]]
* [[BNMR: Getting Started|Getting Started]]
* [[BNMR#Nomenclature|Nomenclature]]
</div>


start-all starts the standard MIDAS utilities mserver, mlogger and mhttpd as daemons. It also starts the MIDAS clients specific to the  {{bnmqr|join=and}} experiments, i.e. fe_epics, rf_config, mdarc, mheader and autorun on the linux host machine (isdaq01). fe_epics and rf_config are started as daemons, mdarc and mheader are started in xterms that can be displayed if desired (usually for troubleshooting). Finally it starts the frontend client febnmr or febnqr on the VMIC host. The frontend is run in an xterm that is displayed be default.  It also enabled the MIDAS Alarm system.  
== Introduction ==
A number of important scripts are used in the {{bnmqr|join=and}} experiments. The most important of these are described here.  
; Unless otherwise noted, the scripts can be found in directory {{Filepath|path=~/online/[[BNMR#Nomenclature|<beamline>]]/bin}}.


=== .cshrc ===
This important script in $HOME is the '''script executed on log in'''. This sets up the path, the aliases and environment variables required for running the DAQ system. This file is shared by all the machines in the NIS cluster with ''isdaq00'' as master. This includes ''isdaq01, isdaq06, lxbnmr, lxbnqr''. This script therefore checks the $HOST environment variable before setting up the DAQ system.


== kill-all ==
=== start-all ===
''kill-all'' is an alias to the script  {{File|name=kill-all}} at {{Filepath|path=/home/bnmr/online/bnmr/bin/}} (for {{bnmr}}) or  {{Filepath|path=/home/bnqr/online/bnqr/bin/}} (for {{bnqr}}). It shuts down all the MIDAS utilities and clients started by
''start-all'' is an alias to the script  {{File|name=start-all-daq-bn[mq]r}} (see [[BNMR#Nomenclature|Nomenclature]]). This script is run by the experimenter to start all the MIDAS clients needed for the DAQ system. It checks to see if each client is already running, and if not, starts it. It can be run at any time during the run to restart missing clients.
''[[#start-all]]'', and shuts down the MIDAS alarm system. It cleans up the ODB and deletes any empty midas log files it finds.


=== kill-all ===
''kill-all'' is an alias to the script  {{File|name=kill-all}}. This script kills all DAQ related clients. When there is some problem with the DAQ that cannot be otherwise resolved, users often do a ''' ''kill-all'' followed by a ''start-all'' ''' to ensure a clean restart. 


[[Category:BNMR]]
Recently (June 2016) an extra feature has been added to the script {{File|name=kill-all}}. This is the execution of the file {{File|name=init_odb.com}}. This file is an [https://midas.triumf.ca/MidasWiki/index.php/Odbedit odbedit] command file containing a list of ODB keys to initialize to their default state.
 
=== at_start_run.pl ===
The script {{File|name=at_start_run.pl}} is executed at the start of every run by the MIDAS system (see [[#NOTE]] below). It checks access to the CAMP slow control system, and checks that the CAMP logged variables (including automatic logged variables) can be accessed, and zeroes the CAMP statistics. Similarly, it also checks the EPICS logged variables (if enabled) exist and can be accessed. If an error occurs, it sets alarms in the ODB to inform the experimenters by means of an alarm banner on the custom status page.
 
=== at_end_run.csh ===
The script {{File|name=at_end_run.csh}} is executed at the end of every run (see [[#NOTE]]). This script runs a second script  {{File|name=elog_every_run.csh}}. This script
reads the {{Odbpath|path=/Experiment/Edit on start}} parameters (i.e. the parameters entered by the experimenter on starting a run), other ODB parameters including the Experimental (PPG) Mode of the run and whether it is run in dual or single channel mode, reads the statistics of the CAMP logged devices, and
sends them all to the appropriate ELOG.
 
<div id=NOTE></div>
;NOTE
The MIDAS system provides a means whereby users' scripts can be automatically executed at the start or end of the run, by means of keys in the ODB {{Odbpath|path=/programs}} tree. The key {{Odbpath|path=Execute on start run}} contains the name and path of a script to be executed at the start of every run,
and the key {{Odbpath|path=Execute on stop run}} contains the name and path of a script to be executed at the end of every run. For example,
[local:bnqr:Stopped]/>ls "/programs/Execute on start run"
    Execute on start run            /home/bnqr/online/bnqr/bin/at_start_run.pl /home/bnqr/online/perl bnqr >/home/bnqr/tmp/at_start_run_pl.log
[local:bnqr:Stopped]/>ls "/programs/Execute on stop run"
    Execute on stop run            /home/bnqr/online/bnqr/bin/at_end_run.csh
For more information see MIDAS [https://midas.triumf.ca/MidasWiki/index.php//Programs_ODB_tree /Programs ODB tree].
 
[[Category:Scripts]]

Revision as of 17:50, 20 June 2016


Links

Introduction

A number of important scripts are used in the bnmr and bnqr experiments. The most important of these are described here.

Unless otherwise noted, the scripts can be found in directory

~/online/<beamline>/bin.

.cshrc

This important script in $HOME is the script executed on log in. This sets up the path, the aliases and environment variables required for running the DAQ system. This file is shared by all the machines in the NIS cluster with isdaq00 as master. This includes isdaq01, isdaq06, lxbnmr, lxbnqr. This script therefore checks the $HOST environment variable before setting up the DAQ system.

start-all

start-all is an alias to the script start-all-daq-bn[mq]r (see Nomenclature). This script is run by the experimenter to start all the MIDAS clients needed for the DAQ system. It checks to see if each client is already running, and if not, starts it. It can be run at any time during the run to restart missing clients.

kill-all

kill-all is an alias to the script kill-all. This script kills all DAQ related clients. When there is some problem with the DAQ that cannot be otherwise resolved, users often do a kill-all followed by a start-all to ensure a clean restart.

Recently (June 2016) an extra feature has been added to the script kill-all. This is the execution of the file init_odb.com. This file is an odbedit command file containing a list of ODB keys to initialize to their default state.

at_start_run.pl

The script at_start_run.pl is executed at the start of every run by the MIDAS system (see #NOTE below). It checks access to the CAMP slow control system, and checks that the CAMP logged variables (including automatic logged variables) can be accessed, and zeroes the CAMP statistics. Similarly, it also checks the EPICS logged variables (if enabled) exist and can be accessed. If an error occurs, it sets alarms in the ODB to inform the experimenters by means of an alarm banner on the custom status page.

at_end_run.csh

The script at_end_run.csh is executed at the end of every run (see #NOTE). This script runs a second script elog_every_run.csh. This script reads the /Experiment/Edit on start parameters (i.e. the parameters entered by the experimenter on starting a run), other ODB parameters including the Experimental (PPG) Mode of the run and whether it is run in dual or single channel mode, reads the statistics of the CAMP logged devices, and sends them all to the appropriate ELOG.

NOTE

The MIDAS system provides a means whereby users' scripts can be automatically executed at the start or end of the run, by means of keys in the ODB /programs tree. The key Execute on start run contains the name and path of a script to be executed at the start of every run, and the key Execute on stop run contains the name and path of a script to be executed at the end of every run. For example,

[local:bnqr:Stopped]/>ls "/programs/Execute on start run"
   Execute on start run            /home/bnqr/online/bnqr/bin/at_start_run.pl /home/bnqr/online/perl bnqr >/home/bnqr/tmp/at_start_run_pl.log
[local:bnqr:Stopped]/>ls "/programs/Execute on stop run" 
   Execute on stop run             /home/bnqr/online/bnqr/bin/at_end_run.csh

For more information see MIDAS /Programs ODB tree.