ATLAS Offline Software
TrigDBJobOptionsLoader.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "./TrigDBHelper.h"
7 
9  TrigDBLoader("TrigDBJobOptionsLoader", connection)
10 {
11  { // query for schema version 1
12  auto & q = m_queries[1];
13  // tables
14  q.addToTableList ( "SUPER_MASTER_TABLE", "SMT" );
15  q.addToTableList ( "JO_MASTER_TABLE", "JOMT" );
16  // bind vars
17  q.extendBinding<int>("key");
18  // conditions
19  q.extendCondition("SMT.SMT_ID = :key");
20  q.extendCondition(" AND SMT.SMT_JO_MASTER_TABLE_ID = JOMT.JO_ID");
21  // attributes
22  q.extendOutput<std::string>( "SMT.SMT_NAME" );
23  q.extendOutput<int> ( "SMT.SMT_JO_MASTER_TABLE_ID" );
24  q.extendOutput<coral::Blob>( "JOMT.JO_CONTENT" );
25  // the field with the data
26  q.setDataName("JOMT.JO_CONTENT");
27  }
28  { // query for schema version 2
29  auto & q = m_queries[2];
30  // tables
31  q.addToTableList ( "SUPER_MASTER_TABLE", "SMT" );
32  q.addToTableList ( "HLT_JOBOPTIONS", "HJO" );
33  // bind vars
34  q.extendBinding<int>("key");
35  // conditions
36  q.extendCondition("SMT.SMT_ID = :key");
37  q.extendCondition("AND HJO.HJO_ID=SMT.SMT_HLT_JOBOPTIONS_ID");
38  // attributes
39  q.extendOutput<std::string>( "SMT.SMT_NAME" );
40  q.extendOutput<int> ( "SMT.SMT_HLT_JOBOPTIONS_ID" );
41  q.extendOutput<coral::Blob>( "HJO.HJO_DATA" );
42  // the field with the data
43  q.setDataName("HJO.HJO_DATA");
44  }
45 }
46 
47 // Destructor defined here because QueryDefinition is an incomplete type in the header
49 
50 bool
53  const std::string & outFileName ) const
54 {
55  // load data into ptree
56  if(useCrest()) {
57  loadFromCrest(smk, jobOptions, outFileName, "HLT job options", "JO");
58  } else {
59  loadFromOracle(smk, jobOptions, outFileName, "HLT job options", m_queries);
60  }
61  return true;
62 }
63 
64 bool
67  const std::string & outFileName ) const
68 {
69 
70  boost::property_tree::ptree ptJobOptions;
71  loadJobOptions( smk, ptJobOptions, outFileName );
72  try {
73  jobOptions.setData(std::move(ptJobOptions));
74  }
75  catch(std::exception & ex) {
76  jobOptions.clear();
77  TRG_MSG_ERROR("When reading HLT job options for SMK " << smk << " a parsing error occured ( " << ex.what() <<" )" );
78  throw TrigConf::ParsingException("TrigDBJobOptionsLoader: parsing error " + std::string(ex.what()));
79  }
80  return true;
81 }
82 
TRG_MSG_ERROR
#define TRG_MSG_ERROR(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:29
RunEBWeightsComputation.smk
smk
Definition: RunEBWeightsComputation.py:87
TrigDBJobOptionsLoader.h
Loader class for Trigger configuration from the Trigger DB.
TrigConf::TrigDBLoader
Loader of trigger configurations from the Trigger database.
Definition: TrigDBLoader.h:39
TrigConf::TrigDBJobOptionsLoader::m_queries
std::map< size_t, QueryDefinition > m_queries
Definition: TrigDBJobOptionsLoader.h:60
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
jobOptions
Definition: jobOptions.CompareGeomDBSources.py:1
calibdata.exception
exception
Definition: calibdata.py:495
TrigConf::TrigDBJobOptionsLoader::TrigDBJobOptionsLoader
TrigDBJobOptionsLoader(const std::string &connection)
Constructor.
Definition: TrigDBJobOptionsLoader.cxx:8
TrigConf::ParsingException
Definition: Trigger/TrigConfiguration/TrigConfIO/TrigConfIO/Exceptions.h:56
ptree
boost::property_tree::ptree ptree
Definition: JsonFileLoader.cxx:16
dumpNswErrorDb.outFileName
string outFileName
Definition: dumpNswErrorDb.py:131
TrigConf::DataStructure
Base class for Trigger configuration data and wrapper around underlying representation.
Definition: DataStructure.h:37
TrigConf::TrigDBJobOptionsLoader::~TrigDBJobOptionsLoader
virtual ~TrigDBJobOptionsLoader() override
Destructor - cannot be defined here because QueryDefinition is an incomplete type.
TrigConf::TrigDBJobOptionsLoader::loadJobOptions
bool loadJobOptions(unsigned int smk, boost::property_tree::ptree &jobOptions, const std::string &outFileName="") const
Load job options from the Trigger DB into a ptree for a given SuperMasterKey (SMK)
Definition: TrigDBJobOptionsLoader.cxx:51
extractSporadic.q
list q
Definition: extractSporadic.py:97
TrigDBHelper.h