Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:26

0001 #include "FWCore/PluginManager/interface/PluginManager.h"
0002 #include "FWCore/PluginManager/interface/standard.h"
0003 #include "FWCore/PluginManager/interface/SharedLibrary.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
0006 //
0007 #include "CondCore/CondDB/interface/ConnectionPool.h"
0008 //
0009 #include <fstream>
0010 #include <iomanip>
0011 #include <cstdlib>
0012 #include <iostream>
0013 
0014 using namespace cond::persistency;
0015 
0016 int run(const std::string& connectionString) {
0017   try {
0018     //*************
0019     std::cout << "> Connecting with db in " << connectionString << std::endl;
0020     ConnectionPool connPool;
0021     connPool.setMessageVerbosity(coral::Debug);
0022     connPool.configure();
0023     Session session = connPool.createSession(connectionString);
0024     session.transaction().start();
0025     cond::RunInfo_t r = session.getLastRun();
0026     std::cout << "Last run: " << r.run << " start:" << r.start << std::endl;
0027     if (r.isOnGoing())
0028       std::cout << "Run is ongoing" << std::endl;
0029     else
0030       std::cout << "Run was ending on " << r.end << std::endl;
0031     session.transaction().commit();
0032   } catch (cond::Exception& e) {
0033     std::cout << "ERROR: " << e.what() << std::endl;
0034     return 1;
0035   }
0036   //std::cout << "## RunInfo test successfully completed." << std::endl;
0037   return 0;
0038 }
0039 
0040 int main(int argc, char** argv) {
0041   edmplugin::PluginManager::Config config;
0042   edmplugin::PluginManager::configure(edmplugin::standard::config());
0043 
0044   std::vector<edm::ParameterSet> psets;
0045   edm::ParameterSet pSet;
0046   pSet.addParameter("@service_type", std::string("SiteLocalConfigService"));
0047   psets.push_back(pSet);
0048   const edm::ServiceToken services(edm::ServiceRegistry::createSet(psets));
0049   const edm::ServiceRegistry::Operate operate(services);
0050   int ret = 0;
0051   std::string connectionString0("frontier://FrontierProd/CMS_CONDITIONS");
0052   //std::string connectionString0("frontier://FrontierProd/CMS_CONDITIONS");
0053   //std::string connectionString0("oracle://cms_orcoff_prep/CMS_CONDITIONS");
0054   ret = run(connectionString0);
0055   return ret;
0056 }