DAQInterface should be able to send messages to MessageViewer
One of the SBN needs Gennadiy presented at yesterday's meeting, and which was generally approved by the group, was the ability to see DAQInterface messages appear in MessageViewer since their GUI wrapper makes viewing DAQInterface messages harder than if they were running DAQInterface at the command line. Eric pointed out to me last week that a good start on this would be to review Issue #21799, which concerns the addition of functionality in artdaq-utilities and artdaq which makes this easier to implement.
JCF: Issue #23784: modified DAQInterface to send messages to MessageViewer given alterations to its environment as described in point number 2 of my Dec-30-2019 comment on Issue 21799
JCF: Issue #23784: if swig_artdaq is imported, ARTDAQ_LOG_FHICL needs to be properly set
In order for an instance of swig_artdaq to send messages to
messageviewer, ARTDAQ_LOG_FHICL needs to be set to point to a FHiCL
document which defines the udp port MessageViewer's listening
on. Consequently, if swig_artdaq is imported, DAQInterface will create
this document if necessary, and also require that ARTDAQ_LOG_FHICL
already be pointing to it.
#2 Updated by John Freeman 3 months ago
- % Done changed from 0 to 100
- Status changed from New to Resolved
This issue is resolved with commit b1e4e5c88d9231951a5f30286a895e328db39c8b at the head of feature/23784_send_to_messageviewer. If DAQInterface isn't able to successfully import swig_artdaq from the python_artdaq module, it will proceed as it always has - i.e., this change is backwards compatible. However, if it is able to, the following will be the case:
1) DAQInterface will make sure that the user has already pointed the environment variable ARTDAQ_LOG_FHICL to the name of the FHiCL document which defines the host and port messageviewer's listening on and which may be auto-generated by DAQInterface. If ARTDAQ_LOG_FHICL doesn't exist or isn't set properly, DAQInterface willl throw an exception telling the user to set ARTDAQ_LOG_FHICL.
2) Assuming use_messageviewer isn't set to "false" in $DAQINTERFACE_SETTINGS, DAQInterface will use an instance of swig_artdaq to output messages, rather than traditional python print statements. These messages will appear both in the MessageViewer for the partition in question and in the console (and hence the logfile in $DAQINTERFACE_LOGDIR).
#4 Updated by Gennadiy Lukhanin 2 months ago
Works as described on mu2edaq13.
bash-4.2$ tshow |grep DAQInterface_partition_9 |head -5 12 1580533139715539 106867 106867 2 MessageFacility nfo . external-mu2edaq13-0, DAQInterface_partition_9: swig_artdaq.cpp:72 ==> Fri Jan 31 22:58:59 CST 2020: DAQInterface in partition 9 launched and now in "stopped" state, listening on port 19000 13 1580533139715470 106867 106867 2 DAQInterface_partition_9 nfo . Fri Jan 31 22:58:59 CST 2020: DAQInterface in partition 9 launched and now in "stopped" state, listening on port 19000 21225 1580532969749614 61511 61511 15 MessageFacility nfo . external-mu2edaq13-0, DAQInterface_partition_9: swig_artdaq.cpp:72 ==> Fri Jan 31 22:56:09 CST 2020: DAQInterface on partition 9 caught kill signal 15 21226 1580532969749509 61511 61511 15 DAQInterface_partition_9 nfo . Fri Jan 31 22:56:09 CST 2020: DAQInterface on partition 9 caught kill signal 15 21227 1580532943198837 61511 61520 16 MessageFacility nfo . external-mu2edaq13-0, DAQInterface_partition_9: swig_artdaq.cpp:72 ==> ;De