from dbsUnitTestApi import DbsUnitTestApi optManager = DbsOptionParser() (opts,args) = optManager.getOpt() api = DbsApi(opts.__dict__) serverInfo = api.getServerInfo() isMYSQL = serverInfo['InstanceType'] isGlobal = serverInfo['InstanceName'] #mytime = str(time.time()) mytime = time.strftime("_%Y%m%d_%Hh%Mm%Ss",time.localtime()) f = open("result.txt", "a+") apiObj = DbsUnitTestApi(api.insertPrimaryDataset, f) apiObj.setVerboseLevel(opts.verbose) f.write("\n\n***********************insertPrimaryDataset API tests***************************") primary = 'TestPrimary_001' + mytime pri1 = DbsPrimaryDataset (Name = primary, Type="test") apiObj.run(pri1, excep = False) primary = 'TestPrimary_002' + mytime pri2 = DbsPrimaryDataset (Name = primary, Type="test") apiObj.run(pri2, excep = False) pri = DbsPrimaryDataset () apiObj.run(pri, excep = True)
#!/usr/bin/env python # # API Unit tests for the DBS JavaServer. import sys from DBSAPI.dbsApi import DbsApi from DBSAPI.dbsOptions import DbsOptionParser from dbsUnitTestApi import DbsUnitTestApi optManager = DbsOptionParser() (opts,args) = optManager.getOpt() api = DbsApi(opts.__dict__) f = open("result.txt", "a+") apiObj = DbsUnitTestApi(api.listPrimaryDatasets, f) apiObj.setVerboseLevel(opts.verbose) pathfile = open('pathfile', 'r') path= pathfile.readline() pathfile.close() blockfile = open('blockfile', 'r') block = blockfile.readline() blockfile.close() lfnfile = open('lfnfile', 'r') lfn = lfnfile.readline() lfnfile.close() #path = apiObj.getExistingPDPath() #block = apiObj.getExistingBlock()
#Get this just once filename="bulkDataResult."+logext #print "FILENAME: "+filename f = open(filename, "w") ################# WRITING TO STDOUT COMMENT THIS LINE (UNCOMMENT ABOVE) TO WRITE TO A FILE ########### #f=sys.stdout for i in range(maxDS): # Make this cycle unique mytime = os.popen('uuidgen').readline().strip() mytime += str(i) fileList = [] #Insert Primary apiObj = DbsUnitTestApi(api.insertPrimaryDataset, f) primary = 'StressTestPrimary' + mytime pri1 = DbsPrimaryDataset (Name = primary, Type='MC') apiObj.run(pri1, excep = False) #Insert Algorithm apiObj = DbsUnitTestApi(api.insertAlgorithm,f) algo1 = DbsAlgorithm (ExecutableName="StressTestExe01", ApplicationVersion= "StressTestVersion01" + mytime, ApplicationFamily="StressTestAppFamily01", ParameterSetID=DbsQueryableParameterSet(Hash="001234565798685", Name="StressTestParam01", Version="V001", Type="test", Annotation="This is a stress test param", Content="int a= {}, b={c=1, d=33}, f={}, x, y, x"
#Get this just once filename="bulkDataResult."+logext #print "FILENAME: "+filename f = open(filename, "w") ################# WRITING TO STDOUT COMMENT THIS LINE (UNCOMMENT ABOVE) TO WRITE TO A FILE ########### #f=sys.stdout for i in range(maxDS): # Make this cycle unique mytime = os.popen('uuidgen').readline().strip() mytime += str(i) fileList = [] #Insert Primary apiObj = DbsUnitTestApi(api.insertPrimaryDataset, f) primary = 'StressTestPrimary' + mytime pri1 = DbsPrimaryDataset (Name = primary) apiObj.run(pri1, excep = False) #Insert Algorithm apiObj = DbsUnitTestApi(api.insertAlgorithm,f) algo1 = DbsAlgorithm (ExecutableName="StressTestExe01", ApplicationVersion= "StressTestVersion01" + mytime, ApplicationFamily="StressTestAppFamily01", ParameterSetID=DbsQueryableParameterSet(Hash="001234565798685", Name="StressTestParam01", Version="V001", Type="test", Annotation="This is a stress test param", Content="int a= {}, b={c=1, d=33}, f={}, x, y, x"
from DBSAPI.dbsFile import DbsFile from DBSAPI.dbsAnalysisDatasetDefinition import DbsAnalysisDatasetDefinition from DBSAPI.dbsAnalysisDataset import DbsAnalysisDataset from DBSAPI.dbsLumiSection import DbsLumiSection from DBSAPI.dbsOptions import DbsOptionParser from dbsUnitTestApi import DbsUnitTestApi optManager = DbsOptionParser() (opts,args) = optManager.getOpt() api = DbsApi(opts.__dict__) #mytime = str(time.time()) mytime = time.strftime("_%Y%m%d_%Hh%Mm%Ss",time.localtime()) f = open("result.txt", "a+") apiObj = DbsUnitTestApi(api.insertPrimaryDataset, f) apiObj.setVerboseLevel(opts.verbose) f.write("\n\n***********************insertPrimaryDataset API tests***************************") primary = 'TestPrimary_001' + mytime pri1 = DbsPrimaryDataset (Name = primary, Type="TEST") apiObj.run(pri1, excep = False) primary = 'TestPrimary_002' + mytime pri2 = DbsPrimaryDataset (Name = primary, Type="TEST") apiObj.run(pri2, excep = False) pri = DbsPrimaryDataset () apiObj.run(pri, excep = True)
#Get this just once filename="bulkDataResult."+logext #print "FILENAME: "+filename f = open(filename, "w") ################# WRITING TO STDOUT COMMENT THIS LINE (UNCOMMENT ABOVE) TO WRITE TO A FILE ########### #f=sys.stdout for i in range(maxDS): # Make this cycle unique mytime = os.popen('uuidgen').readline().strip() mytime += str(i) fileList = [] #Insert Primary apiObj = DbsUnitTestApi(api.insertPrimaryDataset, f) primary = 'TestPrimary' + mytime pri1 = DbsPrimaryDataset (Name = primary) apiObj.run(pri1, excep = False) #Insert Algorithm apiObj = DbsUnitTestApi(api.insertAlgorithm,f) algo1 = DbsAlgorithm (ExecutableName="TestExe01", ApplicationVersion= "TestVersion01" + mytime, ApplicationFamily="AppFamily01", ParameterSetID=DbsQueryableParameterSet(Hash="001234565798685", Name="MyFirstParam01", Version="V001", Type="test", Annotation="This is test", Content="int a= {}, b={c=1, d=33}, f={}, x, y, x"
#Get this just once filename="bulkDataResult."+logext #print "FILENAME: "+filename f = open(filename, "w") ################# WRITING TO STDOUT COMMENT THIS LINE (UNCOMMENT ABOVE) TO WRITE TO A FILE ########### #f=sys.stdout for i in range(maxDS): # Make this cycle unique mytime = os.popen('uuidgen').readline().strip()+str(random.random()) mytime += str(i) fileList = [] #Insert Primary apiObj = DbsUnitTestApi(api.insertPrimaryDataset, f) primary = 'DBSStressTestPrimaryDataset' pri1 = DbsPrimaryDataset (Name = primary, Type="TEST") apiObj.run(pri1, excep = False) #Insert Algorithm apiObj = DbsUnitTestApi(api.insertAlgorithm,f) algo1 = DbsAlgorithm (ExecutableName="DBSStressTestExe", ApplicationVersion= "DBSStressTestVersion" + mytime, ApplicationFamily="DBSStressTestAppFam", ParameterSetID=DbsQueryableParameterSet(Hash="001234565798685", Name="DBSStressTestParam", Version="V001", Type="test", Annotation="This is test", Content="int a= {}, b={c=1, d=33}, f={}, x, y, x"