Skip to content

Commit 7688366

Browse files
committed
fixed PopCon lumisection query limit
1 parent 6f9f141 commit 7688366

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class LHCInfoPopConSourceHandler : public popcon::PopConSourceHandler<LHCInfo> {
1818
void getNewObjects() override;
1919
std::string id() const override;
2020

21+
static constexpr unsigned int kPageLimit = 4000;
22+
2123
private:
2224
void addEmptyPayload(cond::Time_t iov);
2325

CondTools/RunInfo/interface/OMSAccess.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ namespace cond {
185185
std::stringstream filter;
186186
if (m_filter.empty()) {
187187
filter << "?";
188+
if(!m_limit.empty()){
189+
m_limit.front() = '&';
190+
}
188191
} else {
189192
filter << m_filter << "&";
190193
}
@@ -212,6 +215,9 @@ namespace cond {
212215
// not null filter
213216
inline OMSServiceQuery& filterNotNull(const std::string& varName) { return filterNEQ(varName, SNULL); }
214217

218+
// limit for the page size, when unspecified OMS's default limit is 100
219+
OMSServiceQuery& limit(int value);
220+
215221
// triggers the execution of the query ( calling curl functions )
216222
bool execute();
217223

@@ -230,6 +236,7 @@ namespace cond {
230236
private:
231237
std::string m_url;
232238
std::string m_filter;
239+
std::string m_limit;
233240
std::string m_varList;
234241
std::unique_ptr<OMSServiceResult> m_result;
235242
unsigned long m_status = 0;

CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ size_t LHCInfoPopConSourceHandler::getLumiData(const cond::OMSService& oms,
156156
const boost::posix_time::ptime& endFillTime) {
157157
auto query = oms.query("lumisections");
158158
query->addOutputVars({"start_time", "delivered_lumi", "recorded_lumi"});
159-
query->filterEQ("fill_number", fillId).filterGT("start_time", beginFillTime).filterLT("start_time", endFillTime);
159+
query->filterEQ("fill_number", fillId);
160+
query->filterGT("start_time", beginFillTime).filterLT("start_time", endFillTime);
161+
query->limit(kPageLimit);
160162
size_t nlumi = 0;
161163
if (query->execute()) {
162164
auto res = query->result();

CondTools/RunInfo/src/OMSAccess.cc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ namespace cond {
8383
return *this;
8484
}
8585

86+
OMSServiceQuery& OMSServiceQuery::limit(int value) {
87+
std::stringstream pageLimit;
88+
if (m_filter.empty()) {
89+
pageLimit << "?";
90+
} else {
91+
pageLimit << "&";
92+
}
93+
pageLimit << "page[limit]=" << value;
94+
m_limit = pageLimit.str();
95+
return *this;
96+
}
97+
8698
bool OMSServiceQuery::execute() {
8799
bool ret = false;
88100
std::string out;
@@ -99,7 +111,7 @@ namespace cond {
99111

100112
OMSServiceResult& OMSServiceQuery::result() { return *m_result; }
101113

102-
std::string OMSServiceQuery::url() { return m_url + m_filter + m_varList; }
114+
std::string OMSServiceQuery::url() { return m_url + m_filter + m_limit + m_varList; }
103115

104116
OMSService::OMSService() : m_baseUrl() {}
105117

0 commit comments

Comments
 (0)