Project

General

Profile

Running DAQ Interface » History » Version 145

« Previous - Version 145/223 (diff) - Next » - Current version
John Freeman, 03/25/2015 02:53 PM


  • UNDER REVISION AS OF 1:00 PM CDT, MARCH 25 -- PLEASE CONTACT JOHN FREEMAN, , FOR MORE INFO

Getting help

If, after reading this document (in particular, the "Troubleshooting and FAQ" section) you run into issues, or have questions, please contact:

Logbook

Please document all changes, software updates, and operational activities to the ELog:

http://dbweb3.fnal.gov:8080/ECL/lbne_35t

Brief preliminaries

This guide assumes you have access to the lbnedaq account on the LBNE 35 ton gateway node, lbne35t-gateway01.fnal.gov . It also assumes you have a rudimentary knowledge of how to navigate a bash environment in Linux (how to change directories, log onto different machines, perform time-ordered listings of files, edit a file using emacs or vi, etc.).

The installed code is located at lbne35t-gateway01.fnal.gov:/data/lbnedaq/daqarea/lbnerc. If you need access to the lbnedaq lbne35t-gateway01.fnal.gov account, please contact one of the people listed above under "Getting Help". Once you have access, to get started, login and first setup the environment:

ssh lbnedaq@lbne35t-gateway01.fnal.gov
cd /data/lbnedaq/daqarea
source fireup

This will take you into the /data/lbnedaq/daqarea/lbnerc directory, out of which the DAQ is controlled. For the remainder of this wiki, the assumption is that you've already setup the environment using the above commands.

Finally, when you see an ellipse ("…") in example output, that is to be interpreted as a placeholder for output which is considered irrelevant to the point being explained.

Killing, launching, and getting the status of the DAQ applications

Getting the status

The DAQ application suite consists of RunControl, the configuration manager, DAQInterface (the component which intermediates between RunControl, the configuration manager, and the artdaq processes) and the XML-RPC server for the TDU (the program which allows a sync pulse to be sent to the hardware at the start of DAQ running). The following points about these programs should be observed:
  • These applications all need to be running in order for the DAQ to work
  • DAQInterface needs to be launched after RunControl, and unlike the other applications, if a DAQInterface process is already found to be running on login, it shouldn't be used, but rather, killed and restarted (unless someone is actively using the DAQ already, of course)
  • The actual names of the processes are "lbnecontrol" (RunControl), "daqinterface" (DAQInterface), "CfgMgrApp" (the configuration manager) and "tdu" (the TDU XML-RPC server)

In order to determine which DAQ applications are already running, use the following command:

lbnecmd check

You'll then see output similar to the following:

lbnecontrol: Available
CfgMgr: **Not Found**
DAQInterface: Available
TDUControl: **Not Found**
...

Here, you see that RunControl and DAQInterface already exist, but the configuration manager and the TDU's XML-RPC server do not. In this case, you would not only want to launch the configuration manager and the server, but you would also want to kill and relaunch DAQInterface (again, assuming no-one else was actively using it). How to kill and launch applications is described in the next two sections.

Cleanup: killing RunControl, DAQInterface, the configuration manager, and the TDU XMLRPC server

Killing RunControl has its own special syntax, and is simply:

lbnecmd kill

The other DAQ applications, however, need to be killed via the standard Linux command kill <pid>, where "<pid>" is the process ID of the application. To find the process IDs of all possible DAQ applications, you can run:

ps aux | grep -v grep | grep -v emacs | egrep -e lbnecontrol -e daqinterface -e CfgMgrApp -e tdu

For each application which exists, a row will appear, the second field of which is that application's process ID. Keep in mind, of course, that if these processes are running, it might mean that someone else is using the DAQ. 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.

Launching RunControl, DAQInterface, the configuration manager, and the TDU XMLRPC server

Launching RunControl

rm -f /tmp/lbnecontrol.pid  # (This should only be necessary if last RunControl session wasn't killed via "lbnecmd kill")
lbnecmd launch

Launching DAQInterface

daqinterface -n daqint -r 5570 -c localhost -H localhost -f <daqinterface 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. The "-f <daqinterface file>" is optional; if left out, the lbnerc/docs/config.txt file will be used to configure DAQInterface, otherwise <daqinterface file> will be used. The DAQInterface configuration is not to be confused with run configurations handled by the configuration manager; see the section "The DAQInterface configuration file" for more.

Launching the configuration manager

Please see the "Starting up the CfgMgrApp on lbne35t-gateway01" section of Jon Paley's documentation here: https://cdcvs.fnal.gov/redmine/projects/fhicl_cfgmgr/wiki

Launching the TDU XMLRPC server

tdu -T 192.168.100.201 -P 10001 -H localhost -r 50008 &

?Note that if you are using emulators, you don't need to run using the TDU. Remember to set 'TDU XMLRPC port' to less than or equal 0.

See Starting and using TDUControl for more details.

Configuring and starting Runs

With the applications launched, you can take the DAQ system through the standard transitions to perform a DAQ run. The "ground state" of the DAQ is called the "stopped" state. Each successful transition brings the DAQ into a different state. Described in more detail later, the chain of states (in quotes) and transitions (in italics) in the DAQ system can be represented as follows:


"stopped" -> init -> "ready" -> start -> "running" -> pause -> "ready" -> resume -> "running" -> stop -> "ready" -> terminate -> "stopped"


Checking the state of the DAQ

At all stages, you can use the "lbnecmd check" command to see what state DAQInterface is in; example output of this is as follows:

lbnecontrol: Available
CfgMgr: Available
DAQInterface: Available
TDUControl: Available

Run number: 797
Run configuration: ganglia_test
Run type: Test
daqint@localhost:5570 (synchronous): running

Here, you've already seen how lbnecmd check can tell you whether a given application type has been launched or not; on the bottom line, however, you'll also see a description of the state of the DAQ -- in this case, "running", meaning that it's actively acquiring data.

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 also report when transitions are complete -- e.g., at the end of the "initialize" transition, you'd see:

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

If a high "debug level" has been set for DAQInterface (see below for more on this), 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.

Selecting a run configuration and DAQ components

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

List and select a configuration:

To see the list of available configurations (queried from the configuration manager):

lbnecmd listconfigs

This lists all available configs, as well as the current selected config (Note, default config is "No Config"):
Available configs (Name : description)

8xssp_with_nova_sync : Sorry, no description found.
6xssp_ext : Sorry, no description found.
2xssp_ssp01_led_ssp02_tstamp : Sorry, no description found.
demo : This is a demo.  Testing 1, 2, 3…
...

Current selected config: No Config

You can then select a configuration -- for the purposes of this tutorial, let's go with "demo", which creates simulated data without using any hardware:
 
lbnecmd setconfig demo

This will return "OK" if successful; "lbnecmd listconfigs" will then show this as the current config. If the specified configuration is not known, an error is returned. Instructions on how to add a configuration are given later in this document.

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 BoardReaderMain processes
that read them out. As an operator, you need to ensure that there are configuration files available in the configuration manager for the DAQ Components that you select here, or DAQInterface will return an error.

To see the list of available DAQ components:

lbnecmd listdaqcomps

Will return a list of components available and selected (Default is ALL available components), e.g.:
Available:
component01 (lbnedaq2:5205)
component02 (lbnedaq2:5206)
…
ssp08 (lbnedaq1:5214)

Selected:
component01 (lbnedaq2:5205)
component02 (lbnedaq2:5206)
…
ssp08 (lbnedaq1:5214)

The components are shown by name, along with the requested host/port to run the component's corresponding BoardReaderMain process on. You can then select a list of DAQ components to use in the run:
lbnecmd setdaqcomps component0{1,2}

(n.b. the {1,2} in brackets is a Linux bash shell trick which expands component0{1,2} to component01 component02). This will return "OK" if successful ("lbnecmd listdaqcomps" will show this in the "selected" set of components). If the specified components are not known, an error is returned.

How to make a new component available to RunControl is described later in this document.

Initializing, starting, stopping and terminating a Run

For each of these transitions, please recall that while "lbnecmd <cmd>" returns very quickly, the actual issued command can take several seconds or minutes to complete. Before issuing another command, be sure that the transition is complete by using the check command:

lbnecmd check

For example, before issuing the "start" transition, you can use this command to ensure that the DAQ is 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), and initialize them with the FHiCL documents:

lbnecmd init daq

Take DAQInterface from the "ready" to the "running" state, in order to begin taking data:

lbnecmd start daq

Note that the current run number is displayed when DAQ is in the running state using the "lbnecmd check" command:

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:

lbnecmd pause daq

Resume the running of the DAQ, putting returning to the "running" state. This will restart data taking to a new output file:

lbnecmd resume daq

Halt the running of the DAQ, returning DAQInterface to the "ready" state from the "running" state:

lbnecmd stop daq

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 issue the "terminate" command, which will kill all ArtDAQ processes and return DAQInterface to its "stopped" state:

lbnecmd terminate daq

After your DAQ run.

Once you've completed your run, there are typically two primary outputs: the Root files which contain the data which passed through the DAQ (saved, as of March 25, 2015, in /data/lbnedaq/data on the gateway node), and a set of text files containing information about the run. To access these text files, you'll want to go to the run records directory, which defaults to /data/lbnedaq/run_records/<run_number>. This directory contains the FHiCL documents used to control the ArtDAQ processes in the run, the DAQInterface configuration file used (described later in this wiki), and a metadata file, which, among other things, describes where to find a record of the DAQ's output. An example of this file, for run 778, can be found if we look in /data/lbnedaq/run_records/778 at "metadata_r778.txt":

Config name: demo
Component #0: component01
Component #1: component02
lbne-artdaq commit: 0f0f9be1c63a3b487170579c887ce79944eca6f8
lbnerc commit: 92935f2702c5e0aa732fd3cc9ff6758e1a0c288c
/data/lbnedaq/config/ commit: 97d8b222742a41d5d10ea942a063ddfacac3ce93

pmt logfile(s): lbnedaq3:/data/lbnedaq/daqlogs/pmt/pmt-25771*.log

boardreader logfiles: 
lbnedaq3:/data/lbnedaq/daqlogs/boardreader/boardreader-20150320163004-lbnedaq2-37365.log
lbnedaq3:/data/lbnedaq/daqlogs/boardreader/boardreader-20150320163004-lbnedaq2-37366.log

eventbuilder logfiles: 
lbnedaq3:/data/lbnedaq/daqlogs/eventbuilder/eventbuilder-20150320163004-lbnedaq2-37364.log
lbnedaq3:/data/lbnedaq/daqlogs/eventbuilder/eventbuilder-20150320163004-lbnedaq2-37363.log
lbnedaq3:/data/lbnedaq/daqlogs/eventbuilder/eventbuilder-20150320163004-lbnedaq2-37368.log

aggregator logfiles: 
lbnedaq3:/data/lbnedaq/daqlogs/aggregator/aggregator-20150320163004-lbnedaq2-37369.log
lbnedaq3:/data/lbnedaq/daqlogs/aggregator/aggregator-20150320163004-lbnedaq2-37367.log


The most significant things saved in this file for the end user of the DAQ system are the configuration chosen and the components chosen for the run (at the top of the file), and the wildcard for the pmt (ArtDAQ Process Management Tool) logfiles, which contain the output of the DAQ system, under "pmt logfile(s)" -- so, in this case, executing ls -ltr /data/lbnedaq/daqlogs/pmt/pmt-25771*.log would list the files containing the output of the DAQ in run 778.

The DAQInterface configuration file

DAQInterface uses some key information stored in a local configuration file, NOT to be confused with the run configuration described elsewhere on this wiki. Examples of this information are location and ports for artdaq processes, location of lbne-artdaq software, debug (log) level, etc). These can be changed while the DAQ is in its "stopped" state. The default DAQInterface configuration file is docs/config.txt (relative to /data/lbnedaq/daqarea/lbnerc); if you wish to change parameters, it's considered best practice not to edit this default file but rather to copy it to a file of the form "docs/config_<your username>.txt", and edit that file, passing it to the DAQInterface executable via the "-f" option as described earlier in this document. It's expected that for normal operations, most parameters should not need to changed too often, and alterations will be primarily of developer or expert interest. If you ARE a developer/expert or are simply curious, take a look at the default DAQInterface configuration file; it should look something like the following:


lbne-artdaq: /data/lbnedaq/daqarea/lbne-artdaq-base/build_lbne-artdaq

PMT host: lbnedaq3
PMT port: 5400

pause before initialization: 5

# debug level can range from 0 to 3 (increasing order of verbosity)
debug level: 1

log directory:   /data/lbnedaq/daqlogs

record directory: /data/lbnedaq/run_records

# If this file is "config.txt" -- i.e., the standard, non-expert,
# non-testing version of the DAQInterface configuration file -- do not
# set "disable configuration check" to "true" 

disable configuration check: false

TDU XMLRPC port: 0

EventBuilder host: lbnedaq2
EventBuilder port: 5235

EventBuilder host: lbnedaq2
EventBuilder port: 5236

Aggregator host: lbnedaq2
Aggregator port: 5265

Aggregator host: lbnedaq2
Aggregator port: 5266

The parameters you're most likely to change will be the following:

  • lbne-artdaq : the directory in which the desired build of lbne-artdaq to use is located; you would change this if you'd modified and built a personal copy of lbne-artdaq for hardware troubleshooting purposes, for example.
  • debug level : 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.
  • disable configuration check : a boolean which can be set to "true" or "false"; normally this should be set to "false", which means that on the start transition, DAQInterface will intentionally fail and put itself into the "stopped" state if it discovers that edits have been made to the configuration directory since the last commit in that directory. If very frequent edits to the configuration directory are made during hardware debugging, however, switching this feature on to "true" can make life considerably easier.
  • TDU XMLRPC port : the value of the port through which DAQInterface will communicate with an XML-RPC server linked to the TDU. Needed for DAQInterface to send a sync pulse to the TDU at the beginning of the "start" and "resume" transitions. If this is set to 0 or a negative value, no sync pulse is attempted. For more on the TDU and its code, see Tom Dealtry's Wiki here

Adding new configurations to RunControl

Adding new DAQ Components to RunControl

Troubleshooting and FAQ

Common RunControl issues

How can I get a list of all RunControl commands?

lbnecmd help

will list all available commands for RunControl with some details for help.

No real configurations are listed by RunControl

If you run "lbnecmd listconfigs" and see something like:

Available configs (Name : description)

dummy : Dummy description

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)

Common DAQInterface issues

Error handling

As of this writing (11/14/14) certain potential problems have been anticipated and are handled within DAQInterface. These problems include:
  1. An artdaq process returns an error state after a transition request, or an exception is thrown by the XML-RPC library during the request
  2. 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, 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).

Your change to the DAQInterface configuration file or the daqinterface.py code doesn't seem to do anything

Make sure you kill the existing daqinterface process and restart it

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 DAQInterface configuration file. Empirically, it appears there needs to be a pause of at least 5 seconds 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.

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

Waiting for all processes to be launched; if zombie pmt.rb is running on localhost please kill it and this program (PID 31820)

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
ps aux | grep -v grep | grep pmt.rb 

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 the DAQInterface configuration file?), then try increasing the debug level in the DAQInterface configuration file for your next run-through, as this will likely shed light on the nature of the problem.

Regardless of how high the debug level is set to, you don't see any output to screen when you issue transitions to DAQInterface

Chances are that DAQInterface was started in another terminal, and consequently, it's in that terminal where output will appear. This issue can be circumvented by redirecting DAQInterface output into a file; how this can be accomplished is described elsewhere in this document.