Project

General

Profile

Running DAQ Interface » History » Version 30

Version 29 (John Freeman, 07/14/2014 06:03 PM) → Version 30/223 (John Freeman, 08/08/2014 05:28 PM)

h1. Running DAQ Interface

DAQ Interface is designed to be run, along with rest of the run control code, on lbne35t-gateway01.fnal.gov, using the lbnedaq account. It is located at /data/lbnedaq/scratch/DAQInterface/lbnerc; please note that as lbnedaqtest01.fnal.gov . To obtain an account on this is system, contact John Freeman, jcfree@fnal.gov . Once you have an active development area account, you should be aware that code may change and that other users may be working with do the package. To get started, first setup the environment: following:

<pre>
cd /data/lbnedaq/scratch/DAQInterface
source fireup
</pre>

This will take you into
* *Check out 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 software*:

Create a new directory, cd into it,
and artdaq processes) are already running; if they are, execute <pre>git clone ssh://p-lbnerc@cdcvs.fnal.gov/cvs/projects/lbnerc</pre>

* *Make sure you're on
the instructions below won't work. To check this, you can try:

<pre>
feature/DAQInterface branch*
ps -A | grep lbnecontrol cd into lbnerc/, and execute
ps -A | grep daqinterface
<pre>git checkout feature/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. Please use your best judgement, then, before killing these processes.

Assuming
* *Set up the processes aren't running, before getting started, take environment*:
From the lbnerc/ directory, execute <pre>source source_me</pre> This will both create
a look at local build of /usr/local/lbne-artdaq-base/lbne-artaq, as well as set up the configuration file, found Python virtual environment needed by the LBNE RC code 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

BoardReader host: lbnedaq2
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>

The first three parameters allow
parent directory of lbnerc, in a directory call "env" (in other words, "env" and "lbnerc" are at the user to set same level of the directory in which hierarchy on the desired system). If this is the first time you've build of lbne-artdaq to use is located, and/or set up the host on which artdaq's Python virtual environment, each process management tool script (pmt.rb, used by DAQInterface to launch and kill the artdaq processes) will run, and the directory to which log output take roughly two minutes. Note that while there will be sent. After this, every cluster a few error/warning messages displayed at different points of three lines allows one to define an artdaq process; each line the setup, at the end you should either contain "BoardReader", "EventBuilder" or "Aggregator", defining see <pre>Environment ready; consider running the process type, and every cluster unit tests via command nosetests</pre>
n.b. As
of three lines should have 7/8/14 if you run <code>nosetests</code> 4 of the same process type. The three lines let one define the host 65 tests will fail; more than this, and port of the artdaq process, as well as the FHiCL document there may be a problem which will be used to initialize it. Best practice is to place those FHiCL documents in affect the /data/lbnedaq/fcl directory. Please note that the order running of processes matters, and DAQInterface. The most likely cause is that they should be listed front-end to back-end, i.e., BoardReader definitions should appear before EventBuilders should appear before Aggregators.

Once you have the configuration file written to your specifications, you can then start
an lbnecontrol and/or daqinterface process is already running (described right below).

* *Start LBNE
run control and DAQInterface:

control*: <pre>
lbnecontrol &
</pre>. Note this won't work if lbnecontrol is already running; to find this out, run "<code>ps -A | grep lbnecontrol</code>"

* *Start DAQ Interface*: <pre>
daqinterface -n daqint -r 5570 -c localhost -H localhost &
</pre> . Like lbnerc, this also won't work if daqinterface is already running

Here, the "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
* *Take DAQ Interface through the standard 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 transitions* :
Fire up
a transition to complete before issuing another one, otherwise you'll receive a warning and new shell/terminal in which the transition request will be ignored.

First, take DAQInterface from the "stopped" to the "ready" state; this will create the
artdaq processes on the hosts you specified, are launched, and initialize them with FHiCL documents, by executing the FHiCL documents you specified: following:
<pre>
lbnecmd init daq
</pre>

Take DAQInterface from

Start
the "ready" to toy fragment generator, which produces simulated CAEN board data, and plot the "running" state, in order to begin datataking: data using an Art module:
<pre>
lbnecmd start daq
</pre>


Pause it, ending the subrun but not the run:
<pre>
lbnecmd pause daq
</pre>
Resume DAQ running:
<pre>
lbnecmd resume daq
</pre>
Halt the running of the DAQ, returning DAQInterface to the "ready" state from the "running" state: DAQ:
<pre>
lbnecmd stop daq
</pre>

Now, return to the "stopped" state, killing

Kill
all the artdaq processes:
<pre>
lbnecmd terminate daq
</pre>



* *A Closer Look*

As mentioned briefly above, the "init" transition will both create the artdaq processes as well as initialize them via a set of FHiCL documents. But which documents? The answer to this is that they are defined in the file "docs/fcl_devel.txt"; note that the name of the file DAQInterface uses to search for FHiCL documents can be changed if the member string "fcl_list_filename" is changed. "docs/fcl_devel.txt" will look something like the following:

<pre>
# This list of fcl files, when read in by DAQInterface, will be used
# to initialize the artdaq processes

/data/fcl/daqinterface/BoardReader_TOY1_lbnedaqtest01.fnal.gov_5205.fcl
/data/fcl/daqinterface/BoardReader_TOY2_lbnedaqtest01.fnal.gov_5206.fcl
/data/fcl/daqinterface/EventBuilder_lbnedaqtest01.fnal.gov_5235.fcl
/data/fcl/daqinterface/EventBuilder_lbnedaqtest01.fnal.gov_5236.fcl
/data/fcl/daqinterface/Aggregator_lbnedaqtest01.fnal.gov_5265.fcl
/data/fcl/daqinterface/Aggregator_lbnedaqtest01.fnal.gov_5266.fcl
</pre>

Currently (7/14/14) the FHiCL files are all in a public area; however, you can edit this file to use your private FHiCL files, but keep the following in mind:
# The FHiCL documents should all contain either the token "BoardReader", "EventBuilder" or "Aggregator" in their names; this is so DAQInterface can determine whether the document is designed to initialize a BoardReaderMain, EventBuilderMain or AggregatorMain process
# Order matters: BoardReaderMain documents should be listed before EventBuilderMain documents which in turn should be listed before AggregatorMain documents

*
*Error handling*
As of this writing (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 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).

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 docs/fcl_devel.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. Another thing to do is, after the init transition, once the artdaq process terminal pops up, close it -- this will terminate the artdaq processes, also triggering a call to "recover". 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.

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 daqinterface.py 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 pauseBeforeCommands member variable in the DAQInterface class; this is the pause, in seconds, between when the artdaq processes are launched and when they're sent the FHiCL documents to initialize. 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. Remember to kill and then restart DAQInterface if you've altered its source code.