CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
evf::GlobalEvFOutputEventWriter Class Reference

Public Member Functions

bool close ()
 
void discardedCheck ()
 
void doOutputEvent (EventMsgBuilder const &msg, bool inc)
 
void doOutputEventAsync (std::unique_ptr< EventMsgBuilder > msg, edm::WaitingTaskHolder iHolder)
 
uint32 get_adler32 () const
 
unsigned long getAccepted () const
 
std::string const & getFilePath () const
 
 GlobalEvFOutputEventWriter (std::string const &filePath, unsigned int ls, std::shared_ptr< MetaDataCache const > iMetaData)
 
void incAccepted ()
 
edm::SerialTaskQueuequeue ()
 
void setMetaCache (std::shared_ptr< MetaDataCache const > iMetaData)
 
void throttledCheck ()
 
 ~GlobalEvFOutputEventWriter ()
 

Private Attributes

std::atomic< unsigned long > accepted_
 
bool discarded_ = false
 
std::string filePath_
 
const unsigned ls_
 
std::shared_ptr< MetaDataCache const > meta_
 
edm::propagate_const< std::unique_ptr< StreamerOutputFile > > stream_writer_events_
 
edm::SerialTaskQueue writeQueue_
 

Detailed Description

Definition at line 59 of file GlobalEvFOutputModule.cc.

Constructor & Destructor Documentation

◆ GlobalEvFOutputEventWriter()

evf::GlobalEvFOutputEventWriter::GlobalEvFOutputEventWriter ( std::string const &  filePath,
unsigned int  ls,
std::shared_ptr< MetaDataCache const >  iMetaData 
)
inlineexplicit

Definition at line 61 of file GlobalEvFOutputModule.cc.

65  ls_(ls),
66  accepted_(0),
68  meta_(std::move(iMetaData)) {}
std::atomic< unsigned long > accepted_
std::shared_ptr< MetaDataCache const > meta_
edm::propagate_const< std::unique_ptr< StreamerOutputFile > > stream_writer_events_
def move(src, dest)
Definition: eostools.py:511

◆ ~GlobalEvFOutputEventWriter()

evf::GlobalEvFOutputEventWriter::~GlobalEvFOutputEventWriter ( )
inline

Definition at line 70 of file GlobalEvFOutputModule.cc.

70 {}

Member Function Documentation

◆ close()

bool evf::GlobalEvFOutputEventWriter::close ( void  )
inline

Definition at line 74 of file GlobalEvFOutputModule.cc.

Referenced by esMonitoring.AsyncLineReaderMixin::handle_close(), and esMonitoring.FDJsonServer::handle_close().

74  {
75  stream_writer_events_->close();
76  return (discarded_ || edm::Service<evf::EvFDaqDirector>()->lumisectionDiscarded(ls_));
77  }
edm::propagate_const< std::unique_ptr< StreamerOutputFile > > stream_writer_events_

◆ discardedCheck()

void evf::GlobalEvFOutputEventWriter::discardedCheck ( )
inline

Definition at line 127 of file GlobalEvFOutputModule.cc.

127  {
128  if (!discarded_ && edm::Service<evf::EvFDaqDirector>()->lumisectionDiscarded(ls_)) {
129  edm::LogWarning("FedRawDataInputSource") << "Detected that the lumisection is discarded -: " << ls_;
130  discarded_ = true;
131  }
132  }
Log< level::Warning, false > LogWarning

◆ doOutputEvent()

void evf::GlobalEvFOutputEventWriter::doOutputEvent ( EventMsgBuilder const &  msg,
bool  inc 
)
inline

Definition at line 79 of file GlobalEvFOutputModule.cc.

References mps_check::msg.

79  {
80  EventMsgView eview(msg.startAddress());
81  stream_writer_events_->write(eview);
82  if (inc)
83  incAccepted();
84  }
tuple msg
Definition: mps_check.py:286
edm::propagate_const< std::unique_ptr< StreamerOutputFile > > stream_writer_events_

◆ doOutputEventAsync()

void evf::GlobalEvFOutputEventWriter::doOutputEventAsync ( std::unique_ptr< EventMsgBuilder msg,
edm::WaitingTaskHolder  iHolder 
)
inline

Definition at line 86 of file GlobalEvFOutputModule.cc.

References cms::cuda::assert(), edm::WaitingTaskHolder::group(), watchdog::group, visualization-live-secondInstance_cfg::m, eostools::move(), mps_check::msg, and createJobs::tmp.

86  {
89  if (discarded_) {
90  incAccepted();
91  msg.reset();
92  return;
93  }
94  auto group = iHolder.group();
95  writeQueue_.push(*group, [holder = std::move(iHolder), msg = msg.release(), this]() mutable {
96  try {
97  std::unique_ptr<EventMsgBuilder> own(msg);
98  if (meta_) {
99  auto m = std::move(meta_);
100  assert(m->builder_);
101  doOutputEvent(*m->builder_, false);
102  }
103  doOutputEvent(*msg, true); //msg is written and discarded at this point
104  } catch (...) {
105  auto tmp = holder;
106  tmp.doneWaiting(std::current_exception());
107  }
108  });
109  }
void doOutputEvent(EventMsgBuilder const &msg, bool inc)
void push(oneapi::tbb::task_group &, const T &iAction)
asynchronously pushes functor iAction into queue
assert(be >=bs)
oneapi::tbb::task_group * group() const noexcept
std::shared_ptr< MetaDataCache const > meta_
tuple msg
Definition: mps_check.py:286
tmp
align.sh
Definition: createJobs.py:716
def move(src, dest)
Definition: eostools.py:511

◆ get_adler32()

uint32 evf::GlobalEvFOutputEventWriter::get_adler32 ( ) const
inline

Definition at line 134 of file GlobalEvFOutputModule.cc.

134 { return stream_writer_events_->adler32(); }
edm::propagate_const< std::unique_ptr< StreamerOutputFile > > stream_writer_events_

◆ getAccepted()

unsigned long evf::GlobalEvFOutputEventWriter::getAccepted ( ) const
inline

Definition at line 138 of file GlobalEvFOutputModule.cc.

138 { return accepted_; }
std::atomic< unsigned long > accepted_

◆ getFilePath()

std::string const& evf::GlobalEvFOutputEventWriter::getFilePath ( ) const
inline

Definition at line 136 of file GlobalEvFOutputModule.cc.

◆ incAccepted()

void evf::GlobalEvFOutputEventWriter::incAccepted ( )
inline

Definition at line 139 of file GlobalEvFOutputModule.cc.

139 { accepted_++; }
std::atomic< unsigned long > accepted_

◆ queue()

edm::SerialTaskQueue& evf::GlobalEvFOutputEventWriter::queue ( )
inline

Definition at line 141 of file GlobalEvFOutputModule.cc.

141 { return writeQueue_; }

◆ setMetaCache()

void evf::GlobalEvFOutputEventWriter::setMetaCache ( std::shared_ptr< MetaDataCache const >  iMetaData)
inline

Definition at line 72 of file GlobalEvFOutputModule.cc.

References eostools::move().

72 { meta_ = std::move(iMetaData); }
std::shared_ptr< MetaDataCache const > meta_
def move(src, dest)
Definition: eostools.py:511

◆ throttledCheck()

void evf::GlobalEvFOutputEventWriter::throttledCheck ( )
inline

Definition at line 111 of file GlobalEvFOutputModule.cc.

References svgfig::load(), and edm::shutdown_flag.

111  {
112  unsigned int counter = 0;
113  while (edm::Service<evf::EvFDaqDirector>()->inputThrottled() && !discarded_) {
114  if (edm::shutdown_flag.load(std::memory_order_relaxed))
115  break;
116  if (!(counter % 100))
117  edm::LogWarning("FedRawDataInputSource") << "Input throttled detected, writing is paused...";
118  usleep(100000);
119  counter++;
120  if (edm::Service<evf::EvFDaqDirector>()->lumisectionDiscarded(ls_)) {
121  edm::LogWarning("FedRawDataInputSource") << "Detected that the lumisection is discarded -: " << ls_;
122  discarded_ = true;
123  }
124  }
125  }
volatile std::atomic< bool > shutdown_flag
def load(fileName)
Definition: svgfig.py:547
Log< level::Warning, false > LogWarning

Member Data Documentation

◆ accepted_

std::atomic<unsigned long> evf::GlobalEvFOutputEventWriter::accepted_
private

Definition at line 146 of file GlobalEvFOutputModule.cc.

◆ discarded_

bool evf::GlobalEvFOutputEventWriter::discarded_ = false
private

Definition at line 150 of file GlobalEvFOutputModule.cc.

◆ filePath_

std::string evf::GlobalEvFOutputEventWriter::filePath_
private

Definition at line 144 of file GlobalEvFOutputModule.cc.

◆ ls_

const unsigned evf::GlobalEvFOutputEventWriter::ls_
private

Definition at line 145 of file GlobalEvFOutputModule.cc.

◆ meta_

std::shared_ptr<MetaDataCache const> evf::GlobalEvFOutputEventWriter::meta_
private

Definition at line 148 of file GlobalEvFOutputModule.cc.

◆ stream_writer_events_

edm::propagate_const<std::unique_ptr<StreamerOutputFile> > evf::GlobalEvFOutputEventWriter::stream_writer_events_
private

Definition at line 147 of file GlobalEvFOutputModule.cc.

◆ writeQueue_

edm::SerialTaskQueue evf::GlobalEvFOutputEventWriter::writeQueue_
private

Definition at line 149 of file GlobalEvFOutputModule.cc.