Project

General

Profile

Running DAQ Interface » History » Version 30

John Freeman, 08/08/2014 05:28 PM

1 1 John Freeman
h1. Running DAQ Interface
2 1 John Freeman
3 30 John Freeman
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 this is an active development area you should be aware that code may change and that other users may be working with the package. To get started, first setup the environment:
4 1 John Freeman
5 30 John Freeman
<pre>
6 30 John Freeman
cd /data/lbnedaq/scratch/DAQInterface
7 30 John Freeman
source fireup
8 30 John Freeman
</pre>
9 1 John Freeman
10 30 John Freeman
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:
11 1 John Freeman
12 30 John Freeman
<pre>
13 30 John Freeman
ps -A | grep lbnecontrol
14 30 John Freeman
ps -A | grep daqinterface
15 30 John Freeman
</pre>
16 1 John Freeman
17 30 John Freeman
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. 
18 1 John Freeman
19 30 John Freeman
Assuming the processes aren't running, before getting started, take a look at the configuration file, found in docs/config.txt (relative to /data/lbnedaq/scratch/DAQInterface/lbnerc). It should look something like the following:
20 1 John Freeman
21 1 John Freeman
<pre>
22 30 John Freeman
23 30 John Freeman
lbne-artdaq: /data/lbnedaq/rce/build_lbne-artdaq
24 30 John Freeman
25 30 John Freeman
PMT host: lbnedaq3
26 30 John Freeman
27 30 John Freeman
log directory:   /data/lbnedaq/daqlogs
28 30 John Freeman
29 30 John Freeman
BoardReader host: lbnedaq2
30 30 John Freeman
BoardReader port: 5205
31 30 John Freeman
BoardReader fhicl: /data/lbnedaq/fcl/BoardReader_TPC_lbnedaq2_1.fcl
32 30 John Freeman
33 30 John Freeman
BoardReader host: lbnedaq2
34 30 John Freeman
BoardReader port: 5206
35 30 John Freeman
BoardReader fhicl: /data/lbnedaq/fcl/BoardReader_TPC_lbnedaq2_2.fcl
36 30 John Freeman
37 30 John Freeman
EventBuilder host: lbnedaq3
38 30 John Freeman
EventBuilder port: 5235
39 30 John Freeman
EventBuilder fhicl: /data/lbnedaq/fcl/EventBuilder_lbnedaq2_1.fcl
40 30 John Freeman
41 30 John Freeman
EventBuilder host: lbnedaq3
42 30 John Freeman
EventBuilder port: 5236
43 30 John Freeman
EventBuilder fhicl: /data/lbnedaq/fcl/EventBuilder_lbnedaq2_2.fcl
44 30 John Freeman
45 30 John Freeman
Aggregator host: lbnedaq2
46 30 John Freeman
Aggregator port: 5265
47 30 John Freeman
Aggregator fhicl: /data/lbnedaq/fcl/Aggregator_lbnedaq2_1.fcl
48 30 John Freeman
49 30 John Freeman
Aggregator host: lbnedaq2
50 30 John Freeman
Aggregator port: 5266
51 30 John Freeman
Aggregator fhicl: /data/lbnedaq/fcl/Aggregator_lbnedaq2_2.fcl
52 30 John Freeman
53 1 John Freeman
</pre>
54 30 John Freeman
55 30 John Freeman
The first three parameters allow the user to set the directory in which the desired build of lbne-artdaq to use is located, 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 the directory to which log output will be sent. After this, 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, 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. 
56 30 John Freeman
57 30 John Freeman
Once you have the configuration file written to your specifications, you can then start run control and DAQInterface:
58 30 John Freeman
59 1 John Freeman
<pre>
60 30 John Freeman
lbnecontrol &
61 30 John Freeman
daqinterface -n daqint -r 5570 -c localhost -H localhost &
62 27 John Freeman
</pre>
63 30 John Freeman
64 30 John Freeman
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. 
65 30 John Freeman
66 30 John Freeman
Now, you can 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 a transition to complete before issuing another one, otherwise you'll receive a warning and the transition request will be ignored.
67 30 John Freeman
68 30 John Freeman
First, take DAQInterface from the "stopped" to the "ready" state; this will create the artdaq processes on the hosts you specified, and initialize them with the FHiCL documents you specified:
69 29 John Freeman
<pre>
70 30 John Freeman
lbnecmd init daq
71 29 John Freeman
</pre>
72 30 John Freeman
73 30 John Freeman
Take DAQInterface from the "ready" to the "running" state, in order to begin datataking:
74 29 John Freeman
<pre>
75 30 John Freeman
lbnecmd start daq
76 29 John Freeman
</pre>
77 30 John Freeman
78 30 John Freeman
Halt the running of the DAQ, returning DAQInterface to the "ready" state from the "running" state:
79 29 John Freeman
<pre>
80 29 John Freeman
lbnecmd stop daq
81 29 John Freeman
</pre>
82 30 John Freeman
83 30 John Freeman
Now, return to the "stopped" state, killing all the artdaq processes:
84 29 John Freeman
<pre>
85 29 John Freeman
lbnecmd terminate daq
86 22 John Freeman
</pre>
87 21 John Freeman
88 1 John Freeman
89 21 John Freeman
90 21 John Freeman
* *Error handling*
91 29 John Freeman
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:
92 18 John Freeman
# An artdaq process returns an error state after a transition request, or an exception is thrown by the XML-RPC library during the request
93 19 John Freeman
# During periodic checks, one or more artdaq processes expected to exist are not found
94 18 John Freeman
95 18 John Freeman
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). 
96 18 John Freeman
97 30 John Freeman
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. 
98 18 John Freeman
99 18 John Freeman
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:
100 18 John Freeman
101 18 John Freeman
<pre>
102 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014:  Time Summary: 
103 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014:  Min: 0
104 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014:  Max: 0
105 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014:  Avg: inf
106 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014: %MSG-s ArtException:  Aggregator-lbnedaqtest01-5265 JobSetup
107 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014: cet::exception caught in art
108 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014: ---- DataCorruption BEGIN
109 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014:   NetMonInputDetail: Could not receive message!
110 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014: ---- DataCorruption END
111 1 John Freeman
Tue Jul 08 14:16:33 -0500 2014: %MSG
112 27 John Freeman
Tue Jul 08 14:16:33 -0500 2014: %MSG-s ArtException:  Aggregator-lbnedaqtest01-5266 JobSetup
113 27 John Freeman
Tue Jul 08 14:16:33 -0500 2014: cet::exception caught in art
114 28 John Freeman
Tue Jul 08 14:16:33 -0500 2014: ---- DataCorruption BEGIN
115 28 John Freeman
Tue Jul 08 14:16:33 -0500 2014:   NetMonInputDetail: Could not receive message!
116 27 John Freeman
Tue Jul 08 14:16:33 -0500 2014: ---- DataCorruption END
117 27 John Freeman
</pre>
118 1 John Freeman
119 1 John Freeman
* *Troubleshooting*
120 1 John Freeman
** *Your change to daqinterface.py doesn't seem to do anything*
121 1 John Freeman
Make sure you kill the existing daqinterface process and restart it
122 1 John Freeman
** *On the initial transition ("lbnecmd init daq"), you see "error: [Errno 111] Connection refused"*
123 1 John Freeman
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.