16 char errbuf[CURL_ERROR_SIZE];
18 curl = curl_easy_init();
21 struct curl_slist* chunk =
nullptr;
22 chunk = curl_slist_append(chunk,
"content-type:document/plain");
23 curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
24 curl_easy_setopt(curl, CURLOPT_URL, urlString.c_str());
26 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &htmlBuffer);
27 curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf);
28 res = curl_easy_perform(curl);
29 if (CURLE_OK ==
res) {
33 size_t len = strlen(errbuf);
36 fprintf(
stderr,
"%s%s", errbuf, ((errbuf[len - 1] !=
'\n') ?
"\n" :
""));
38 fprintf(
stderr,
"%s\n", curl_easy_strerror(
res));
40 curl_easy_cleanup(curl);
55 return lastLumiProcessed;
62 throw Exception(
"Can't get data from OMS Service.");
63 std::istringstream sinfo(
info);
65 if (!std::getline(sinfo, srun,
',')) {
66 throw Exception(
"Can't get run runmber info from OMS Service.");
69 if (!std::getline(sinfo, slumi,
',')) {
70 throw Exception(
"Can't get lumi id from OMS Service.");
72 unsigned int run = boost::lexical_cast<unsigned int>(srun);
73 unsigned int lumi = boost::lexical_cast<unsigned int>(slumi);
75 return lastLumiProcessed;
83 m_runNumber(iConfig.getUntrackedParameter<unsigned long long>(
"runNumber", 0)),
84 m_latencyInLumisections(iConfig.getUntrackedParameter<unsigned
int>(
"latency", 1)),
85 m_omsServiceUrl(iConfig.getUntrackedParameter<
std::
string>(
"omsServiceUrl",
"")),
86 m_lastLumiUrl(iConfig.getUntrackedParameter<
std::
string>(
"lastLumiUrl",
"")),
87 m_preLoadConnectionString(iConfig.getUntrackedParameter<
std::
string>(
"preLoadConnectionString",
"")),
88 m_debug(iConfig.getUntrackedParameter<
bool>(
"debugLogging",
false)) {
107 if (!m_omsServiceUrl.empty()) {
109 logger().logInfo() <<
"Last lumi: " << lastLumiProcessed
113 if (!m_lastLumiUrl.empty()) {
116 throw Exception(
"Can't get last Lumisection from DAQ.");
117 unsigned int lastL = boost::lexical_cast<unsigned int>(
info);
119 logger().logInfo() <<
"Last lumi: " << lastLumiProcessed <<
" Current run: " << m_runNumber
120 <<
" lumi id:" << lastL;
122 if (m_lastLumiFile.empty()) {
123 throw Exception(
"File name for last lumi has not been provided.");
127 logger().logInfo() <<
"Last lumi: " << lastLumiProcessed <<
" Current run: " << upkTime.first
128 <<
" lumi id:" << upkTime.second;
132 return lastLumiProcessed;
138 transaction.
start(
true);
141 transaction.commit();