From f243221032ffe97f7ef436024b66021dc49b26e0 Mon Sep 17 00:00:00 2001 From: Giacomo Govi Date: Fri, 3 Aug 2018 11:34:04 +0200 Subject: [PATCH] Fix for start/end conditions --- .../python/LHCInfoPopConAnalyzerStartFill.py | 5 +- .../RunInfo/src/LHCInfoPopConSourceHandler.cc | 47 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/CondTools/RunInfo/python/LHCInfoPopConAnalyzerStartFill.py b/CondTools/RunInfo/python/LHCInfoPopConAnalyzerStartFill.py index 21dbf5b4c538d..d885f5c1c0bf2 100644 --- a/CondTools/RunInfo/python/LHCInfoPopConAnalyzerStartFill.py +++ b/CondTools/RunInfo/python/LHCInfoPopConAnalyzerStartFill.py @@ -70,13 +70,14 @@ record = cms.string('LHCInfoRcd'), name = cms.untracked.string('LHCInfo'), Source = cms.PSet(fill = cms.untracked.uint32(6417), - startTime = cms.untracked.string('2018-05-31 00:00:00.000'), - #endTime = cms.untracked.string('2018-05-31 20:13:59.000'), + startTime = cms.untracked.string('2018-04-01 00:00:00.000'), + #endTime = cms.untracked.string('2018-03-25 05:00:00.000'), samplingInterval = cms.untracked.uint32( 600 ), endFill = cms.untracked.bool(False), connectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_RUNTIME_LOGGER"), ecalConnectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_DCS_ENV_PVSS_COND"), DIPSchema = cms.untracked.string("CMS_BEAM_COND"), + #authenticationPath = cms.untracked.string("."), debug=cms.untracked.bool(False) ), loggingOn = cms.untracked.bool(True), diff --git a/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc b/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc index 59dc95b180396..604d6933acc72 100644 --- a/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc +++ b/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc @@ -830,29 +830,25 @@ void LHCInfoPopConSourceHandler::getNewObjects() { << " ); from " << m_name << "::getNewObjects"; } - cond::Time_t lastIov = tagInfo().lastInterval.first; - if( lastIov == 0 ){ + cond::Time_t lastSince = tagInfo().lastInterval.first; + if( lastSince == 0 ){ // for a new or empty tag, an empty payload should be added on top with since=1 addEmptyPayload( 1 ); } else { edm::LogInfo( m_name ) << "The last Iov in tag " << tagInfo().name - << " valid since " << lastIov + << " valid since " << lastSince << "from " << m_name << "::getNewObjects"; } - cond::Time_t targetIov = cond::time::from_boost( boost::posix_time::second_clock::local_time() ); - cond::Time_t endIov = cond::time::MAX_VAL; - //if( m_endFill ){ - if( !m_startTime.is_not_a_date_time() ){ - targetIov = cond::time::from_boost(m_startTime); - } - if( lastIov > targetIov ) targetIov = lastIov; + boost::posix_time::ptime executionTime = boost::posix_time::second_clock::local_time(); + cond::Time_t targetSince = 0; + cond::Time_t endIov = cond::time::from_boost( executionTime ); + if( !m_startTime.is_not_a_date_time() ){ + targetSince = cond::time::from_boost(m_startTime); + } + if( lastSince > targetSince ) targetSince = lastSince; - if( !m_endTime.is_not_a_date_time() ){ - endIov = cond::time::from_boost(m_endTime); - } - //} - edm::LogInfo(m_name) <<"Starting sampling at "<= endIov ){ + if( targetSince >= endIov ){ edm::LogInfo( m_name ) <<"Sampling ended at the time "<fillNumber() and m_prevPayload->endTime()==0ULL){ // execute the query for the current fill session.transaction().start(true); + edm::LogInfo( m_name ) <<"Searching started fill #"<fillNumber(); bool foundFill = getFillData( session, m_prevPayload->fillNumber() ); session.transaction().commit(); if(!foundFill ){ @@ -894,9 +892,7 @@ void LHCInfoPopConSourceHandler::getNewObjects() { break; } updateEcal = true; - startSampleTime = cond::time::to_boost(lastIov); - // if fill is going, no further query to do... - if(m_fillPayload->endTime()==0ULL) endIov = targetIov; + startSampleTime = cond::time::to_boost(lastSince); } else { session.transaction().start(true); edm::LogInfo( m_name ) <<"Searching new fill after "<createTime()); @@ -914,11 +910,12 @@ void LHCInfoPopConSourceHandler::getNewObjects() { unsigned short lhcFill = m_fillPayload->fillNumber(); if( endFillTime == 0ULL ){ edm::LogInfo( m_name ) <<"Found ongoing fill "<fillNumber() and m_prevPayload->endTime()!=0ULL) addEmptyPayload( m_fillPayload->endTime() ); + iovAdded = true; + //if(m_prevPayload->fillNumber() and m_prevPayload->endTime()!=0ULL) addEmptyPayload( m_fillPayload->endTime() ); + if(m_prevPayload->fillNumber() and m_fillPayload->endTime()!=0ULL) addEmptyPayload( m_fillPayload->endTime() ); } }