1 #include "TRACE/tracemf.h"
2 #define TRACE_NAME "TransferOutput"
3 #include "artdaq/ArtModules/ArtdaqOutput.hh"
6 #include "art/Framework/Core/ModuleMacros.h"
7 #include "artdaq/DAQdata/NetMonHeader.hh"
8 #include "artdaq/TransferPlugins/MakeTransferPlugin.hh"
9 #include "artdaq/TransferPlugins/TransferInterface.hh"
42 void SendMessage(artdaq::FragmentPtr& fragment)
override;
50 size_t send_timeout_us_;
51 size_t send_retry_count_;
52 std::unique_ptr<artdaq::TransferInterface> transfer_;
56 :
ArtdaqOutput(ps), send_timeout_us_(ps.get<size_t>(
"send_timeout_us", 5000000)), send_retry_count_(ps.get<size_t>(
"send_retry_count", 5))
58 TLOG(TLVL_DEBUG + 32) <<
"Begin: TransferOutput::TransferOutput(ParameterSet const& ps)";
60 TLOG(TLVL_DEBUG + 32) <<
"END: TransferOutput::TransferOutput";
65 TLOG(TLVL_DEBUG + 32) <<
"Begin: TransferOutput::~TransferOutput()";
67 auto sts = transfer_->transfer_fragment_min_blocking_mode(*artdaq::Fragment::eodFrag(0), 10000);
70 TLOG(TLVL_ERROR) <<
"Error sending EOD Fragment!";
72 transfer_.reset(
nullptr);
73 TLOG(TLVL_DEBUG + 32) <<
"End: TransferOutput::~TransferOutput()";
78 TLOG(TLVL_DEBUG + 32) <<
"Sending message with sequenceID=" << fragment->sequenceID() <<
", type=" <<
static_cast<int>(fragment->type())
79 <<
", length=" << fragment->dataSizeBytes();
84 sts = transfer_->transfer_fragment_min_blocking_mode(*fragment, send_timeout_us_);
87 if (retries > send_retry_count_)
89 TLOG(TLVL_ERROR) <<
"Error communicating with remote after " << retries <<
" tries. Closing art process";
90 kill(getpid(), SIGUSR2);
94 if (messageType == artdaq::Fragment::InitFragmentType)
96 std::fstream ostream(
"sendInitMessage_TransferOutput.bin", std::ios::out | std::ios::binary);
97 ostream.write(msg.Buffer(), msg.Length());
This is the base class for artdaq OutputModules, providing the serialization interface for art Events...
std::unique_ptr< artdaq::TransferInterface > MakeTransferPlugin(const fhicl::ParameterSet &pset, const std::string &plugin_label, TransferInterface::Role role)
Load a TransferInterface plugin.
TransferOutput(fhicl::ParameterSet const &ps)
TransferOutput Constructor.
An art::OutputModule which sends events using DataSenderManager. This module is designed for transpor...
void SendMessage(artdaq::FragmentPtr &fragment) override
Send a message using the Transfer Plugin
This TransferInterface is a Sender.
Some error occurred, but no exception was thrown.
The send operation completed successfully.
~TransferOutput() override
TransferOutput Destructor.