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...)
 
No edit summary
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Pagelinks}}
{{Pagelinks}}


==Introduction ==
== 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.
A number of important scripts are used in the {{bnmqr|join=and}} experiments. Some of the most important are described here.
Unless otherwise noted, the scripts described here can be found in directory {{Filepath|path=~/online/[[BNMR#Nomenclature|<beamline>]]/bin}}.  


== start-all ==
== .bashrc ==
''start-all'' is an alias to the shell script
This important script in $HOME is the '''bash script executed on log in'''. This sets up the path, the aliases and [[BNMR: Experimental Setup#Environment Variables|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 [[BNMR: Experimental Setup]] for details.
* <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
* <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> ).  
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''.


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.


== Scripts to restart MIDAS clients  ==
A number of scripts are provided to start or restart the MIDAS clients needed for the data acquisition system. The most important of these is [[#start-all|start-all]] which starts any missing clients. Scripts are also provided to start individual clients. These scripts are usually accessed from the Programs page when the user presses the restart button.


== kill-all ==
A script [[#kill-all|kill-all]] is provided to shut down all the clients.
''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]]'', and shuts down the MIDAS alarm system. It cleans up the ODB and deletes any empty midas log files it finds.


=== start-all ===
''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 either by calling another script, or directly. It can be run at any time during the run to restart missing clients.


[[Category:BNMR]]
=== 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. 
 
=== start_frontend ===
The script {{File|name=start_frontend}} must be run on the VMIC (not the host computer). It is may be run directly, but is usually called by the script {{File|name=start-all}}.  It starts the frontend program for {{bnmqr|join=or}} experiment under the '''screen program''' (see [[#show-windows|show-windows]]).
 
=== start_bnxr_logger ===
The script {{File|name=start_mdarc}} is run when the Programs page button restart for client bnxr_logger is pressed. This script is run on the host computer. This script restarts the MUD logger under the '''screen program''' (see [[#show-windows|show-windows]]).
 
 
 
== Script to show screen program windows ==
=== show-windows ===
''show-windows'' is an alias to the script  {{File|name=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  {{Client|name=mdarc,mheader}} and the [[BNMR: frontend|frontend]] (client name {{Client|name=febn[mq]r_vmic}} - see [[BNMR#Nomenclature|Nomenclature]]).
 
 
The advantage of the screen program is that the terminal does not disappear when the client fails. Also it can be accessed from
another terminal, and killing the window does not kill the client.
 
:Previously each of these clients was started in an xterm by start-all, so that progress could be monitored, and any errors :displayed.  The xterms appeared on the screen where start-all was executed, and were inaccessible to any other terminal. If the
:client failed, the xterm promptly disappeared, so only the error messages sent to the MIDAS logger could be read. 
 
 
* 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
{|  border="1" style=" border-collapse:collapse; color:black; background-color:mintcream"  cellpadding="5"
|-
! Command !! Parameter !! Action
|-
| style="font-style:italic"| show-windows
|
| rowspan="2" | to show all windows
|-
| style="font-style:italic;"|show-windows || '''all'''
|-
| style="font-style:italic"|show-windows ||''' vmic'''
| rowspan="2" | to show frontend window
|-
| style="font-style:italic"|show-windows || '''frontend ''' 
|}
 
== Run transition scripts ==
 
Midas has a feature where programs can be automatically run at the start/end of each run (see the [https://midas.triumf.ca/MidasWiki/index.php//Programs_ODB_tree /Programs ODB tree] documentation).
 
For {{bnmqr|join=and}} we only define an end-of-run program. All logic for the start of run is handled by clients that are always running.
 
=== End of run - elog_every_run.py ===
 
The {{Odbpath|path=/Programs/Execute on stop run}} is set to run the python program <code>bnxr_common/elog_every_run.py</code>.
This program 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  {{bnmqr|join=or}}. Automatic elog entries are identified in the  [[BNMR: Elog#Introduction|Elog]] by the Type ("Automatic Elog").  The System parameter is set to the PPG Mode of the run.
 
 
 
[[Category:BNMR]] [[Category:Scripts]]

Latest revision as of 13:37, 28 April 2022

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.

.bashrc

This important script in $HOME is the bash 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 BNMR: Experimental Setup for details.


Scripts to restart MIDAS clients

A number of scripts are provided to start or restart the MIDAS clients needed for the data acquisition system. The most important of these is start-all which starts any missing clients. Scripts are also provided to start individual clients. These scripts are usually accessed from the Programs page when the user presses the restart button.

A script kill-all is provided to shut down all the clients.

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 either by calling another script, or directly. 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.

start_frontend

The script start_frontend must be run on the VMIC (not the host computer). It is may be run directly, but is usually called by the script start-all. It starts the frontend program for bnmr or bnqr experiment under the screen program (see show-windows).

start_bnxr_logger

The script start_mdarc is run when the Programs page button restart for client bnxr_logger is pressed. This script is run on the host computer. This script restarts the MUD logger under the screen program (see show-windows).


Script to show screen program windows

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


The advantage of the screen program is that the terminal does not disappear when the client fails. Also it can be accessed from another terminal, and killing the window does not kill the client.

Previously each of these clients was started in an xterm by start-all, so that progress could be monitored, and any errors :displayed. The xterms appeared on the screen where start-all was executed, and were inaccessible to any other terminal. If the
client failed, the xterm promptly disappeared, so only the error messages sent to the MIDAS logger could be read.


  • 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

Run transition scripts

Midas has a feature where programs can be automatically run at the start/end of each run (see the /Programs ODB tree documentation).

For bnmr and bnqr we only define an end-of-run program. All logic for the start of run is handled by clients that are always running.

End of run - elog_every_run.py

The /Programs/Execute on stop run is set to run the python program bnxr_common/elog_every_run.py. This program 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 bnmr or bnqr. Automatic elog entries are identified in the Elog by the Type ("Automatic Elog"). The System parameter is set to the PPG Mode of the run.