6 #include <boost/bind.hpp>
7 #include <boost/pointer_cast.hpp>
9 #include "toolbox/task/WorkLoopFactory.h"
10 #include "xcept/tools.h"
58 writingWL_ = toolbox::task::getWorkLoopFactory()->
59 getWorkLoop( identifier + workloopName,
"waiting" );
61 if ( ! writingWL_->isActive() )
63 toolbox::task::ActionSignature* processAction =
65 identifier +
"WriteNextEvent");
66 writingWL_->submit(processAction);
68 writingWL_->activate();
73 std::string
msg =
"Failed to start workloop 'DiskWriter' with 'writeNextEvent'.";
74 XCEPT_RETHROW(stor::exception::DiskWriting, msg, e);
81 std::string errorMsg =
"Failed to write an event: ";
89 XCEPT_DECLARE_NESTED( stor::exception::DiskWriting,
90 sentinelException, errorMsg, e );
96 XCEPT_DECLARE( stor::exception::DiskWriting,
97 sentinelException, errorMsg );
102 errorMsg +=
"Unknown exception";
103 XCEPT_DECLARE( stor::exception::DiskWriting,
104 sentinelException, errorMsg );
117 if (sq->deqTimedWait(event,
timeout_))
122 sharedResources_->statisticsReporter_->getThroughputMonitorCollection().addDiskWriterIdleSample(elapsedTime);
139 getThroughputMonitorCollection().addDiskWriterIdleSample(elapsedTime);
150 std::vector<StreamID>
streams =
event.getStreamTags();
153 std::vector<StreamID>::const_iterator it = streams.begin(), itEnd = streams.end();
162 catch (std::out_of_range& e)
164 std::ostringstream
msg;
165 msg <<
"Unable to retrieve stream handler for " << (*it) <<
" : ";
167 XCEPT_RAISE(exception::UnknownStreamId, msg.str());
178 unsigned int newRunNumber;
179 boost::posix_time::time_duration newTimeoutValue;
182 streamChangeRequested(doConfig, evtCfgList, errCfgList, newdwParams, newRunNumber, newTimeoutValue))
223 EvtStrConfigList::iterator it = cfgList->begin(),
224 itEnd = cfgList->end();
229 if ( it->fractionToDisk() > 0 )
238 ErrStrConfigList::iterator it = cfgList->begin(),
239 itEnd = cfgList->end();
253 boost::shared_ptr<FaultyEventStreamHandler> newHandler(
256 streamHandlers_.push_back(boost::dynamic_pointer_cast<StreamHandler>(newHandler));
262 boost::shared_ptr<EventStreamHandler> newHandler(
265 streamHandlers_.push_back(boost::dynamic_pointer_cast<StreamHandler>(newHandler));
272 boost::shared_ptr<FRDStreamHandler> newHandler(
275 streamHandlers_.push_back(boost::dynamic_pointer_cast<StreamHandler>(newHandler));
304 std::ostringstream str;
320 std::string fileCountStr;
321 bool filesWritten =
false;
326 if ( (*it)->closeFilesForLumiSection(lumiSection, fileCountStr) )
329 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_