Skip to content
Snippets Groups Projects
Commit edf8447c authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Merge branch 'DataObjIDSort-master-20170525' into 'master'

Sort scheduler debugging dumps in a well-defined order

See merge request !343
parents 5e3ddb9b a363a644
No related branches found
No related tags found
1 merge request!343Sort scheduler debugging dumps in a well-defined order
Pipeline #
...@@ -34,6 +34,31 @@ std::list<AvalancheSchedulerSvc::SchedulerState> AvalancheSchedulerSvc::m_sState ...@@ -34,6 +34,31 @@ std::list<AvalancheSchedulerSvc::SchedulerState> AvalancheSchedulerSvc::m_sState
// Instantiation of a static factory class used by clients to create instances of this service // Instantiation of a static factory class used by clients to create instances of this service
DECLARE_SERVICE_FACTORY( AvalancheSchedulerSvc ) DECLARE_SERVICE_FACTORY( AvalancheSchedulerSvc )
namespace {
struct DataObjIDSorter
{
bool operator() (const DataObjID* a, const DataObjID* b)
{
return a->fullKey() < b->fullKey();
}
};
// Sort a DataObjIDColl in a well-defined, reproducible manner.
// Used for making debugging dumps.
std::vector<const DataObjID*> sortedDataObjIDColl (const DataObjIDColl& coll)
{
std::vector<const DataObjID*> v;
v.reserve( coll.size() );
for( const DataObjID& id : coll )
v.push_back( &id );
std::sort( v.begin(), v.end(), DataObjIDSorter() );
return v;
}
}
//=========================================================================== //===========================================================================
// Infrastructure methods // Infrastructure methods
...@@ -148,7 +173,8 @@ StatusCode AvalancheSchedulerSvc::initialize() { ...@@ -148,7 +173,8 @@ StatusCode AvalancheSchedulerSvc::initialize() {
DataObjIDColl algoDependencies; DataObjIDColl algoDependencies;
if ( !algoPtr->inputDataObjs().empty() || !algoPtr->outputDataObjs().empty() ) { if ( !algoPtr->inputDataObjs().empty() || !algoPtr->outputDataObjs().empty() ) {
for ( auto id : algoPtr->inputDataObjs() ) { for ( const DataObjID* idp : sortedDataObjIDColl (algoPtr->inputDataObjs()) ) {
DataObjID id = *idp;
ostdd << "\n o INPUT " << id; ostdd << "\n o INPUT " << id;
if (id.key().find(":")!=std::string::npos) { if (id.key().find(":")!=std::string::npos) {
ostdd << " contains alternatives which require resolution...\n"; ostdd << " contains alternatives which require resolution...\n";
...@@ -171,12 +197,12 @@ StatusCode AvalancheSchedulerSvc::initialize() { ...@@ -171,12 +197,12 @@ StatusCode AvalancheSchedulerSvc::initialize() {
algoDependencies.insert( id ); algoDependencies.insert( id );
globalInp.insert( id ); globalInp.insert( id );
} }
for ( auto id : algoPtr->outputDataObjs() ) { for ( const DataObjID* id : sortedDataObjIDColl (algoPtr->outputDataObjs()) ) {
ostdd << "\n o OUTPUT " << id; ostdd << "\n o OUTPUT " << *id;
if (id.key().find(":")!=std::string::npos) { if (id->key().find(":")!=std::string::npos) {
error() << " in Alg " << algoPtr->name() error() << " in Alg " << algoPtr->name()
<< " alternatives are NOT allowed for outputs! id: " << " alternatives are NOT allowed for outputs! id: "
<< id << endmsg; << *id << endmsg;
m_showDataDeps = true; m_showDataDeps = true;
} }
} }
...@@ -216,10 +242,10 @@ StatusCode AvalancheSchedulerSvc::initialize() { ...@@ -216,10 +242,10 @@ StatusCode AvalancheSchedulerSvc::initialize() {
if ( unmetDep.size() > 0 ) { if ( unmetDep.size() > 0 ) {
std::ostringstream ost; std::ostringstream ost;
for ( auto& o : unmetDep ) { for ( const DataObjID* o : sortedDataObjIDColl (unmetDep) ) {
ost << "\n o " << o << " required by Algorithm: "; ost << "\n o " << *o << " required by Algorithm: ";
for ( size_t i = 0; i < m_algosDependencies.size(); ++i ) { for ( size_t i = 0; i < m_algosDependencies.size(); ++i ) {
if ( m_algosDependencies[i].find( o ) != m_algosDependencies[i].end() ) { if ( m_algosDependencies[i].find( *o ) != m_algosDependencies[i].end() ) {
ost << "\n * " << m_algname_vect[i]; ost << "\n * " << m_algname_vect[i];
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment