6 #include <boost/bind.hpp>
7 #include <boost/pointer_cast.hpp>
9 #include "toolbox/task/WorkLoopFactory.h"
10 #include "xcept/tools.h"
59 writingWL_ = toolbox::task::getWorkLoopFactory()->
60 getWorkLoop( identifier + workloopName,
"waiting" );
62 if ( ! writingWL_->isActive() )
64 toolbox::task::ActionSignature* processAction =
66 identifier +
"WriteNextEvent");
67 writingWL_->submit(processAction);
69 writingWL_->activate();
74 std::string msg =
"Failed to start workloop 'DiskWriter' with 'writeNextEvent'.";
75 XCEPT_RETHROW(stor::exception::DiskWriting, msg, e);
82 std::string errorMsg =
"Failed to write an event: ";
90 XCEPT_DECLARE_NESTED( stor::exception::DiskWriting,
91 sentinelException, errorMsg, e );
97 XCEPT_DECLARE( stor::exception::DiskWriting,
98 sentinelException, errorMsg );
103 errorMsg +=
"Unknown exception";
104 XCEPT_DECLARE( stor::exception::DiskWriting,
105 sentinelException, errorMsg );
118 if (sq->deqTimedWait(event,
timeout_))
123 sharedResources_->statisticsReporter_->getThroughputMonitorCollection().addDiskWriterIdleSample(elapsedTime);
140 getThroughputMonitorCollection().addDiskWriterIdleSample(elapsedTime);
151 std::vector<StreamID>
streams =
event.getStreamTags();
154 std::vector<StreamID>::const_iterator it = streams.begin(), itEnd = streams.end();
163 catch (std::out_of_range&
e)
165 std::ostringstream
msg;
166 msg <<
"Unable to retrieve stream handler for " << (*it) <<
" : ";
168 XCEPT_RAISE(exception::UnknownStreamId, msg.str());
179 unsigned int newRunNumber;
180 boost::posix_time::time_duration newTimeoutValue;
183 streamChangeRequested(doConfig, evtCfgList, errCfgList, newdwParams, newRunNumber, newTimeoutValue))
224 EvtStrConfigList::iterator it = cfgList->begin(),
225 itEnd = cfgList->end();
230 if ( it->fractionToDisk() > 0 )
239 ErrStrConfigList::iterator it = cfgList->begin(),
240 itEnd = cfgList->end();
254 boost::shared_ptr<FaultyEventStreamHandler> newHandler(
257 streamHandlers_.push_back(boost::dynamic_pointer_cast<StreamHandler>(newHandler));
263 boost::shared_ptr<EventStreamHandler> newHandler(
266 streamHandlers_.push_back(boost::dynamic_pointer_cast<StreamHandler>(newHandler));
273 boost::shared_ptr<FRDStreamHandler> newHandler(
276 streamHandlers_.push_back(boost::dynamic_pointer_cast<StreamHandler>(newHandler));
305 std::ostringstream str;
323 bool filesWritten =
false;
328 if ( (*it)->closeFilesForLumiSection(lumiSection, fileCountStr) )
331 fileCountStr +=
"\tEoLS:1";
TimePoint_t getCurrentTime()
static const char runNumber_[]
void checkForFileTimeOuts(const bool doItNow=false)
uint32_t runNumber() const
boost::shared_ptr< ErrStrConfigList > ErrStrConfigListPtr
void writeEndOfRunMarker()
utils::TimePoint_t lastFileTimeoutCheckTime_
bool isEndOfLumiSectionMessage() const
SharedResourcesPtr sharedResources_
boost::shared_ptr< SharedResources > SharedResourcesPtr
void checkStreamChangeRequest()
void writeEventToStreams(const I2OChain &)
DiskWritingParams dwParams_
boost::shared_ptr< EvtStrConfigList > EvtStrConfigListPtr
uint32_t lumiSection() const
boost::posix_time::time_duration Duration_t
void makeEventStream(EventStreamConfigurationInfo &)
void configureEventStreams(EvtStrConfigListPtr)
void configureErrorStreams(ErrStrConfigListPtr)
void reportRemainingLumiSections()
boost::shared_ptr< StreamQueue > StreamQueuePtr
boost::posix_time::ptime TimePoint_t
void closeTimedOutFiles(const utils::TimePoint_t)
void reportAllLumiSectionInfos(DbFileHandlerPtr, EndOfRunReportPtr)
void closeTimedOutFiles(utils::TimePoint_t currentTime=utils::getCurrentTime())
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
boost::posix_time::time_duration timeout_
void processEndOfLumiSection(const I2OChain &)
StreamHandlers streamHandlers_
DiskWriter(xdaq::Application *, SharedResourcesPtr sr)
void makeFaultyEventStream()
void setStreamId(StreamID sid)
std::string faultyEventsStream_
const DbFileHandlerPtr dbFileHandler_
std::string getIdentifier(xdaq::ApplicationDescriptor *)
void makeErrorStream(ErrorStreamConfigurationInfo &)
bool writeAction(toolbox::task::WorkLoop *)
size_t memoryUsed() const
utils::Duration_t fileClosingTestInterval_
void startWorkLoop(std::string workloopName)
boost::posix_time::time_duration DWdeqWaitTime_
StreamsMonitorCollection::EndOfRunReportPtr endOfRunReport_
void setStreamId(StreamID sid)
toolbox::task::WorkLoop * writingWL_