1 #define TRACE_NAME "TransferOutput"
3 #include "art/Framework/Core/ModuleMacros.h"
4 #include "art/Framework/Core/OutputModule.h"
5 #include "art/Framework/Principal/EventPrincipal.h"
6 #include "art/Framework/Principal/OutputHandle.h"
7 #include "art/Framework/Principal/RunPrincipal.h"
8 #include "art/Framework/Principal/SubRunPrincipal.h"
9 #include "art/Framework/Services/Registry/ServiceHandle.h"
10 #if ART_HEX_VERSION < 0x20900
11 #include "art/Persistency/Provenance/BranchIDListRegistry.h"
12 #include "canvas/Persistency/Provenance/BranchIDList.h"
14 #include "art/Persistency/Provenance/ProcessHistoryRegistry.h"
15 #include "art/Persistency/Provenance/ProductMetaData.h"
17 #include "canvas/Persistency/Provenance/BranchDescription.h"
18 #include "canvas/Persistency/Provenance/BranchKey.h"
19 #include "canvas/Persistency/Provenance/History.h"
20 #include "canvas/Persistency/Provenance/ParentageRegistry.h"
21 #include "canvas/Persistency/Provenance/ProcessConfiguration.h"
22 #include "canvas/Persistency/Provenance/ProcessConfigurationID.h"
23 #include "canvas/Persistency/Provenance/ProcessHistoryID.h"
24 #include "canvas/Persistency/Provenance/ProductList.h"
25 #include "canvas/Persistency/Provenance/ProductProvenance.h"
26 #include "canvas/Persistency/Provenance/RunAuxiliary.h"
27 #include "canvas/Persistency/Provenance/SubRunAuxiliary.h"
28 #include "canvas/Utilities/DebugMacros.h"
29 #include "canvas/Utilities/Exception.h"
30 #include "cetlib/column_width.h"
31 #include "cetlib/lpad.h"
32 #include "cetlib/rpad.h"
35 #include "fhiclcpp/ParameterSet.h"
36 #include "fhiclcpp/ParameterSetID.h"
37 #include "fhiclcpp/ParameterSetRegistry.h"
39 #include "artdaq/TransferPlugins/TransferInterface.hh"
40 #include "artdaq/TransferPlugins/MakeTransferPlugin.hh"
41 #include "artdaq-core/Data/detail/ParentageMap.hh"
42 #include "artdaq/DAQdata/Globals.hh"
43 #include "artdaq/DAQdata/NetMonHeader.hh"
85 virtual void openFile(FileBlock
const&);
87 virtual void closeFile();
89 virtual void respondToCloseInputFile(FileBlock
const&);
91 virtual void respondToCloseOutputFiles(FileBlock
const&);
93 virtual void endJob();
95 virtual void write(EventPrincipal&);
97 virtual void writeRun(RunPrincipal&);
99 virtual void writeSubRun(SubRunPrincipal&);
101 void writeDataProducts(TBufferFile&,
const Principal&,
102 std::vector<BranchKey*>&);
106 size_t send_timeout_us_;
107 size_t send_retry_count_;
108 std::unique_ptr<artdaq::TransferInterface> transfer_;
110 void sendMessage_(uint64_t sequenceId, uint8_t messageType, TBufferFile& msg);
111 void send_init_message();
118 , initMsgSent_(false)
119 , send_timeout_us_(ps.get<size_t>(
"send_timeout_us", 5000000))
120 , send_retry_count_(ps.get<size_t>(
"send_retry_count", 5))
122 TLOG(TLVL_DEBUG) <<
"Begin: TransferOutput::TransferOutput(ParameterSet const& ps)";
124 TLOG(TLVL_DEBUG) <<
"END: TransferOutput::TransferOutput";
130 TLOG(TLVL_DEBUG) <<
"Begin: TransferOutput::~TransferOutput()";
132 auto sts = transfer_->moveFragment(std::move(*artdaq::Fragment::eodFrag(0)));
134 transfer_.reset(
nullptr);
135 TLOG(TLVL_DEBUG) <<
"End: TransferOutput::~TransferOutput()";
139 art::TransferOutput::
140 openFile(FileBlock
const&)
142 TLOG(TLVL_TRACE) <<
"Begin/End: TransferOutput::openFile(const FileBlock&)";
146 art::TransferOutput::
149 TLOG(TLVL_TRACE) <<
"Begin/End: TransferOutput::closeFile()";
153 art::TransferOutput::
154 respondToCloseInputFile(FileBlock
const&)
156 TLOG(TLVL_TRACE) <<
"Begin/End: TransferOutput::" <<
157 "respondToCloseOutputFiles(FileBlock const&)";
161 art::TransferOutput::
162 respondToCloseOutputFiles(FileBlock
const&)
164 TLOG(TLVL_TRACE) <<
"Begin/End: TransferOutput::" <<
165 "respondToCloseOutputFiles(FileBlock const&)";
169 art::TransferOutput::
172 TLOG(TLVL_TRACE) <<
"Begin: TransferOutput::endJob()";
178 art::TransferOutput::
181 TLOG(TLVL_TRACE) <<
"Begin: TransferOutput static send_init_message()";
191 static TClass* product_list_class = TClass::GetClass(
192 "std::map<art::BranchKey,art::BranchDescription>");
193 if (product_list_class ==
nullptr)
195 throw art::Exception(art::errors::DictionaryNotFound) <<
196 "TransferOutput static send_init_message(): "
197 "Could not get TClass for "
198 "map<art::BranchKey,art::BranchDescription>!";
204 static TClass* process_history_map_class = TClass::GetClass(
205 "std::map<const art::Hash<2>,art::ProcessHistory>");
206 if (process_history_map_class ==
nullptr)
208 throw art::Exception(art::errors::DictionaryNotFound) <<
209 "TransferOutput static send_init_message(): "
210 "Could not get class for "
211 "std::map<const art::Hash<2>,art::ProcessHistory>!";
216 static TClass* parentage_map_class = TClass::GetClass(
"art::ParentageMap");
217 if (parentage_map_class ==
nullptr)
219 throw art::Exception(art::errors::DictionaryNotFound) <<
220 "TransferOutput static send_init_message(): "
221 "Could not get class for ParentageMap";
226 TBufferFile msg(TBuffer::kWrite);
231 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): "
232 "Streaming message type code ...";
234 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): "
235 "Finished streaming message type code.";
240 unsigned long ps_cnt = fhicl::ParameterSetRegistry::size();
241 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): parameter set count: " << std::to_string(ps_cnt);
242 msg.WriteULong(ps_cnt);
243 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): Streaming parameter sets ...";
245 auto I = std::begin(fhicl::ParameterSetRegistry::get()),
246 E = std::end(fhicl::ParameterSetRegistry::get());
249 std::string pset_str = I->second.to_string();
251 msg.WriteStdString(pset_str);
253 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): Finished streaming parameter sets.";
258 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): Streaming MasterProductRegistry ...";;
259 art::ProductList productList(art::ProductMetaData::instance().productList());
260 msg.WriteObjectAny(&productList, product_list_class);
261 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): Finished streaming MasterProductRegistry.";
263 #if ART_HEX_VERSION < 0x20900
267 if (art::debugit() >= 2)
272 art::BranchIDLists
const * bilr =
273 &art::BranchIDListRegistry::instance().data();
274 TLOG(TLVL_TRACE) <<
"TransferOutput static send_init_message(): " <<
"Content of BranchIDLists";
275 int max_bli = bilr->size();
276 TLOG(TLVL_TRACE) <<
"TransferOutput static send_init_message(): " <<
277 "max_bli: " << max_bli;
278 for (
int i = 0; i < max_bli; ++i)
280 int max_prdidx = (*bilr)[i].size();
281 TLOG(TLVL_TRACE) <<
"TransferOutput static send_init_message(): " <<
282 "max_prdidx: " << max_prdidx;
283 for (
int j = 0; j < max_prdidx; ++j)
285 TLOG(TLVL_TRACE) <<
"TransferOutput static send_init_message(): " <<
288 <<
" bid: 0x" << std::hex
289 <<
static_cast<unsigned long>((*bilr)[i][j])
296 art::ProcessHistoryMap phr;
297 for (
auto const& pr : art::ProcessHistoryRegistry::get())
304 if (art::debugit() >= 1)
306 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): "
307 "Dumping ProcessHistoryRegistry ...";
310 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): " <<
311 "phr: size: " + std::to_string(phr.size());
312 for (
auto I = phr.begin(), E = phr.end(); I != E; ++I)
314 std::ostringstream OS;
316 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): " <<
317 "phr: id: '" + OS.str() +
"'";
324 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): " <<
325 "Streaming ProcessHistoryRegistry ...";
328 const art::ProcessHistoryMap& phm = phr;
329 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): " <<
330 "phm: size: " << std::to_string(phm.size());
331 msg.WriteObjectAny(&phm, process_history_map_class);
332 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): " <<
333 "Finished streaming ProcessHistoryRegistry.";
339 TLOG(TLVL_DEBUG) <<
"TransferOutput static send_init_message(): " <<
340 "Streaming ParentageRegistry ... sz=" << std::to_string(msg.Length());
342 art::ParentageMap parentageMap{};
343 for (
auto const& pr : art::ParentageRegistry::get())
345 parentageMap.emplace(pr.first, pr.second);
348 TLOG(TLVL_TRACE) <<
"Before WriteObjectAny ParentageMap";
352 msg.WriteObjectAny(&parentageMap, parentage_map_class);
353 TLOG(TLVL_TRACE) <<
"After WriteObjectAny ParentageMap";
355 TLOG(TLVL_DEBUG) <<
"TransferOutput: TransferOutput static send_init_message(): " <<
356 "Finished streaming ParentageRegistry." <<
" sts=" << sts <<
", sz=" << std::to_string(msg.Length());
363 TLOG(TLVL_DEBUG) <<
"TransferOutput: TransferOutput static send_init_message(): " <<
"Sending the init message.";
364 sendMessage_(artdaq::Fragment::InvalidSequenceID - 1, artdaq::Fragment::InitFragmentType, msg);
365 TLOG(TLVL_TRACE) <<
" TransferOutput static send_init_message(): "
366 "Init message(s) sent.";
368 TLOG(TLVL_TRACE) <<
" End: TransferOutput static send_init_message()";
371 #//pragma GCC pop_options
374 art::TransferOutput::
375 writeDataProducts(TBufferFile& msg,
const Principal& principal,
376 std::vector<BranchKey*>& bkv)
378 TLOG(TLVL_TRACE) <<
" Begin: TransferOutput::writeDataProducts(...)";
383 static TClass* branch_key_class = TClass::GetClass(
"art::BranchKey");
384 if (branch_key_class ==
nullptr)
386 throw art::Exception(art::errors::DictionaryNotFound) <<
387 "TransferOutput::writeDataProducts(...): "
388 "Could not get TClass for art::BranchKey!";
390 static TClass* prdprov_class = TClass::GetClass(
"art::ProductProvenance");
391 if (prdprov_class ==
nullptr)
393 throw art::Exception(art::errors::DictionaryNotFound) <<
394 "TransferOutput::writeDataProducts(...): "
395 "Could not get TClass for art::ProductProvenance!";
400 unsigned long prd_cnt = 0;
402 for (
auto I = principal.begin(), E = principal.end(); I != E; ++I)
404 #if ART_HEX_VERSION > 0x20800
405 auto const& productDescription = I->second->productDescription();
406 auto const& refs = keptProducts()[productDescription.branchType()];
408 for (
auto const& ref : refs)
410 if (*ref == productDescription)
416 if (I->second->productUnavailable() || !found)
421 if (I->second->productUnavailable() || !selected(I->second->productDescription()))
433 TLOG(TLVL_TRACE) <<
" TransferOutput::writeDataProducts(...): "
434 "Streaming product count: " << std::to_string(prd_cnt);
435 msg.WriteULong(prd_cnt);
436 TLOG(TLVL_TRACE) <<
" TransferOutput::writeDataProducts(...): "
437 "Finished streaming product count.";
449 bkv.reserve(prd_cnt);
451 for (
auto I = principal.begin(), E = principal.end(); I != E; ++I)
453 #if ART_HEX_VERSION > 0x20800
454 auto const& productDescription = I->second->productDescription();
455 auto const& refs = keptProducts()[productDescription.branchType()];
457 for (
auto const& ref : refs)
459 if (*ref == productDescription)
465 if (I->second->productUnavailable() || !found)
470 if (I->second->productUnavailable() || !selected(I->second->productDescription()))
476 const BranchDescription& bd(I->second->productDescription());
477 bkv.push_back(
new BranchKey(bd));
478 if (art::debugit() >= 2)
480 TLOG(TLVL_TRACE) <<
"TransferOutput::writeDataProducts(...): "
481 "Dumping branch key of class: '"
482 << bkv.back()->friendlyClassName_
484 << bkv.back()->moduleLabel_
486 << bkv.back()->productInstanceName_
488 << bkv.back()->processName_
492 TLOG(TLVL_TRACE) <<
" TransferOutput::writeDataProducts(...): "
493 "Streaming branch key of class: '"
494 + bd.producedClassName()
498 + bd.productInstanceName()
502 msg.WriteObjectAny(bkv.back(), branch_key_class);
505 TLOG(TLVL_TRACE) <<
" TransferOutput::writeDataProducts(...): "
506 "Streaming product of class: '"
507 + bd.producedClassName()
511 + bd.productInstanceName()
515 #if ART_HEX_VERSION > 0x20800
516 OutputHandle oh = principal.getForOutput(bd.productID(),
true);
518 OutputHandle oh = principal.getForOutput(bd.branchID(),
true);
520 const EDProduct* prd = oh.wrapper();
521 msg.WriteObjectAny(prd, TClass::GetClass(bd.wrappedName().c_str()));
524 TLOG(TLVL_TRACE) <<
" TransferOutput::writeDataProducts(...): "
525 "Streaming product provenance of class: '"
526 + bd.producedClassName()
530 + bd.productInstanceName()
534 const ProductProvenance* prdprov =
535 I->second->productProvenancePtr().get();
536 msg.WriteObjectAny(prdprov, prdprov_class);
539 TLOG(TLVL_TRACE) <<
" End: TransferOutput::writeDataProducts(...)";
543 art::TransferOutput::
544 write(EventPrincipal& ep)
549 TLOG(TLVL_TRACE) <<
" Begin: TransferOutput::"
550 "write(const EventPrincipal& ep)";
559 static TClass* run_aux_class = TClass::GetClass(
"art::RunAuxiliary");
560 if (run_aux_class ==
nullptr)
562 throw art::Exception(art::errors::DictionaryNotFound) <<
563 "TransferOutput::write(const EventPrincipal& ep): "
564 "Could not get TClass for art::RunAuxiliary!";
566 static TClass* subrun_aux_class = TClass::GetClass(
"art::SubRunAuxiliary");
567 if (subrun_aux_class ==
nullptr)
569 throw art::Exception(art::errors::DictionaryNotFound) <<
570 "TransferOutput::write(const EventPrincipal& ep): "
571 "Could not get TClass for art::SubRunAuxiliary!";
573 static TClass* event_aux_class = TClass::GetClass(
"art::EventAuxiliary");
574 if (event_aux_class ==
nullptr)
576 throw art::Exception(art::errors::DictionaryNotFound) <<
577 "TransferOutput::write(const EventPrincipal& ep): "
578 "Could not get TClass for art::EventAuxiliary!";
580 static TClass* history_class = TClass::GetClass(
"art::History");
581 if (history_class ==
nullptr)
583 throw art::Exception(art::errors::DictionaryNotFound) <<
584 "TransferOutput::write(const EventPrincipal& ep): "
585 "Could not get TClass for art::History!";
590 TBufferFile msg(TBuffer::kWrite);
596 TLOG(TLVL_TRACE) <<
" TransferOutput::write(const EventPrincipal& ep): "
597 "Streaming message type code ...";
599 TLOG(TLVL_TRACE) <<
" TransferOutput::write(const EventPrincipal& ep): "
600 "Finished streaming message type code.";
606 TLOG(TLVL_TRACE) <<
" TransferOutput::write(const EventPrincipal& ep): "
607 "Streaming RunAuxiliary ...";
608 msg.WriteObjectAny(&ep.subRunPrincipal().runPrincipal().aux(),
610 TLOG(TLVL_TRACE) <<
" TransferOutput::write(const EventPrincipal& ep): "
611 "Finished streaming RunAuxiliary.";
617 TLOG(TLVL_TRACE) <<
" TransferOutput::write(const EventPrincipal& ep): "
618 "Streaming SubRunAuxiliary ...";
619 msg.WriteObjectAny(&ep.subRunPrincipal().aux(),
621 TLOG(TLVL_TRACE) <<
" TransferOutput::write(const EventPrincipal& ep): "
622 "Finished streaming SubRunAuxiliary.";
628 TLOG(TLVL_TRACE) <<
" TransferOutput::write(const EventPrincipal& ep): "
629 "Streaming EventAuxiliary ...";
630 msg.WriteObjectAny(&ep.aux(), event_aux_class);
631 TLOG(TLVL_TRACE) <<
" TransferOutput::write(const EventPrincipal& ep): "
632 "Finished streaming EventAuxiliary.";
638 TLOG(TLVL_TRACE) <<
" TransferOutput::write(const EventPrincipal& ep): "
639 "Streaming History ...";
640 msg.WriteObjectAny(&ep.history(), history_class);
641 TLOG(TLVL_TRACE) <<
" TransferOutput::write(const EventPrincipal& ep): "
642 "Finished streaming History.";
647 std::vector<BranchKey*> bkv;
648 writeDataProducts(msg, ep, bkv);
653 TLOG(TLVL_TRACE) <<
" TransferOutput::write(const EventPrincipal& ep): "
654 "Sending a message ...";
655 sendMessage_(ep.id().event(), artdaq::Fragment::DataFragmentType, msg);
656 TLOG(TLVL_TRACE) <<
" TransferOutput::write(const EventPrincipal& ep): "
662 for (
auto I = bkv.begin(), E = bkv.end(); I != E; ++I)
667 TLOG(TLVL_TRACE) <<
" End: TransferOutput::write(const EventPrincipal& ep)";
671 art::TransferOutput::
672 writeRun(RunPrincipal& rp)
677 TLOG(TLVL_TRACE) <<
" Begin: TransferOutput::writeRun(const RunPrincipal& rp)";
689 static TClass* run_aux_class = TClass::GetClass(
"art::RunAuxiliary");
690 assert(run_aux_class !=
nullptr &&
"writeRun: Could not get TClass for "
691 "art::RunAuxiliary!");
695 TBufferFile msg(TBuffer::kWrite);
701 TLOG(TLVL_TRACE) <<
" writeRun: streaming message type code ...");
703 TLOG(TLVL_TRACE) <<
" writeRun: finished streaming message type code.");
709 TLOG(TLVL_TRACE) <<
" writeRun: streaming RunAuxiliary ...");
710 if (art::debugit() >= 1)
712 TLOG(TLVL_TRACE) <<
" writeRun: dumping ProcessHistoryRegistry ...");
715 art::ProcessHistoryMap
const& phr =
716 art::ProcessHistoryRegistry::get();
717 TLOG(TLVL_TRACE) <<
" writeRun: phr: size: " << phr.size() <<
'\n';
718 for (
auto I = phr.begin(), E = phr.end(); I != E; ++I)
720 std::ostringstream OS;
722 TLOG(TLVL_TRACE) <<
" writeRun: phr: id: '" << OS.str() <<
"'");
724 TLOG(TLVL_TRACE) <<
" writeRun: phr: data.size(): "
725 << I->second.data().size() <<
'\n';
726 if (I->second.data().size())
728 I->second.data().back().id().print(OS);
729 TLOG(TLVL_TRACE) <<
" writeRun: phr: data.back().id(): '"
733 if (!rp.aux().processHistoryID().isValid())
735 TLOG(TLVL_TRACE) <<
" writeRun: ProcessHistoryID: 'INVALID'");
739 std::ostringstream OS;
740 rp.aux().processHistoryID().print(OS);
741 TLOG(TLVL_TRACE) <<
" writeRun: ProcessHistoryID: '"
744 const ProcessHistory& processHistory =
745 ProcessHistoryRegistry::get(rp.aux().processHistoryID());
746 if (processHistory.data().size())
749 processHistory.data().back().id().print(OS);
750 TLOG(TLVL_TRACE) <<
" writeRun: ProcessConfigurationID: '"
753 TLOG(TLVL_TRACE) <<
" writeRun: ProcessConfiguration: '"
754 << processHistory.data().back() <<
'\n';
758 msg.WriteObjectAny(&rp.aux(), run_aux_class);
759 TLOG(TLVL_TRACE) <<
" writeRun: streamed RunAuxiliary.");
764 std::vector<BranchKey*> bkv;
765 writeDataProducts(msg, rp, bkv);
770 TLOG(TLVL_TRACE) <<
" writeRun: sending a message ...");
771 sendMessage_(0, artdaq::Fragment::EndOfRunFragmentType, msg);
772 TLOG(TLVL_TRACE) <<
" writeRun: message sent.");
777 for (
auto I = bkv.begin(), E = bkv.end(); I != E; ++I)
783 TLOG(TLVL_TRACE) <<
" End: TransferOutput::writeRun(const RunPrincipal& rp)";
787 art::TransferOutput::writeSubRun(SubRunPrincipal& srp)
792 TLOG(TLVL_TRACE) <<
" Begin: TransferOutput::"
793 "writeSubRun(const SubRunPrincipal& srp)";
803 static TClass* subrun_aux_class = TClass::GetClass(
"art::SubRunAuxiliary");
804 if (subrun_aux_class ==
nullptr)
806 throw art::Exception(art::errors::DictionaryNotFound) <<
807 "TransferOutput::writeSubRun: "
808 "Could not get TClass for art::SubRunAuxiliary!";
813 TBufferFile msg(TBuffer::kWrite);
819 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: "
820 "streaming message type code ...";
822 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: "
823 "finished streaming message type code.";
829 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: "
830 "streaming SubRunAuxiliary ...";
831 if (art::debugit() >= 1)
833 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: "
834 "dumping ProcessHistoryRegistry ...";
837 for (
auto I = std::begin(art::ProcessHistoryRegistry::get())
838 , E = std::end(art::ProcessHistoryRegistry::get()); I != E; ++I)
840 std::ostringstream OS;
842 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: "
843 "phr: id: '" + OS.str() +
"'";
845 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: "
846 "phr: data.size(): " << std::to_string(I->second.data().size());
847 if (I->second.data().size())
849 I->second.data().back().id().print(OS);
850 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: "
851 "phr: data.back().id(): '"
855 if (!srp.aux().processHistoryID().isValid())
857 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: "
858 "ProcessHistoryID: 'INVALID'";;
862 std::ostringstream OS;
863 srp.aux().processHistoryID().print(OS);
864 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: ProcessHistoryID: '"
867 ProcessHistory processHistory;
868 ProcessHistoryRegistry::get(srp.aux().processHistoryID(), processHistory);
869 if (processHistory.data().size())
872 processHistory.data().back().id().print(OS);
873 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: "
874 "ProcessConfigurationID: '"
877 OS << processHistory.data().back();
878 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: "
879 "ProcessConfiguration: '"
884 msg.WriteObjectAny(&srp.aux(), subrun_aux_class);
885 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: streamed SubRunAuxiliary.";
890 std::vector<BranchKey*> bkv;
891 writeDataProducts(msg, srp, bkv);
896 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: "
897 "Sending the EndOfSubrun message.";
898 sendMessage_(0, artdaq::Fragment::EndOfSubrunFragmentType, msg);
899 TLOG(TLVL_TRACE) <<
" TransferOutput::writeSubRun: "
900 "EndOfSubrun message(s) sent.";
906 for (
auto I = bkv.begin(), E = bkv.end(); I != E; ++I)
911 TLOG(TLVL_TRACE) <<
" End: TransferOutput::writeSubRun(const SubRunPrincipal& srp)";
916 art::TransferOutput::sendMessage_(uint64_t sequenceId, uint8_t messageType, TBufferFile& msg)
918 TLOG(TLVL_DEBUG) <<
"Sending message with sequenceID=" << std::to_string(sequenceId) <<
", type=" << std::to_string(messageType) <<
", length=" << std::to_string(msg.Length());
920 header.
data_length =
static_cast<uint64_t
>(msg.Length());
922 fragment(std::ceil(msg.Length() /
923 static_cast<double>(
sizeof(artdaq::RawDataType))),
924 sequenceId, 0, messageType, header);
926 memcpy(&*fragment.dataBegin(), msg.Buffer(), msg.Length());
931 sts = transfer_->copyFragment(fragment, send_timeout_us_);
936 if (messageType == artdaq::Fragment::InitFragmentType)
938 std::fstream ostream(
"sendInitMessage_TransferOutput.bin", std::ios::out | std::ios::binary);
939 ostream.write(msg.Buffer(), msg.Length());
~TransferOutput()
TransferOutput Destructor.
std::unique_ptr< artdaq::TransferInterface > MakeTransferPlugin(const fhicl::ParameterSet &pset, 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...
This TransferInterface is a Sender.
Some error occurred, but no exception was thrown.
The send operation completed successfully.