Skip to content

Commit 959d325

Browse files
authored
Merge pull request cms-sw#33943 from ggovi/condcore-conddb-tools-improvements-11-120X
Fixes and improvements for Condition DB tools
2 parents 1ae7916 + f055bf8 commit 959d325

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

CondCore/Utilities/python/o2olib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ def set( self, job_name, en_flag, fr_val=None ):
204204
self.session.merge(job)
205205
self.session.commit()
206206
if fr_val==1:
207-
self.logger.info( "Job '%s' set 'frequent'")
207+
self.logger.info( "Job '%s' set 'frequent'" %job_name)
208208
else:
209-
self.logger.info( "Job '%s' unset 'frequent'")
209+
self.logger.info( "Job '%s' unset 'frequent'" %job_name)
210210

211211
def setConfig( self, job_name, config_filename ):
212212
res = self.session.query(O2OJob.enabled).filter_by(name=job_name)

CondCore/Utilities/scripts/conddb

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,21 @@ class mc_synchro_policy( object ):
907907
else:
908908
if niovs>0:
909909
ret = False
910-
logging.warning('%s The destination tag is frozen - no iov can be altered.' %niovs)
910+
logging.warning('The destination tag is frozen - no iov can be added.')
911+
return ret, new_iovs
912+
913+
class runmc_synchro_policy( object ):
914+
def __init__(self, session1, session2, timeType, destTag):
915+
self.lastFrozenSince = _get_last_frozen_since( session2, destTag )
916+
917+
def validate( self, iovs ):
918+
new_iovs = {}
919+
niovs = len(iovs)
920+
ret = True
921+
if self.lastFrozenSince is not None:
922+
if niovs>0:
923+
ret = False
924+
logging.warning('The destination tag is frozen - no iov can be added.')
911925
return ret, new_iovs
912926

913927
class offline_synchro_policy( object ):
@@ -938,12 +952,24 @@ class no_synchro_policy( object ):
938952

939953
_synchro_map = { 'hlt': hlt_synchro_policy, 'express': hlt_synchro_policy, 'prompt': prompt_synchro_policy, 'pcl':pcl_synchro_policy,
940954
'mc': mc_synchro_policy, 'offline': offline_synchro_policy, 'any':no_synchro_policy, 'validation':no_synchro_policy,
941-
'runmc': offline_synchro_policy }
955+
'runmc': runmc_synchro_policy }
942956
def _get_synchro_policy( synchronization ):
943957
if synchronization not in _synchro_map.keys():
944958
raise Exception('Cannot handle synchronization %s' %synchronization)
945959
return _synchro_map[synchronization]
946960

961+
def mc_validate( session, tag ):
962+
IOV = session.get_dbtype(conddb.IOV)
963+
niovs = session.query(IOV).filter(IOV.tag_name==tag).count()
964+
if niovs>1:
965+
logging.error('Validation of tag content for synchronization "mc" failed: more than one IOV found.')
966+
return False
967+
if niovs>0:
968+
r = int(session.query(IOV.since).filter(IOV.tag_name==tag).one()[0])
969+
if r!=1:
970+
logging.error('Validation of tag content for synchronization "mc" failed: IOV since=%s (expected=1)' %r)
971+
return False
972+
return True
947973

948974
def listTags_(args):
949975
connection = connect(args)
@@ -2175,6 +2201,10 @@ def edit(args):
21752201
if header[0] != new_header[0]:
21762202
action += 'Description updated'
21772203
if header[1] != new_header[1]:
2204+
# validate the synchro requested( based on the tag IOV content )
2205+
if new_header[1] == 'mc':
2206+
if not mc_validate( session, name ):
2207+
return
21782208
if len(action): action += ', '
21792209
action += 'Synchronization changed'
21802210
if header[2] != new_header[2]:

CondCore/Utilities/scripts/uploadConditions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,11 @@ def uploadFile(self, filename, backend = defaultBackend, temporaryFile = default
619619
if len(skippedTags) > 0: logging.warning("tags SKIPped to upload : %s ", str(skippedTags) )
620620
if len(failedTags) > 0: logging.error ("tags FAILed to upload : %s ", str(failedTags) )
621621

622-
fileLogURL = 'https://%s/logs/dropBox/getFileLog?fileHash=%s'
623-
logging.info('file log at: %s', fileLogURL % (self.hostname,fileHash))
622+
fileLogURL = 'https://cms-conddb.cern.ch/cmsDbBrowser/logs/show_cond_uploader_log/%s/%s'
623+
backend = 'Prod'
624+
if self.hostname=='cms-conddb-dev.cern.ch':
625+
backend = 'Prep'
626+
logging.info('file log at: %s', fileLogURL % (backend,fileHash))
624627

625628
return len(okTags)>0
626629

0 commit comments

Comments
 (0)