CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions
stor::Processing Class Reference

#include <StateMachine.h>

Inheritance diagram for stor::Processing:
stor::Operations

Public Types

typedef bsc::transition< Stop,
DrainingQueues
DT
 
typedef bsc::in_state_reaction
< EndRun, Processing,&Processing::logEndRunRequest
EndRunIR
 
typedef boost::mpl::list< DT,
EndRunIR
reactions
 

Public Member Functions

void logEndRunRequest (const EndRun &request)
 
 Processing (my_context)
 
virtual ~Processing ()
 
- Public Member Functions inherited from stor::Operations
void moveToFailedState (xcept::Exception &exception) const
 
void noFragmentToProcess () const
 
 Operations ()
 
void processI2OFragment (I2OChain &frag) const
 
std::string stateName () const
 
virtual ~Operations ()=0
 

Private Member Functions

virtual void do_entryActionWork ()
 
virtual void do_exitActionWork ()
 
virtual void do_moveToFailedState (xcept::Exception &exception) const
 
virtual void do_noFragmentToProcess () const
 
virtual void do_processI2OFragment (I2OChain &frag) const
 
virtual std::string do_stateName () const
 

Additional Inherited Members

- Protected Member Functions inherited from stor::Operations
void safeEntryAction ()
 
void safeExitAction ()
 

Detailed Description

Processing state

Author:
mommsen
Revision:
1.11
Date:
2011/03/07 15:31:32

Definition at line 503 of file StateMachine.h.

Member Typedef Documentation

typedef bsc::transition<Stop,DrainingQueues> stor::Processing::DT

Definition at line 510 of file StateMachine.h.

Definition at line 511 of file StateMachine.h.

Definition at line 512 of file StateMachine.h.

Constructor & Destructor Documentation

Processing::Processing ( my_context  c)

Definition at line 23 of file Processing.cc.

References stor::Operations::safeEntryAction().

23  : my_base(c)
24 {
26 }
void safeEntryAction()
Definition: Operations.cc:77
Processing::~Processing ( )
virtual

Definition at line 36 of file Processing.cc.

References stor::Operations::safeExitAction().

37 {
39 }
void safeExitAction()
Definition: Operations.cc:108

Member Function Documentation

void Processing::do_entryActionWork ( )
privatevirtual

Implements stor::Operations.

Definition at line 28 of file Processing.cc.

References stor::Operations::stateName().

29 {
30  TransitionRecord tr( stateName(), true );
31  outermost_context().updateHistory( tr );
32  outermost_context().setExternallyVisibleState( "Enabled" );
33  outermost_context().getNotifier()->reportNewState( "Enabled" );
34 }
std::string stateName() const
Definition: Operations.cc:39
void Processing::do_exitActionWork ( )
privatevirtual

Implements stor::Operations.

Definition at line 41 of file Processing.cc.

References stor::Operations::stateName().

42 {
43  TransitionRecord tr( stateName(), false );
44  outermost_context().updateHistory( tr );
45 }
std::string stateName() const
Definition: Operations.cc:39
void Processing::do_moveToFailedState ( xcept::Exception &  exception) const
privatevirtual

Implements stor::Operations.

Definition at line 52 of file Processing.cc.

53 {
54  outermost_context().getSharedResources()->alarmHandler_->moveToFailedState( exception );
55 }
void Processing::do_noFragmentToProcess ( ) const
privatevirtual

Reimplemented from stor::Operations.

Definition at line 115 of file Processing.cc.

References stor::WorkerThreadParams::staleFragmentTimeOut_.

116 {
117  I2OChain staleEvent;
118 
119  WorkerThreadParams workerParams =
120  outermost_context().getSharedResources()->configuration_->getWorkerThreadParams();
121  bool gotStaleEvent =
122  outermost_context().getFragmentStore()->
123  getStaleEvent(staleEvent, workerParams.staleFragmentTimeOut_);
124 
125  if ( gotStaleEvent )
126  {
127  outermost_context().getSharedResources()->discardManager_->sendDiscardMessage(staleEvent);
128  outermost_context().getEventDistributor()->addEventToRelevantQueues(staleEvent);
129  }
130  outermost_context().getEventDistributor()->checkForStaleConsumers();
131 }
utils::Duration_t staleFragmentTimeOut_
void Processing::do_processI2OFragment ( I2OChain frag) const
privatevirtual

Reimplemented from stor::Operations.

Definition at line 63 of file Processing.cc.

References stor::FragmentStore::addFragment(), stor::I2OChain::assertRunNumber(), alignCSCRings::e, stor::AlarmHandler::ERROR, stor::FragmentStore::memoryUsed(), stor::Operations::noFragmentToProcess(), convertSQLiteXML::runNumber, stor::ThroughputMonitorCollection::setFragmentStoreMemoryUsed(), stor::ThroughputMonitorCollection::setFragmentStoreSize(), and stor::FragmentStore::size().

64 {
65  static unsigned int noFragmentCount = 0;
66 
67  FragmentStore* fragmentStore = outermost_context().getFragmentStore();
68  bool completed = fragmentStore->addFragment(frag);
69  if ( completed )
70  {
71  // The run number check has to be done before the event is added to the
72  // queues, as for some event types, e.g. error events, the run number
73  // match is enforced.
74  try
75  {
76  uint32_t runNumber = outermost_context().getSharedResources()->configuration_->getRunNumber();
77  frag.assertRunNumber(runNumber);
78  }
79  catch(stor::exception::RunNumberMismatch &e)
80  {
81  // Just raise an alarm, but continue to process the event
82  outermost_context().getSharedResources()->
83  alarmHandler_->notifySentinel(AlarmHandler::ERROR, e);
84  }
85  outermost_context().getEventDistributor()->addEventToRelevantQueues(frag);
86  outermost_context().getSharedResources()->discardManager_->sendDiscardMessage(frag);
87  }
88  else
89  {
90  // Only do the check every 100th fragment
91  // TODO: shall we make this number configurable?
92  ++noFragmentCount;
93  if ( noFragmentCount >= 100 )
94  {
95  noFragmentCount = 0;
96  this->noFragmentToProcess();
97  }
98  }
99 
100  // 12-Aug-2009, KAB - I put the sampling of the fragment store size
101  // *after* the code to add fragments to the store and move them from the
102  // fragment store to the relevant queues (when needed) so that the baseline
103  // number of events in the fragment store is zero. For example, when
104  // disk writing is slow or stopped, the stream queue fills up, and there
105  // is backpressure within the SM, the true number of events in the fragment
106  // store is zero, and putting the sampling here reflects that.
108  outermost_context().getSharedResources()->statisticsReporter_->
109  getThroughputMonitorCollection();
110  tmc.setFragmentStoreSize(fragmentStore->size());
111  tmc.setFragmentStoreMemoryUsed(fragmentStore->memoryUsed());
112 }
const bool addFragment(I2OChain &)
void noFragmentToProcess() const
Definition: Operations.cc:34
void assertRunNumber(uint32_t runNumber)
Definition: I2OChain.cc:575
size_t memoryUsed() const
Definition: FragmentStore.h:95
unsigned int size() const
Definition: FragmentStore.h:88
string Processing::do_stateName ( ) const
privatevirtual

Implements stor::Operations.

Definition at line 47 of file Processing.cc.

48 {
49  return std::string( "Processing" );
50 }
void Processing::logEndRunRequest ( const EndRun request)

Definition at line 57 of file Processing.cc.

58 {
59  outermost_context().unconsumed_event( request );
60 }