ATLAS Offline Software
Loading...
Searching...
No Matches
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
50bool
52 boost::property_tree::ptree & jobOptions,
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
64bool
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
Loader class for Trigger configuration from the Trigger DB.
Base class for Trigger configuration data and wrapper around underlying representation.
TrigDBJobOptionsLoader(const std::string &connection)
Constructor.
std::map< size_t, QueryDefinition > m_queries
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)
virtual ~TrigDBJobOptionsLoader() override
Destructor - cannot be defined here because QueryDefinition is an incomplete type.
TrigDBLoader(const std::string &loaderName, const std::string &connection)
Constructor.
void loadFromOracle(unsigned int key, boost::property_tree::ptree &pt, const std::string &outFileName, const std::string &description, const std::map< size_t, QueryDefinition > &queries) const
void loadFromCrest(unsigned int key, boost::property_tree::ptree &pt, const std::string &outFileName, const std::string &description, const std::string &query_type) const