CMS 3D CMS Logo

Classes | Functions
conddbCopyTest Namespace Reference

Classes

class  CopyTest
 
class  DB
 

Functions

def copy (sourceTag, destTag, since, logFileName)
 
def main ()
 
def prepareFile (inputTag, sourceTag, startingSince)
 

Function Documentation

def conddbCopyTest.copy (   sourceTag,
  destTag,
  since,
  logFileName 
)

Definition at line 35 of file conddbCopyTest.py.

References edm.print().

Referenced by conddbCopyTest.CopyTest.execute().

35 def copy( sourceTag, destTag, since, logFileName ):
36  command = "conddb --yes --db %s copy %s %s -f %s --synchronize" %(fileName,sourceTag,destTag,since)
37  pipe = subprocess.Popen( command, shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
38  out = pipe.communicate()[0]
39  lines = out.split('\n')
40  ret = pipe.returncode
41  for line in lines:
42  print(line)
43  with open(logFileName,'a') as logFile:
44  logFile.write(out)
45  return ret==0
46 
def copy(sourceTag, destTag, since, logFileName)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def conddbCopyTest.main ( )

Definition at line 104 of file conddbCopyTest.py.

References prepareFile(), and edm.print().

104 def main():
105  print('Testing...')
106  bfile0 = fileName
107  bfile1 = fileName
108  db = DB()
109  inputTag = 'runinfo_31X_mc'
110  inputTag0 ='runinfo_0'
111  inputTag1 = 'runinfo_1'
112  prepareFile( inputTag,inputTag0,1)
113  prepareFile( inputTag,inputTag1,100)
114  test = CopyTest( db )
115  # test with synch=any
116  tag = 'test_CondUpload_any'
117  test.execute( inputTag0, bfile0, tag, 'any', 1, True, 'CREATE' )
118  test.execute( inputTag0, bfile0, tag, 'any', 200, True, 'APPEND' )
119  test.execute( inputTag0, bfile0, tag, 'any', 100, True, 'INSERT')
120  test.execute( inputTag0, bfile0, tag, 'any', 200, True, 'INSERT')
121  # test with synch=validation
122  tag = 'test_CondUpload_validation'
123  test.execute( inputTag0, bfile0, tag, 'validation', 1, True, 'CREATE')
124  db.setSynchronizationType( tag, 'validation' )
125  test.execute( inputTag0, bfile0, tag, 'validation', 1, True, 'INSERT')
126  test.execute( inputTag0, bfile0, tag, 'validation', 200, True, 'APPEND')
127  test.execute( inputTag0, bfile0, tag, 'validation', 100, True, 'INSERT')
128  # test with synch=mc
129  tag = 'test_CondUpload_mc'
130  test.execute( inputTag0, bfile0, tag, 'mc', 1, True, 'CREATE')
131  db.setSynchronizationType( tag, 'mc' )
132  test.execute( inputTag1, bfile1, tag, 'mc', 1, False, 'FAIL')
133  test.execute( inputTag0, bfile0, tag, 'mc', 1, False, 'FAIL')
134  test.execute( inputTag0, bfile0, tag, 'mc', 200, False, 'FAIL')
135  # test with synch=hlt
136  tag = 'test_CondUpload_hlt'
137  test.execute( inputTag0, bfile0, tag, 'hlt', 1, True, 'CREATE')
138  db.setSynchronizationType( tag, 'hlt' )
139  test.execute( inputTag0, bfile0, tag, 'hlt', 200, True, 'SYNCHRONIZE')
140  fcsr = test.execute( inputTag0, bfile0, tag, 'hlt', 100, True, 'SYNCHRONIZE')
141  if not fcsr is None:
142  since = fcsr + 200
143  test.execute( inputTag0, bfile0, tag, 'hlt', since, True, 'APPEND')
144  since = fcsr + 100
145  test.execute( inputTag0, bfile0, tag, 'hlt', since, True, 'INSERT')
146  # test with synch=express
147  tag = 'test_CondUpload_express'
148  test.execute( inputTag0, bfile0, tag, 'express', 1, True, 'CREATE')
149  db.setSynchronizationType( tag, 'express' )
150  test.execute( inputTag0, bfile0, tag, 'express', 200, True, 'SYNCHRONIZE')
151  fcsr = test.execute( inputTag0, bfile0, tag, 'express', 100, True, 'SYNCHRONIZE')
152  if not fcsr is None:
153  since = fcsr + 200
154  test.execute( inputTag0, bfile0, tag, 'express', since, True, 'APPEND')
155  since = fcsr + 100
156  test.execute( inputTag0, bfile0, tag, 'express', since, True, 'INSERT')
157  # test with synch=prompt
158  tag = 'test_CondUpload_prompt'
159  test.execute( inputTag0, bfile0, tag, 'prompt', 1, True, 'CREATE')
160  db.setSynchronizationType( tag, 'prompt' )
161  test.execute( inputTag0, bfile0, tag, 'prompt', 200, True, 'SYNCHRONIZE')
162  fcsr = test.execute( inputTag0, bfile0, tag, 'prompt', 100, True, 'SYNCHRONIZE')
163  if not fcsr is None:
164  since = fcsr + 200
165  test.execute( inputTag0, bfile0, tag, 'prompt', since, True, 'APPEND')
166  since = fcsr + 100
167  test.execute( inputTag0, bfile0, tag, 'prompt', since, True, 'INSERT')
168  # test with synch=pcl
169  tag = 'test_CondUpload_pcl'
170  test.execute( inputTag0, bfile0, tag, 'pcl', 1, True, 'CREATE')
171  db.setSynchronizationType( tag, 'pcl' )
172  test.execute( inputTag0, bfile0, tag, 'pcl', 200, False, 'FAIL')
173  if not fcsr is None:
174  since = fcsr + 200
175  test.execute( inputTag0, bfile0, tag, 'pcl', since, True, 'APPEND')
176  since = fcsr + 100
177  test.execute( inputTag0, bfile0, tag, 'pcl', since, True, 'INSERT')
178  # test with synch=offline
179  tag = 'test_CondUpload_offline'
180  test.execute( inputTag0, bfile0, tag, 'offline', 1, True, 'CREATE')
181  db.setSynchronizationType( tag, 'offline' )
182  test.execute( inputTag0, bfile0, tag, 'offline', 1000, True, 'APPEND')
183  test.execute( inputTag0, bfile0, tag, 'offline', 500, False, 'FAIL' )
184  test.execute( inputTag0, bfile0, tag, 'offline', 1000, False, 'FAIL' )
185  test.execute( inputTag0, bfile0, tag, 'offline', 2000, True, 'APPEND' )
186  # test with synch=runmc
187  tag = 'test_CondUpload_runmc'
188  test.execute( inputTag0, bfile0, tag, 'runmc', 1, True, 'CREATE')
189  db.setSynchronizationType( tag, 'runmc' )
190  test.execute( inputTag0, bfile0, tag, 'runmc', 1000, True, 'APPEND')
191  test.execute( inputTag0, bfile0, tag, 'runmc', 500, False, 'FAIL' )
192  test.execute( inputTag0, bfile0, tag, 'runmc', 1000, False, 'FAIL' )
193  test.execute( inputTag0, bfile0, tag, 'runmc', 2000, True, 'APPEND' )
194  os.remove( fileName )
195  print('Done. Errors: %s' %test.errors)
196 
197 
def prepareFile(inputTag, sourceTag, startingSince)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def conddbCopyTest.prepareFile (   inputTag,
  sourceTag,
  startingSince 
)

Definition at line 30 of file conddbCopyTest.py.

Referenced by main().

30 def prepareFile( inputTag, sourceTag, startingSince ):
31  command = "conddb --yes copy %s %s --destdb %s -f %s" %(inputTag,sourceTag,fileName,startingSince)
32  pipe = subprocess.Popen( command, shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
33  out = pipe.communicate()[0]
34 
def prepareFile(inputTag, sourceTag, startingSince)