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 34 of file conddbCopyTest.py.

Referenced by conddbCopyTest.CopyTest.execute().

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

Definition at line 103 of file conddbCopyTest.py.

References prepareFile().

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

Definition at line 29 of file conddbCopyTest.py.

Referenced by main().

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