00001 // $Id: FinishingDQM.cc,v 1.11 2011/03/07 15:31:32 mommsen Exp $ 00003 00004 #include "EventFilter/StorageManager/interface/CommandQueue.h" 00005 #include "EventFilter/StorageManager/interface/DQMEventProcessorResources.h" 00006 #include "EventFilter/StorageManager/interface/SharedResources.h" 00007 #include "EventFilter/StorageManager/interface/StateMachine.h" 00008 #include "EventFilter/StorageManager/interface/TransitionRecord.h" 00009 00010 #include <iostream> 00011 #include <unistd.h> 00012 00013 using namespace std; 00014 using namespace stor; 00015 00016 FinishingDQM::FinishingDQM( my_context c ): my_base(c) 00017 { 00018 safeEntryAction(); 00019 } 00020 00021 void FinishingDQM::do_entryActionWork() 00022 { 00023 00024 TransitionRecord tr( stateName(), true ); 00025 outermost_context().updateHistory( tr ); 00026 00027 SharedResourcesPtr sharedResources = 00028 outermost_context().getSharedResources(); 00029 00030 // request end-of-run processing in DQMEventProcessor 00031 sharedResources->dqmEventProcessorResources_->requestEndOfRun(); 00032 00033 } 00034 00035 FinishingDQM::~FinishingDQM() 00036 { 00037 safeExitAction(); 00038 } 00039 00040 void FinishingDQM::do_exitActionWork() 00041 { 00042 TransitionRecord tr( stateName(), false ); 00043 outermost_context().updateHistory( tr ); 00044 } 00045 00046 string FinishingDQM::do_stateName() const 00047 { 00048 return std::string( "FinishingDQM" ); 00049 } 00050 00051 void FinishingDQM::do_moveToFailedState( xcept::Exception& exception ) const 00052 { 00053 outermost_context().getSharedResources()->moveToFailedState( exception ); 00054 } 00055 00056 void 00057 FinishingDQM::do_noFragmentToProcess() const 00058 { 00059 if ( endOfRunProcessingIsDone() ) 00060 { 00061 SharedResourcesPtr sharedResources = 00062 outermost_context().getSharedResources(); 00063 EventPtr_t stMachEvent( new EndRun() ); 00064 sharedResources->commandQueue_->enqWait( stMachEvent ); 00065 } 00066 } 00067 00068 bool 00069 FinishingDQM::endOfRunProcessingIsDone() const 00070 { 00071 SharedResourcesPtr sharedResources = 00072 outermost_context().getSharedResources(); 00073 00074 if ( sharedResources->dqmEventProcessorResources_->requestsOngoing() ) return false; 00075 00076 return true; 00077 } 00078