ATLAS Offline Software
AthRetrySequencer.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // AthRetrySequencer.cxx
8 // Implementation file for class AthRetrySequencer
9 // Author: S.Binet<binet@cern.ch>
11 
12 // GaudiSequencer includes
13 #include "AthRetrySequencer.h"
14 
15 // STL includes
16 
17 // FrameWork includes
18 #include "Gaudi/Property.h"
19 
20 
21 
23 // Public methods:
25 
26 // Constructors
29  ISvcLocator* pSvcLocator ) :
30  ::AthSequencer( name, pSvcLocator )
31 {
32  //
33  // Property declaration
34  //
35  declareProperty("MaxRetries",
36  m_maxRetries = 5,
37  "maximum number of times to retry running the subsequence "
38  "inside an event before giving up (-1 for infinity)" );
39 
40 }
41 
42 // Destructor
45 {}
46 
47 StatusCode AthRetrySequencer::execute( const EventContext& ctx ) const
48 {
49  ATH_MSG_DEBUG ("Executing " << name() << "...");
50  int iloop = 0;
51 
52  while (iloop < m_maxRetries || m_maxRetries == -1) {
53  iloop += 1;
54  this->AthSequencer::resetExecuted( ctx );
55  if (this->AthSequencer::execute( ctx ).isSuccess() &&
56  this->execState(ctx).filterPassed()) {
57  return StatusCode::SUCCESS;
58  }
59  }
60  ATH_MSG_WARNING("maximum number of retries reached ("
61  << m_maxRetries << ") => Giving up!");
62 
63  return StatusCode::FAILURE;
64 }
65 
AthSequencer
ClassName: AthSequencer.
Definition: AthSequencer.h:40
AthRetrySequencer::~AthRetrySequencer
virtual ~AthRetrySequencer()
Destructor:
Definition: AthRetrySequencer.cxx:44
AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
AthRetrySequencer.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthSequencer::resetExecuted
virtual void resetExecuted(const EventContext &ctx) const
Reset the AthSequencer executed state for the current event.
Definition: AthSequencer.cxx:229
AthSequencer::execute
virtual StatusCode execute(const EventContext &ctx) const override
The actions to be performed by the sequencer on an event.
Definition: AthSequencer.cxx:114
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
AthRetrySequencer::AthRetrySequencer
AthRetrySequencer()
Default constructor:
AthRetrySequencer::m_maxRetries
int m_maxRetries
Maximum number of loop iterations.
Definition: AthRetrySequencer.h:62
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
test_pyathena.filterPassed
filterPassed
now, add a sequencer: it will only execute seqalg1 and 2 and never 3
Definition: test_pyathena.py:38
AthRetrySequencer::execute
virtual StatusCode execute(const EventContext &) const override
The actions to be performed by the sequencer on an event.
Definition: AthRetrySequencer.cxx:47