Project

General

Profile

Running DAQ Interface » History » Version 49

Version 48 (John Freeman, 11/14/2014 09:13 AM) → Version 49/223 (Erik Blaufuss, 11/14/2014 11:09 AM)

h1. Getting help

If you run into issues, or have questions, please contact:
*
Running DAQInterface
** John Freeman - jcfree@fnal.gov
* Run Control
** Erik Blaufuss - blaufuss@icecube.umd.edu


h1. Starting DAQInterface and Run Control

DAQInterface
is designed to be run, along with rest of the run control code, on lbne35t-gateway01.fnal.gov, using the lbnedaq account, or on lbnedaqtest01.fnal.gov using one's personal account. These For use on lbnedaqtest01, please contact John Freeman at jcfree@fnal.gov; these instructions will focus the use of DAQInterface on the gateway node. If you need access to the lbnedaq@lbne35t-gateway01.fnal.gov account, please contact one of us.
The DAQInterface and RunControl software can also be run on the lbnedaqtest01 VM machine, please contact John Freeman at jcfree@fnal.gov, for more details.

The installed
code is located at /data/lbnedaq/scratch/DAQInterface/lbnerc. To get started, login and first setup the environment:

<pre>
ssh lbnedaq@lbne35t-gateway01.fnal.gov
cd /data/lbnedaq/scratch/DAQInterface
source fireup
</pre>

This will take you into the /data/lbnedaq/scratch/DAQInterface/lbnerc directory. It's a good idea to check whether lbnecontrol (the run control application) and/or DAQInterface (the component which intermediates between run control and artdaq processes) are already running; if they are, the instructions below won't work. To check this, you can try:

<pre>
lbnecmd check
</pre>

Will display the current state of DAQInterface and RunControl. The example below shows that both RunControl and DAQInterface are running, but the DAQ run is stopped:
<pre>
(env)[lbnedaq@lbne35t-gateway01 lbnerc]$ lbnecmd check
lbnecontrol: running
daqint@localhost:5770 (synchronous): stopped
</pre>

If RunControl is not running, you'll see something like:
<pre>
(env)[lbnedaq@lbne35t-gateway01 lbnerc]$ lbnecmd check
check failed: '[Errno 111] Connection refused'. Is lbnecontrol running?
</pre>

h3. Starting RunControl

To start RunControl (after loading environment as above):
<pre>
lbnecmd launch
</pre>

h3. Starting DAQInterface

To start DAQInterface (after loading environment as above):
<pre>
stdbuf -oL daqinterface -n daqint -r 5570 -c localhost -H localhost >>~/DI.log 2>&1 &
</pre>
This will launch daqinterface in the background, with all messages being collected (appended to the bottom of...) in the file ~/DI.log (The stdbuf -oL prevents and buffering of output to the file)
Here, the "daqint" argument is arbitrary, and is the name you'll give the DAQInterface process in RunControl; the "5570" argument is the port off of which DAQInterface will run.

h3. Performing a hard reset of RunControl and DAQInterface

If needed, you can track down the process names and kill them explicitly to get a clean reset:
<pre>
ps aux | grep -v grep | grep lbnecontrol
ps aux | grep -v grep | grep daqinterface
</pre>


If these processes are running, it either means that someone else is using DAQInterface, or that someone else who's done with DAQInterface forgot to clean up. As the 9th and 10th fields of the row of variables "ps aux" returns concern how long the program has been running, you can use these values as well as your best judgement, then, before deciding these processes are not in active use and killing them. To kill them,

Assuming
the second field returned from "ps aux" is processes aren't running, before getting started, take a look at the process id (PID), use:
configuration file, found in docs/config.txt (relative to /data/lbnedaq/scratch/DAQInterface/lbnerc). It should look something like the following:

<pre>

lbne-artdaq: /data/lbnedaq/rce/build_lbne-artdaq

PMT host: lbnedaq3

log directory: /data/lbnedaq/daqlogs

record directory: /data/lbnedaq/scratch/jcfree/TemporarySaveArea/

pause before initialization: 0

debug level: 1

BoardReader host: lbnedaq2

kill <PID> BoardReader port: 5205
BoardReader fhicl: /data/lbnedaq/fcl/BoardReader_TPC_lbnedaq2_1.fcl

BoardReader host: lbnedaq2
BoardReader port: 5206
BoardReader fhicl: /data/lbnedaq/fcl/BoardReader_TPC_lbnedaq2_2.fcl

EventBuilder host: lbnedaq3
EventBuilder port: 5235
EventBuilder fhicl: /data/lbnedaq/fcl/EventBuilder_lbnedaq2_1.fcl

EventBuilder host: lbnedaq3
EventBuilder port: 5236
EventBuilder fhicl: /data/lbnedaq/fcl/EventBuilder_lbnedaq2_2.fcl

Aggregator host: lbnedaq2
Aggregator port: 5265
Aggregator fhicl: /data/lbnedaq/fcl/Aggregator_lbnedaq2_1.fcl

Aggregator host: lbnedaq2
Aggregator port: 5266
Aggregator fhicl: /data/lbnedaq/fcl/Aggregator_lbnedaq2_2.fcl

</pre>

h1. Configuring The "lbne-artdaq" parameter allows the user to set the directory in which the desired build of lbne-artdaq to use is located, the "PMT host" parameter is the host on which artdaq's process management tool script (pmt.rb, used by DAQInterface to launch and starting Runs

All
kill the artdaq processes) will run, and "log directory" is the directory to which lbne-artdaq's output will be sent. The "debug level" parameter allows the user to set the verbosity level of the output to the screen; setting it to higher values creates greater verbosity, and as a practical matter, the range of settings is currently 0-3. Loosely speaking, "0" means minimal output (not much beyond simply announcing a transition is complete), "1" includes announcements of progress during transitions, "2" includes these steps assume announcements plus the values of certain variables as well as lbne-artdaq output, and "3" is primarily of developer interest. The "pause before initialization" parameter allows the user to set a pause, in seconds, between when the artdaq processes start and when they're initialized; it has been observed that a latency of a few seconds is needed for initialization to proceed correctly (though this is not always the CfgMgr case -- on lbne35t-gateway01, with a high setting for "debug level", a pause is not needed; the reason why "debug level" matters in this context is not yet understood).

After these individual parameters, every cluster of three lines allows one to define an artdaq process; each line should either contain "BoardReader", "EventBuilder" or "Aggregator", defining the
process type, and every cluster of three lines should have the same process type. The three lines let one define the host and port of the artdaq process (to run an artdaq process on the same host as you're on, use "localhost"), as well as the FHiCL document which will be used to initialize it. Best practice is available. To to place those FHiCL documents in the /data/lbnedaq/fcl directory. Please note that the order of processes matters, and that they should be listed front-end to back-end, i.e., BoardReader definitions should appear before EventBuilders should appear before Aggregators.

As of this writing (10/1/14) in the repo there currently exist versions of the config.txt file designed to run under different configurations; docs/config_lbnedaqtest01.txt runs simulated data on lbnedaqtest01, docs/config_lbne35t-gateway01.txt runs simulated data on lbne35t-gateway01, and docs/config_lbne35t-gateway01_RCE.txt runs RCEs on lbne35t-gateway01. If you wish to use a particular configuration, copy it into config.txt and then make any appropriate tweaks.

Once you have the configuration file written to your specifications, you can then
start this, please see run control and DAQInterface:

<pre>
lbnecontrol &
daqinterface -n daqint -r 5570 -c localhost -H localhost &
</pre>

Here,
the documentation here: https://cdcvs.fnal.gov/redmine/projects/fhicl_cfgmgr/wiki

"daqint" argument is arbitrary, and is the name you'll give the DAQInterface process; the "5570" argument is the port off of which DAQInterface will run.

Now, you can take DAQ Interface through the standard transitions to start a DAQ run. transitions. At all stages, you can use the "lbnecmd check" command to see what state DAQInterface is in; note that you'll want to wait for a transition to complete before issuing another one, otherwise you'll receive a warning and the transition request will be ignored. DAQInterface will Without using "lbnecmd check" you can also report just look for a message like the following to it's log file when transitions are complete:
know that a given transition has completed:

<pre>
Initialize transition complete; if running DAQInterface in the background, can press <enter> to return to shell prompt
</pre>


Note that if a high "debug level" has been set, this message can get buried in a set of output messages; in this case "lbnecmd check" may be the easiest way to determine what state the system is in.

h2. Selecting a configuration and DAQcomponents

*Before initializing or starting a DAQ run*, a configuration and set of DAQComponents must be selected. This is done via RunControl.

h3. List and select a configuration:

To see the list of available configurations (queried from CfgMgr):
<pre>
lbnecmd listconfigs
</pre>
Will return a list of configs:
<pre>
Available configs (Name : description)

demo : Pithy description
tmp1 : Pithy description
...

Current selected config: No Config
</pre>
This lists all available configs, as well as the current selected config (Note, default config is "No Config"). You can then select a configuration:
<pre>
lbnecmd setconfig demo
</pre>
This will return "OK" if successful (at "listconfigs" will show this as the current config). If the specified configuration is not known, an error is returned.

h3. List and select DAQ components.

You can select which portions of the LBNE DAQ setup you want to use in the upcoming run. These are mapped generally to the ArtDAQ Boardreader processes
that read them out. As an operator, you need to ensure that there are configuration files available in CfgMgr for the DAQ Components that you select here,
or DAQInterface will return an error.

To see the list of available DAQ components:
<pre>
lbnecmd listdaqcomps
</pre>
Will return a list of components available and selected (*Default* is ALL available components):
<pre>
{'available': {'component02': ['lbnedaq2', '5206'], 'component01': ['lbnedaq2', '5205']}}
{'selected': {'component02': ['lbnedaq2', '5206'], 'component01': ['lbnedaq2', '5205']}}
</pre>
Shown are the available components by name, along with the requested host/port to run the BoardReader process on. You can then select a list of DAQ components to use in the run:
<pre>
lbnecmd setdaqcomps component01 component02
</pre>
This will return "OK" if successful (at "lisdaqcomps" will show this as the current config). If the specified compnents are not known, an error is returned.
To change the list of available components, see below.

h2. Configuring, starting, stopping and terminating a Run

For each of these transitions, please recall that while "lbnecmd <cmd>" returns very quickly, the actual command can take several seconds or minutes to happen. Before issuing another command, be sure that the transition is complete by using the check command:
<pre>
lbnecmd check
</pre>
and ensure that the DAQ is, for example, in the "ready" state and not still in the "initializing" stage.

First, take DAQInterface from the "stopped" to the "ready" state; this will create the artdaq processes on the hosts you selected (DAQ components), specified, and initialize them with the FHiCL configuration: documents you specified:
<pre>
lbnecmd init daq
</pre>

Take DAQInterface from the "ready" to the "running" state, in order to begin taking data: datataking:
<pre>
lbnecmd start daq
</pre>
Note: the current run number is displayed when DAQ is in the running state using the "lbnecmd check" command:
<pre>
lbnecmd check
lbnecontrol: running
Run number: 207
Run configuration: demo


daqint@localhost:5570 (synchronous): running
</pre>

Pause the running of the DAQ, putting DAQInterface into the "paused" state. This will cause the current open output file to be closed and given a name reflecting the current run number: state:
<pre>
lbnecmd pause daq
</pre>

Resume the running of the DAQ, putting returning to the "running" state. This will restart data taking to a new output file: state:
<pre>
lbnecmd resume daq
</pre>

Halt the running of the DAQ, returning DAQInterface to the "ready" state from the "running" state:
<pre>
lbnecmd stop daq
</pre>
From the ready state, you can start a new run with the same configuration and DAQ components you originally selected.
*NOTE* To select a new configuration or DAQ component set, you must kill all ArtDAQ processes with the "terminate" command:


Now, return to the "stopped" state, killing all the artdaq processes:
<pre>
lbnecmd terminate daq
</pre>

h2. After your DAQ run.

Once you've completed your run, there are a few things you can look at.

* A
For starters, a record of the DAQ's output will be saved in the subdirectory pmt/ relative to where you specified the output logfiles; thus in the example config.txt below, above you'd find the output in /data/lbnedaq/daqlogs/pmt/.
*
Also, a record of the FHiCL documents sent to the artdaq processes and the docs/config.txt file will have been saved; as of this writing (11/12/14) the directory in which this can be found is /data/lbnedaq/scratch/jcfree/TemporarySaveArea/<run number>, although as you might imagine the plan is to eventually change this directory.
**
PLEASE NOTE that there may be slight differences between the saved FHiCL documents and the FHiCL documents specified in config.txt and/or provided by the choice of configuration. The saved FHiCL document name is standardized to <processtype>_<host>_<port>_r<run number>.fcl, so, e.g, "Aggregator_lbnedaq2_5266_r192.fcl" would be the saved name of /data/lbnedaq/fcl/Aggregator_lbnedaq2_2.fcl, listed in the example config.txt file above, assuming datat aking datataking was performed in run 192.
**
More importantly, the FHiCL document actually sent to the artdaq process may be slightly different than the FHiCL document provided for DAQInterface; this is because DAQInterface performs some bookkeeping on FHiCL variables which account for things such as the number of processes of a given type (note that it makes no changes which would affect the physics). It is this post-bookkeeping FHiCL document which actually gets sent to the processes which gets saved to the output directory.


* *Todo: JohnF* : A note here about output data files?? *Running with the configuration manager set up*

h1. Configuring Note that the rules for running DAQInterface

DAQInterface has some key information stored
when the configuration manager is used (described "here":https://cdcvs.fnal.gov/redmine/projects/fhicl_cfgmgr/wiki) are slightly different than above. The primary issue to keep in mind is that for a local given configuration file (location and ports for EventBuilders, Aggregators, location set of artDAQ, log level, etc). These can chosen components, the BoardReaderMain applications (as well as their hosts and FHiCL documents) will be changed while DAQInterface is not running, It's
expected that for normal operations,
determined by run control and the configuration manager; thus these should applications need not need to changed too often. Assuming be listed in the processes aren't running, before getting started, take a look at docs/config.txt. Furthermore, the configuration file, found FHiCL documents for the AggregatorMain applications are also provided; however, the hosts and ports on which the AggregatorMains are run are left to be defined in docs/config.txt (relative the config.txt file. The basic idea is that details internal to /data/lbnedaq/scratch/DAQInterface/lbnerc).
It
DAQInterface / artdaq should look something like the following:
<pre>
lbne-artdaq: /data/lbnedaq/scratch/DAQInterface/build_lbne-artdaq

PMT host: lbnedaq3

pause before initialization: 5

# debug level can range from 0
be left to 3 (increasing order config.txt (unlike BoardReaderMain, which contains experiment-defined fragment generators, and AggregatorMain, which contains experiment-defined Art modules). An out-of-the-box example of verbosity)
debug level: 1
such a configuration file is located in lbnerc/docs/config_cfgmgr.txt; below, the portion of this file (as of 11/14/14) which defines application info is shown:

log directory: /data/lbnedaq/daqlogs

record directory: /data/lbnedaq/scratch/jcfree/TemporarySaveArea/
<pre>

EventBuilder host: lbnedaq2
EventBuilder port: 5235
EventBuilder fhicl: /data/lbnedaq/fcl/EventBuilder_demo1.fcl

EventBuilder host: lbnedaq2
EventBuilder port: 5236
EventBuilder fhicl: /data/lbnedaq/fcl/EventBuilder_demo2.fcl

Aggregator host: lbnedaq2
Aggregator port: 5265

Aggregator host: lbnedaq2
Aggregator port: 5266
</pre>


The "lbne-artdaq" parameter allows the user to set the directory in which the desired build of lbne-artdaq to use is located, the "PMT host" parameter is the host on which artdaq's process management tool script (pmt.rb, used by DAQInterface to launch and kill the artdaq processes) will run, and "log directory" is the directory to which lbne-artdaq's output will be sent. The "debug level" parameter allows the user to set the verbosity level of the output to the screen; setting it to higher values creates greater verbosity, and as a practical matter, the range of settings is currently 0-3. Loosely speaking, "0" means minimal output (not much beyond simply announcing a transition is complete), "1" includes announcements of progress during transitions, "2" includes these announcements plus the values of certain variables as well as lbne-artdaq output, and "3" is primarily of developer interest. The "pause before initialization" parameter allows the user to set a pause, in seconds, between when the artdaq processes start and when they're initialized; it has been observed that a latency of a few seconds is needed for initialization to proceed correctly (though this is not always the case -- on lbne35t-gateway01, with a high setting for "debug level", a pause is not needed; the reason why "debug level" matters in this context is not yet understood).

After these individual parameters, every cluster of three lines allows one to define an artdaq process; each line should either contain "EventBuilder" or "Aggregator", defining the process type, and every cluster of three lines should have the same process type. The three lines let one define the host and port of the artdaq process (to run an artdaq process on the same host as you're on, use "localhost"), as well as the FHiCL document which will be used to initialize it. Best practice is to place those FHiCL documents in the /data/lbnedaq/fcl directory. Please note that the order of processes matters, and that they should be listed front-end to back-end, i.e., BoardReader definitions should appear before EventBuilders should appear before Aggregators.

h1. Adding new DAQComponents to RunControl

The list of available DAQComponents (maps to BoardReader processes) is maintained by RunControl in the file:
<pre>
/home/lbnedaq/.lbnerc-components
</pre>
Each entry defines:


* Name - name of the component, maps to a <name>_hw_cfg.fcl in CfgMgr's configuration directory
* host - hostname where BoardReader process will be started
* port - XMLRPC port to be used, must be unique and used by other processes.

For example:
<pre>
component01: lbnedaq2 5205
component02: lbnedaq2 5206
</pre>
Has two components (component01 and component02) both running on lbnedaq2 on ports 5205 and 5206.

h1. Troubleshooting and FAQ

h2. Common RunControl issues

h3. How can I get a list of all RunControl commands?

<pre>
lbnecmd help
</pre>
will list all available commands for RunControl with some details for help.

h3. No real configurations are listed by "listconfigs"

If you run "lbnecmd listconfigs" and see something like:
<pre>
Available configs (Name : description)

dummy : Dummy description
</pre>
Instead of your expected configurations, RunControl is not able to connect to CfgMgr. Please make sure it's running (https://cdcvs.fnal.gov/redmine/projects/fhicl_cfgmgr/wiki/Wiki)

h2. Common DAQInterface issues

h3.
*Error handling*


As of this writing (11/14/14) (7/14/14) there has not yet been extensive user feedback concerning DAQInterface; despite this, certain potential problems have been anticipated and are handled within DAQInterface. These problems include:
# An artdaq process returns an error state after a transition request, or an exception is thrown by the XML-RPC library during the request
# During periodic checks, one or more artdaq processes expected to exist are not found

In either case, an error is reported via 0MQ to RunControl, run control, and the "Recover" transition is automatically triggered. This transition is a fairly blunt instrument: it will kill any remaining artdaq processes and return DAQInterface to its original state of "stopped" (i.e., one in which it requires the "init" transition before anything else is done).

h3. In order to see this for yourself, you can deliberately sabotage one of the transitions. E.g., you can replace one of these filenames listed in the config.txt file with one of your own files intentionally designed to be improper FHiCL; this will then trigger a "recover" transition automatically when an "init" transition is requested. The same thing will occur if you use the name of a file which doesn't exist. After the "recover" transition, you can then use the "lbnecmd check" command to see for yourself that DAQ Interface has returned to its original state. Note that currently, if recover sees that the artdaq processes don't exist, it will raise an exception, which will in turn trigger DAQInterface to end itself. In general, setting "debug level" to a high value is a good idea for troubleshooting if something goes wrong (although a sufficiently high value may simply obscure things for the end user).

Please note that if you issue an "init" transition and then follow it with a "terminate" transition, you'll see an exception in the artdaq terminal window which looks like the snippet below; this is because statistics collection which occurs during termination will fail if no data's been collected, which is expected:

<pre>
Tue Jul 08 14:16:33 -0500 2014: Time Summary:
Tue Jul 08 14:16:33 -0500 2014: Min: 0
Tue Jul 08 14:16:33 -0500 2014: Max: 0
Tue Jul 08 14:16:33 -0500 2014: Avg: inf
Tue Jul 08 14:16:33 -0500 2014: %MSG-s ArtException: Aggregator-lbnedaqtest01-5265 JobSetup
Tue Jul 08 14:16:33 -0500 2014: cet::exception caught in art
Tue Jul 08 14:16:33 -0500 2014: ---- DataCorruption BEGIN
Tue Jul 08 14:16:33 -0500 2014: NetMonInputDetail: Could not receive message!
Tue Jul 08 14:16:33 -0500 2014: ---- DataCorruption END
Tue Jul 08 14:16:33 -0500 2014: %MSG
Tue Jul 08 14:16:33 -0500 2014: %MSG-s ArtException: Aggregator-lbnedaqtest01-5266 JobSetup
Tue Jul 08 14:16:33 -0500 2014: cet::exception caught in art
Tue Jul 08 14:16:33 -0500 2014: ---- DataCorruption BEGIN
Tue Jul 08 14:16:33 -0500 2014: NetMonInputDetail: Could not receive message!
Tue Jul 08 14:16:33 -0500 2014: ---- DataCorruption END
</pre>

* *Troubleshooting*
**
*Your change to docs/config.txt or daqinterface.py doesn't seem to do anything*


Make sure you kill the existing daqinterface process and restart it

h3. On

** *On
the initial transition ("lbnecmd init daq"), you see "error: [Errno 111] Connection refused"*


If a "Recover" is triggered and you can see via "lbnecmd check" that DAQInterface is in the "stopped" state, try initializing again. If that doesn't work, you can try increasing the value of the "pause before initialization" variable in the docs/config.txt file. Empirically, it appears there needs to be a pause of at least 4 seconds on lbnedaqtest01.fnal.gov before the FHiCL documents can be successfully sent via XML-RPC to the processes; increasing this value may make it less likely that the "Connection refused" error occurs.
h3. ** *On the initial transition, you see a regularly updating printout saying "Waiting for all processes to be launched"*


Seeing one or two of these is fine. If, after several seconds, something like the following
<pre>
Waiting for all processes to be launched; if zombie pmt.rb is running on localhost please kill it and this program (PID 31820)
</pre>
keeps getting output to screen, it means there's a problem initializing. In this case, the current (11/12/14) course of action is to externally kill DAQInterface using the PID listed; also, it's possible that there may already be a pmt.rb executable running on the desired host, blocking the launch of a new one due to a port conflict, in which case you should log onto the host (assuming you're not already on it), and run
<pre>
ps aux | grep -v grep | grep pmt.rb
</pre>
to see if this is the case. If it's not and you can't think of what might be wrong (is the configuration manager running? have you double-checked docs/config.txt?), then try increasing the debug level in docs/config.txt for your next run-through, as this will likely shed light on the nature of the problem.