Bug #21360

DAQInterface should have per-partition MessageViewers

Added by John Freeman over 2 years ago. Updated over 2 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


Right now, regardless of the partition, DAQInterface will launch a MessageViewer listening on port 30000 and then construct a FHiCL snippet instructing artdaq processes to send messages to a MessageViewer listening on port 30000 (the default value in artdaq-mfextension's msgviewer.fcl file). DAQInterface should use the per-partition port values suggested in to ensure each partition has its own MessageViewer.

Associated revisions

Revision bdc3c1b7 (diff)
Added by John Freeman over 2 years ago

JCF: support per-partition messageviewers to satisfy Issue #21360

Before this commit, it was always the case that port 30000 was used to
send MessageFacility messages via UDP to a messageviewer
instance. This is obviously incompatible with multiple partitions
operating in parallel on a host, so now each partition gets its own
messageviewer listening on its own port, where as per
the port is 10005 + (partition number)*1000.


#1 Updated by John Freeman over 2 years ago

In order to think about how best to implement this, first I'll lay out how DAQInterface currently behaves in regards to MessageViewer:

During the boot transition:
If use_messageviewer is set to true in the settings file (or not set at all, which means it defaults to true), AND
If there's not a MessageViewer instance already running in the terminal, AND
If artdaq-mfextensions gets set up by the DAQ setup script specified in the boot file, then:
Launch MessageViewer via

msgviewer -c $ARTDAQ_MFEXTENSIONS_DIR/fcl/msgviewer.fcl

Note that the msgviewer.fcl which appears in the artdaq-mfextensions package has the port hardwired in at a value of 30000.

Then later in the boot transition, just before launching the artdaq processes via pmt.rb, if we have the artdaq-mfextensions package available in the sense described above, then:
If the environment variable DAQINTERFACE_MESSAGEFACILITY_FHICL is set, take that to be the name of the file containing the FHiCL snippet controlling messages sent to MessageViewer, otherwise take the name of the file to be MessageFacility.fcl in the current working directory.
If this file doesn't already exist, automatically generate one, containing this snippet:

udp : { type : "UDP" threshold : "DEBUG"  port : 30000 host : <name of the host> }

...and pass the name of the FHiCL snippet file as an argument to --logfhicl in the pmt.rb argument list.

It seems that the requirements we'd ask for if we want MessageViewer to work for multiple partitions include:
  1. Each partition gets its own MessageViewer
  2. A different port mediates messages between an artdaq process and Messageviewer for each partition (i.e., we don't use the hardwired 30000)

To satisfy the first requirement, when launching MessageViewer, rather than passing it the msgviewer.fcl document which appears in the artdaq-mfextensions package, DAQInterface can make a copy of the document, replacing the 30000 with a partition-specific port number, and then use that document as the argument. Satisfying the second requirement is a bit trickier. Two options include:

  1. Using a different FHiCL document for each partition, where the different documents are identical with the exception of the port number. In this case I'm of course referring to the FHiCL document passed to pmt.rb's --logfhicl, not to the document used when launching MessageViewer.
  2. Using the same FHiCL document for each partition, but then having DAQInterface override the port number with its own partition-based value of the port. The advantage is that there's no danger of divergence across partitions as far as the code in the FHiCL document (e.g., one partition limiting the number of identical messages via a FHiCL setting, but the others not doing this), but the disadvantage is that this violates WYSIWYG, in that the port value in the document isn't necessarily the one that gets used.

#2 Updated by John Freeman over 2 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

With commit bdc3c1b70998dd0e9663e79970ee799ba57773fa on the develop branch, this Issue is satisfied. For a given partition, when DAQInterface launches a MessageViewer instance, instead of using $ARTDAQ_MFEXTENSIONS_DIR/fcl/msgviewer.fcl with its hardwired value of 30000, instead it creates a copy where it overwrites the 30000 with 10005 + partition_number*1000, as recommended in This copy is called "/tmp/msgviewer_partition<partition number>.fcl". It also takes overwrites the "port" key in the udp table it finds in the messagefacility FHiCL, saving the overwritten copy in "/tmp/messagefacility_partition<partition number>.fcl".

Also available in: Atom PDF