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 (streamer_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.

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 

References createfilelist.int, and strip_boost_version().

Referenced by cmp_boost_version().

◆ 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.

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 

References boost_version_to_int().

Referenced by do_update_tag_boost_version().

◆ cmp_cmssw_version()

def conddb_serialization_metadata.cmp_cmssw_version (   ver1,
  ver2 
)

Definition at line 45 of file conddb_serialization_metadata.py.

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 

References cmssw_version_to_int().

◆ cmssw_version_to_int()

def conddb_serialization_metadata.cmssw_version_to_int (   cmssw_version)

Definition at line 35 of file conddb_serialization_metadata.py.

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 

References createfilelist.int.

Referenced by cmp_cmssw_version(), and get_production_arch().

◆ 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 159 of file conddb_serialization_metadata.py.

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

References cmp_boost_version(), and lookup_boost_for_run().

Referenced by update_tag_boost_version().

◆ get_boost_version_from_streamer_info()

def conddb_serialization_metadata.get_boost_version_from_streamer_info (   streamer_info)

Definition at line 144 of file conddb_serialization_metadata.py.

144 def get_boost_version_from_streamer_info( streamer_info ):
145  streamer_info = streamer_info.replace('\x00','')
146  iovBoostVersion = None
147  if streamer_info == '0':
148  iovBoostVersion = '1.51.0'
149  elif streamer_info[0:2]==' {':
150  try:
151  iovBoostVersion = str(json.loads(streamer_info)['tech_version'])
152  iovBoostVersion = strip_boost_version(iovBoostVersion)
153  except ValueError as e:
154  raise Exception("Could not parse streamer info [%s]: %s" %(streamer_info,str(e)))
155  else:
156  raise Exception("Streamer info found in unexpected format.")
157  return iovBoostVersion
158 

References str, and strip_boost_version().

Referenced by update_tag_boost_version().

◆ get_cmssw_boost()

def conddb_serialization_metadata.get_cmssw_boost (   arch,
  releaseDir 
)

Definition at line 112 of file conddb_serialization_metadata.py.

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 

References digitizers_cfi.strip, and strip_boost_version().

◆ get_production_arch()

def conddb_serialization_metadata.get_production_arch (   version)

Definition at line 93 of file conddb_serialization_metadata.py.

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 

References cmssw_version_to_int().

◆ 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.

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 

References SiStripPI.max.

Referenced by do_update_tag_boost_version().

◆ strip_boost_version()

def conddb_serialization_metadata.strip_boost_version (   boost_version)

Definition at line 55 of file conddb_serialization_metadata.py.

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 

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

◆ 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 184 of file conddb_serialization_metadata.py.

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

References do_update_tag_boost_version(), and get_boost_version_from_streamer_info().

conddb_serialization_metadata.get_release_root
def get_release_root(cmssw_version, arch)
Definition: conddb_serialization_metadata.py:105
conddb_serialization_metadata.do_update_tag_boost_version
def do_update_tag_boost_version(tagBoostVersion, minIov, iovBoostVersion, iov, timetype, boost_run_map)
Definition: conddb_serialization_metadata.py:159
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
conddb_serialization_metadata.get_boost_version_from_streamer_info
def get_boost_version_from_streamer_info(streamer_info)
Definition: conddb_serialization_metadata.py:144
conddb_serialization_metadata.is_release_cycle
def is_release_cycle(cmssw_version)
Definition: conddb_serialization_metadata.py:22
str
#define str(s)
Definition: TestProcessor.cc:48
conddb_serialization_metadata.get_cmssw_boost
def get_cmssw_boost(arch, releaseDir)
Definition: conddb_serialization_metadata.py:112
conddb_serialization_metadata.strip_boost_version
def strip_boost_version(boost_version)
Definition: conddb_serialization_metadata.py:55
conddb_serialization_metadata.cmp_boost_version
def cmp_boost_version(ver1, ver2)
Definition: conddb_serialization_metadata.py:77
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
conddb_serialization_metadata.lookup_boost_for_run
def lookup_boost_for_run(iov, timeType, boost_run_map)
Definition: conddb_serialization_metadata.py:126
Exception
createfilelist.int
int
Definition: createfilelist.py:10
conddb_serialization_metadata.strip_cmssw_version
def strip_cmssw_version(cmssw_version)
Definition: conddb_serialization_metadata.py:26
conddb_serialization_metadata.boost_version_to_int
def boost_version_to_int(boost_version)
Definition: conddb_serialization_metadata.py:65
conddb_serialization_metadata.get_production_arch
def get_production_arch(version)
Definition: conddb_serialization_metadata.py:93
conddb_serialization_metadata.cmp_cmssw_version
def cmp_cmssw_version(ver1, ver2)
Definition: conddb_serialization_metadata.py:45
conddb_serialization_metadata.check_cmssw_version
def check_cmssw_version(cmssw_version)
Definition: conddb_serialization_metadata.py:10
conddb_serialization_metadata.update_tag_boost_version
def update_tag_boost_version(tagBoostVersion, minIov, streamer_info, iov, timetype, boost_run_map)
Definition: conddb_serialization_metadata.py:184
conddb_serialization_metadata.cmssw_version_to_int
def cmssw_version_to_int(cmssw_version)
Definition: conddb_serialization_metadata.py:35