Running DAQ Interface » History » Version 29

John Freeman, 07/14/2014 06:03 PM

1 1 John Freeman
h1. Running DAQ Interface
2 1 John Freeman
3 1 John Freeman
DAQ Interface is designed to be run, along with rest of the run control code, on . To obtain an account on this system, contact John Freeman, . Once you have an account, you may do the following:
4 1 John Freeman
5 1 John Freeman
* *Check out the run control software*:
6 1 John Freeman
7 12 John Freeman
 Create a new directory, cd into it, and execute <pre>git clone ssh://</pre>
8 1 John Freeman
9 2 John Freeman
* *Make sure you're on the feature/DAQInterface branch*
10 3 John Freeman
cd into lbnerc/, and execute
11 2 John Freeman
<pre>git checkout feature/DAQInterface </pre>
12 2 John Freeman
13 1 John Freeman
* *Set up the environment*: 
14 25 John Freeman
From the lbnerc/ directory, execute <pre>source source_me</pre> This will both create a local build of /usr/local/lbne-artdaq-base/lbne-artaq, as well as set up the Python virtual environment needed by the LBNE RC code in the parent directory of lbnerc, in a directory call "env" (in other words, "env" and "lbnerc" are at the same level of the directory hierarchy on the system). If this is the first time you've build lbne-artdaq and/or set up the Python virtual environment, each process will take roughly two minutes. Note that while there will be a few error/warning messages displayed at different points of the setup, at the end you should see <pre>Environment ready; consider running the unit tests via command nosetests</pre>
15 24 John Freeman
n.b. As of 7/8/14 if you run <code>nosetests</code> 4 of the 65 tests will fail; more than this, and there may be a problem which will affect the running of DAQInterface.  The most likely cause is that an lbnecontrol and/or daqinterface process is already running (described right below).
16 13 John Freeman
17 18 John Freeman
* *Start LBNE run 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>" 
18 1 John Freeman
19 1 John Freeman
* *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
20 1 John Freeman
21 1 John Freeman
* *Take DAQ Interface through the standard transitions* : 
22 20 John Freeman
Fire up a new shell/terminal in which the artdaq processes are launched, and initialize them with FHiCL documents, by executing the following:
23 1 John Freeman
24 1 John Freeman
lbnecmd init daq
25 1 John Freeman
26 1 John Freeman
Start the toy fragment generator, which produces simulated CAEN board data, and plot the data using an Art module:
27 1 John Freeman
28 1 John Freeman
lbnecmd start daq
29 1 John Freeman
30 4 John Freeman
Pause it, ending the subrun but not the run:
31 4 John Freeman
32 4 John Freeman
lbnecmd pause daq
33 4 John Freeman
34 4 John Freeman
Resume DAQ running:
35 4 John Freeman
36 4 John Freeman
lbnecmd resume daq
37 4 John Freeman
38 1 John Freeman
Halt the running of the DAQ:
39 1 John Freeman
40 1 John Freeman
lbnecmd stop daq
41 1 John Freeman
42 1 John Freeman
Kill all the artdaq processes:
43 1 John Freeman
44 1 John Freeman
lbnecmd terminate daq
45 1 John Freeman
46 1 John Freeman
47 27 John Freeman
48 29 John Freeman
* *A Closer Look*
49 29 John Freeman
50 29 John Freeman
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:
51 29 John Freeman
52 29 John Freeman
53 29 John Freeman
# This list of fcl files, when read in by DAQInterface, will be used
54 29 John Freeman
# to initialize the artdaq processes
55 29 John Freeman
56 29 John Freeman
57 29 John Freeman
58 29 John Freeman
59 29 John Freeman
60 29 John Freeman
61 29 John Freeman
62 29 John Freeman
63 29 John Freeman
64 29 John Freeman
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:
65 29 John Freeman
# 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 
66 29 John Freeman
# Order matters: BoardReaderMain documents should be listed before EventBuilderMain documents which in turn should be listed before AggregatorMain documents
67 29 John Freeman
68 29 John Freeman
69 29 John Freeman
* *Error handling*
70 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:
71 22 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
72 21 John Freeman
# During periodic checks, one or more artdaq processes expected to exist are not found
73 1 John Freeman
74 21 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). 
75 21 John Freeman
76 29 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 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. 
77 18 John Freeman
78 19 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:
79 18 John Freeman
80 18 John Freeman
81 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014:  Time Summary: 
82 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014:  Min: 0
83 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014:  Max: 0
84 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014:  Avg: inf
85 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014: %MSG-s ArtException:  Aggregator-lbnedaqtest01-5265 JobSetup
86 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014: cet::exception caught in art
87 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014: ---- DataCorruption BEGIN
88 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014:   NetMonInputDetail: Could not receive message!
89 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014: ---- DataCorruption END
90 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014: %MSG
91 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014: %MSG-s ArtException:  Aggregator-lbnedaqtest01-5266 JobSetup
92 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014: cet::exception caught in art
93 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014: ---- DataCorruption BEGIN
94 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014:   NetMonInputDetail: Could not receive message!
95 18 John Freeman
Tue Jul 08 14:16:33 -0500 2014: ---- DataCorruption END
96 1 John Freeman
97 27 John Freeman
98 27 John Freeman
* *Troubleshooting*
99 28 John Freeman
** *Your change to doesn't seem to do anything*
100 28 John Freeman
Make sure you kill the existing daqinterface process and restart it
101 27 John Freeman
** *On the initial transition ("lbnecmd init daq"), you see "error: [Errno 111] Connection refused"*
102 27 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 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.