CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
conddb_serialization_metadata Namespace Reference

Functions

def boost_version_to_int (boost_version)
 
def check_cmssw_version (cmssw_version)
 
def cmp_boost_version (ver1, ver2)
 
def cmp_cmssw_version (ver1, ver2)
 
def cmssw_version_to_int (cmssw_version)
 
def do_update_tag_boost_version (tagBoostVersion, minIov, iovBoostVersion, iov, timetype, boost_run_map)
 
def get_boost_version_from_streamer_info (s_info)
 
def get_cmssw_boost (arch, releaseDir)
 
def get_production_arch (version)
 
def get_release_root (cmssw_version, arch)
 
def is_release_cycle (cmssw_version)
 
def lookup_boost_for_run (iov, timeType, boost_run_map)
 
def strip_boost_version (boost_version)
 
def strip_cmssw_version (cmssw_version)
 
def update_tag_boost_version (tagBoostVersion, minIov, streamer_info, iov, timetype, boost_run_map)
 

Function Documentation

◆ boost_version_to_int()

def conddb_serialization_metadata.boost_version_to_int (   boost_version)

Definition at line 65 of file conddb_serialization_metadata.py.

References createfilelist.int, and strip_boost_version().

Referenced by cmp_boost_version().

65 def boost_version_to_int( boost_version ):
66  bver = strip_boost_version( boost_version )
67  dgs = bver.split('.')
68  tmpl = '%d%02d%02d'
69  pars = [0,0,0]
70  ind = 0
71  for d in dgs:
72  if ind <=2:
73  pars[ind] = int(d)
74  ind += 1
75  return int(tmpl %(pars[0],pars[1],pars[2]))
76 

◆ check_cmssw_version()

def conddb_serialization_metadata.check_cmssw_version (   cmssw_version)

Definition at line 10 of file conddb_serialization_metadata.py.

10 def check_cmssw_version( cmssw_version ):
11  if cmssw_version.find('CMSSW_')==-1:
12  raise Exception("CMSSW version '%s' has not been found in the expected format" %cmssw_version)
13  ver = cmssw_version
14  p = re.compile('(CMSSW_.*_X)(_.*)?$')
15  m = p.match(ver)
16  if not m is None:
17  gs = m.groups()
18  if gs[1] != None:
19  raise Exception("IB version can't be processed.")
20  return ver
21 

◆ cmp_boost_version()

def conddb_serialization_metadata.cmp_boost_version (   ver1,
  ver2 
)

Definition at line 77 of file conddb_serialization_metadata.py.

References boost_version_to_int().

Referenced by do_update_tag_boost_version().

77 def cmp_boost_version( ver1, ver2 ):
78  intVer1 = boost_version_to_int(ver1)
79  intVer2 = boost_version_to_int(ver2)
80  if intVer1<intVer2:
81  return -1
82  elif intVer1>intVer2:
83  return 1
84  else:
85  return 0
86 

◆ cmp_cmssw_version()

def conddb_serialization_metadata.cmp_cmssw_version (   ver1,
  ver2 
)

Definition at line 45 of file conddb_serialization_metadata.py.

References cmssw_version_to_int().

45 def cmp_cmssw_version( ver1, ver2 ):
46  intVer1 = cmssw_version_to_int(ver1)
47  intVer2 = cmssw_version_to_int(ver2)
48  if intVer1<intVer2:
49  return -1
50  elif intVer1>intVer2:
51  return 1
52  else:
53  return 0
54 

◆ cmssw_version_to_int()

def conddb_serialization_metadata.cmssw_version_to_int (   cmssw_version)

Definition at line 35 of file conddb_serialization_metadata.py.

References createfilelist.int.

Referenced by cmp_cmssw_version(), and get_production_arch().

35 def cmssw_version_to_int( cmssw_version ):
36  ver = cmssw_version.split('CMSSW_')[1]
37  ip = 0
38  f = ver.find('_patch')
39  if not f == -1:
40  ip = int(ver[f+6:])
41  ver = ver[0:f]
42  dgs = ver.split('_')
43  return int('%d%02d%02d%02d' %(int(dgs[0]),int(dgs[1]),int(dgs[2]),ip))
44 

◆ do_update_tag_boost_version()

def conddb_serialization_metadata.do_update_tag_boost_version (   tagBoostVersion,
  minIov,
  iovBoostVersion,
  iov,
  timetype,
  boost_run_map 
)

Definition at line 158 of file conddb_serialization_metadata.py.

References cmp_boost_version(), and lookup_boost_for_run().

Referenced by update_tag_boost_version().

158 def do_update_tag_boost_version( tagBoostVersion, minIov, iovBoostVersion, iov, timetype, boost_run_map ):
159  # for hash timetype we need to take the greatest version of the set
160  if timetype == 'Hash':
161  if tagBoostVersion is None or cmp_boost_version(tagBoostVersion,iovBoostVersion)<0:
162  tagBoostVersion = iovBoostVersion
163  # for run, lumi and time we lookup in the boost_run_map to find the reference
164  else:
165  if tagBoostVersion is None:
166  tagBoostVersion = iovBoostVersion
167  else:
168  iovRefBoost = lookup_boost_for_run( iov, timetype, boost_run_map )
169  # the case when the iov does not follow the standard run history
170  if cmp_boost_version( iovRefBoost, iovBoostVersion )<0:
171  if cmp_boost_version( tagBoostVersion, iovBoostVersion )<0:
172  tagBoostVersion = iovBoostVersion
173  # iov in agreement witjh the standard run history
174  else:
175  tagRefBoost = lookup_boost_for_run( minIov, timetype, boost_run_map )
176  # also the current tag follows the standard run history
177  if cmp_boost_version( tagRefBoost, tagBoostVersion )>=0:
178  # in this case the min boost version should decrease to
179  if cmp_boost_version( tagBoostVersion, iovRefBoost )>0:
180  tagBoostVersion = iovRefBoost
181  return tagBoostVersion
182 
def do_update_tag_boost_version(tagBoostVersion, minIov, iovBoostVersion, iov, timetype, boost_run_map)
def lookup_boost_for_run(iov, timeType, boost_run_map)

◆ get_boost_version_from_streamer_info()

def conddb_serialization_metadata.get_boost_version_from_streamer_info (   s_info)

Definition at line 144 of file conddb_serialization_metadata.py.

References str, and strip_boost_version().

Referenced by update_tag_boost_version().

145  streamer_info = s_info.decode()
146  streamer_info = streamer_info.replace('\x00','')
147  iovBoostVersion = None
148  if streamer_info == '0':
149  iovBoostVersion = '1.51.0'
150  else:
151  try:
152  iovBoostVersion = str(json.loads(streamer_info)['tech_version'])
153  iovBoostVersion = strip_boost_version(iovBoostVersion)
154  except ValueError as e:
155  raise Exception("Could not parse streamer info [%s]: %s" %(streamer_info,str(e)))
156  return iovBoostVersion
157 
#define str(s)

◆ get_cmssw_boost()

def conddb_serialization_metadata.get_cmssw_boost (   arch,
  releaseDir 
)

Definition at line 112 of file conddb_serialization_metadata.py.

References nano_mu_digi_cff.strip, and strip_boost_version().

112 def get_cmssw_boost( arch, releaseDir ):
113  cmd = 'source %s/cmsset_default.sh; export SCRAM_ARCH=%s; cd %s/src ; eval `scram runtime -sh`; scram tool info boost; ' %(cmsPath,arch,releaseDir)
114  pipe = subprocess.Popen( cmd, shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
115  out = pipe.communicate()[0]
116  cfgLines = out.split('\n')
117  boost_version = None
118  for line in cfgLines:
119  if line.startswith('Version'):
120  boost_version = line.split('Version :')[1].strip()
121  break
122  if not boost_version is None:
123  boost_version = strip_boost_version(boost_version)
124  return boost_version
125 

◆ get_production_arch()

def conddb_serialization_metadata.get_production_arch (   version)

Definition at line 93 of file conddb_serialization_metadata.py.

References cmssw_version_to_int().

93 def get_production_arch( version ):
94  nv = cmssw_version_to_int( version )
95  rbound = None
96  for r in sorted(archs.keys()):
97  if r <= nv:
98  rbound = r
99  else:
100  break
101  if not rbound is None:
102  return archs[rbound]
103  return None
104 

◆ get_release_root()

def conddb_serialization_metadata.get_release_root (   cmssw_version,
  arch 
)

Definition at line 105 of file conddb_serialization_metadata.py.

105 def get_release_root( cmssw_version, arch ):
106  cmssw_folder = 'cmssw'
107  if cmssw_version.find('_patch') != -1:
108  cmssw_folder= 'cmssw-patch'
109  ret = '%s/%s/cms/%s' %(cmsPath,arch,cmssw_folder)
110  return ret
111 

◆ is_release_cycle()

def conddb_serialization_metadata.is_release_cycle (   cmssw_version)

Definition at line 22 of file conddb_serialization_metadata.py.

22 def is_release_cycle( cmssw_version ):
23  ind = cmssw_version.find('_X')
24  return not ind == -1
25 

◆ lookup_boost_for_run()

def conddb_serialization_metadata.lookup_boost_for_run (   iov,
  timeType,
  boost_run_map 
)

Definition at line 126 of file conddb_serialization_metadata.py.

References SiStripPI.max.

Referenced by do_update_tag_boost_version().

126 def lookup_boost_for_run( iov, timeType, boost_run_map ):
127  if timeType == 'Lumi':
128  iov = iov >> 32
129  timeType = 'Run'
130  if iov == 0:
131  iov=1
132  entry = None
133  try:
134  if timeType == 'Time':
135  entry = max([x for x in boost_run_map if x[1]<=iov])
136  elif timeType == 'Run':
137  entry = max([x for x in boost_run_map if x[0]<=iov])
138  else:
139  raise Exception('TimeType %s cannot be processed' %timeType)
140  except Exception as e:
141  raise e
142  return entry[2]
143 
def lookup_boost_for_run(iov, timeType, boost_run_map)

◆ strip_boost_version()

def conddb_serialization_metadata.strip_boost_version (   boost_version)

Definition at line 55 of file conddb_serialization_metadata.py.

Referenced by boost_version_to_int(), get_boost_version_from_streamer_info(), and get_cmssw_boost().

55 def strip_boost_version( boost_version ):
56  bver = boost_version
57  f = bver.find('_')
58  if not f==-1:
59  bver = boost_version.replace('_','.')
60  f = bver.find('-')
61  if not f==-1:
62  bver = bver[0:f]
63  return bver
64 

◆ strip_cmssw_version()

def conddb_serialization_metadata.strip_cmssw_version (   cmssw_version)

Definition at line 26 of file conddb_serialization_metadata.py.

26 def strip_cmssw_version( cmssw_version ):
27  ver = cmssw_version
28  if not cmssw_version.find('_X') == -1:
29  ver = ver.replace('X','0')
30  ind = ver.find('_pre')
31  if not ind == -1:
32  ver = ver[0:ind]
33  return ver
34 

◆ update_tag_boost_version()

def conddb_serialization_metadata.update_tag_boost_version (   tagBoostVersion,
  minIov,
  streamer_info,
  iov,
  timetype,
  boost_run_map 
)

Definition at line 183 of file conddb_serialization_metadata.py.

References do_update_tag_boost_version(), and get_boost_version_from_streamer_info().

183 def update_tag_boost_version( tagBoostVersion, minIov, streamer_info, iov, timetype, boost_run_map ):
184  iovBoostVersion = get_boost_version_from_streamer_info( streamer_info )
185  return iovBoostVersion, do_update_tag_boost_version( tagBoostVersion, minIov, iovBoostVersion, iov, timetype, boost_run_map )
186 
187 
188 
def do_update_tag_boost_version(tagBoostVersion, minIov, iovBoostVersion, iov, timetype, boost_run_map)
def update_tag_boost_version(tagBoostVersion, minIov, streamer_info, iov, timetype, boost_run_map)