BNMR: Scripts: Difference between revisions

From DaqWiki
Jump to navigation Jump to search
en>Suz
mNo edit summary
en>Suz
mNo edit summary
Line 74: Line 74:


=== at_start_run.pl ===
=== 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.
The script {{File|name=at_start_run.pl}} is executed at the start of every run by the MIDAS system (see [[#NOTE]] below). Depending on the supplied parameter, it checks the experiment can access [[BNMR: CAMP|CAMP]] or EPICS or both.


This script is also called as a [[BNMR:Perlscripts#Customscript|customscript]]. See also [[BNMR: Perlscripts#at_start_run.pl]].
When checking access to the CAMP slow control system, it also checks that the CAMP logged variables (including automatic logged variables) can be accessed, and zeroes the CAMP statistics. Similarly, when checking EPICS access, it also checks that 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.
 
This script is also called as a [[BNMR: Perlscripts#Customscript|customscript]]. See also [[BNMR: Perlscripts#at_start_run.pl]].


=== at_end_run.csh ===
=== at_end_run.csh ===

Revision as of 18:28, 25 November 2016


Links

Introduction

A number of important scripts are used in the bnmr and bnqr experiments. Some of the most important are described here. Unless otherwise noted, the scripts described here can be found in directory ~/online/<beamline>/bin.

Another important group of scripts are the perlscripts found in directory ~/online/<beamline>/perl. These are described under BNMR: Perlscripts.


.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. See .cshrc for an example.


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.

Environment variable EXPERIM_DIR must be defined (in .cshrc). This script calls #check-host-bnmr or check-host-bnqr.

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.


show-windows

show-windows is an alias to the script show-windows. This script attaches to and displays (in an xterm, if possible) one or all midas clients that were started and managed under the screen program. This includes clients mdarc,mheader and the frontend (client name febn[mq]r_vmic - see Nomenclature).

  • To display all windows, give no argument, or the word "all".
  • To display a specific window, give the parameter in Table 1 :
Table 1 show-windows parameters
Command Parameter Action
show-windows to show all windows
show-windows all
show-windows vmic to show frontend window
show-windows frontend
show-windows mdarc to show mdarc window
show-windows mheader to show mheader window


check-host-bnmr or check-host-bnqr

The appropriate script check-host-bn[mq]r (see Nomenclature) is called by #start-all.

It checks that the following environment variables are defined:

DAQ_HOST MIDASSYS MIDAS_EXPTAB MIDAS_EXPT_NAME DAQ_HOST MSERVER_PORT BEAMLINE

It further checks that the user is logged onto the correct computer for DAQ (i.e. HOST matches DAQ_HOST) and that MIDAS_EXPT_NAME and BEAMLINE match the username ( bnmr or bnqr).

check-host-vmic

This script checks that the script is being run on the VMIC rather than the MIDAS host machine (i.e. HOST matches VMIC_HOST) It is called by start-frontend.

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). Depending on the supplied parameter, it checks the experiment can access CAMP or EPICS or both.

When checking access to the CAMP slow control system, it also checks that the CAMP logged variables (including automatic logged variables) can be accessed, and zeroes the CAMP statistics. Similarly, when checking EPICS access, it also checks that 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.

This script is also called as a customscript. See also BNMR: Perlscripts#at_start_run.pl.

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.