def startElement(self, name, attrs): if name == 'file_proc_quality': failedevts = [ long(x) for x in (str(attrs['failed_event_list']).split()) ] result.append( DbsFileProcessingQuality( ParentFile=str(attrs['lfn']), ChildDataset=str(attrs['child_dataset']), FailedEventCount=long(attrs['failed_event_count']), FailedEventList=failedevts, Description=str(attrs['description']), CreationDate=str(attrs['creation_date']), CreatedBy=str(attrs['created_by']), LastModificationDate=str( attrs['last_modification_date']), LastModifiedBy=str(attrs['last_modified_by']), ))
f.write("\n\n***********************closeBlock API tests***************************") apiObj.run(block1, excep = False) apiObj.run("DOESNOTEXIST", excep = True) apiObj.run("abcd;edf", excep = True) apiObj.run("/does/no/exit#1234", excep = True) f.write("\n\n***********************closeBlock API tests***************************") apiObj = DbsUnitTestApi(api.insertFileProcQuality, f) apiObj.setVerboseLevel(opts.verbose) f.write("\n\n**********************insertFileProcQuality API tests***************************") fileQualityObj = DbsFileProcessingQuality( ParentFile=file1['LogicalFileName'], ChildDataset=get_path(proc1), ProcessingStatus='FAILED', FailedEventCount=5, Description="This is a test", FailedEventList=[1,2,3,4,5] ) apiObj.run(fileQualityObj, excep = False) f.write("\n\n**********************insertFileProcQuality API tests***************************") # Store ONE path that could be used by next LIST test cases pathfile=open('pathfile', 'w') pathfile.write(path) pathfile.close() blockfile=open('blockfile', 'w') blockfile.write(blockName) blockfile.close()
import sys from DBSAPI.dbsApi import DbsApi from DBSAPI.dbsException import * from DBSAPI.dbsApiException import * from DBSAPI.dbsOptions import DbsOptionParser from DBSAPI.dbsFileProcessingQuality import DbsFileProcessingQuality optManager = DbsOptionParser() (opts, args) = optManager.getOpt() api = DbsApi(opts.__dict__) try: fileQuality = DbsFileProcessingQuality( ParentFile= '/store/data/BeamCommissioning08/Cosmics/RAW/v1/000/062/571/B60CBD20-1C82-DD11-84E2-00161757BF42.root', ChildDataset='/Cosmics/BeamCommissioning08-PromptReco-v1/RECO', ProcessingStatus='FAILED_RECO', FailedEventCount=5, Description="This is a test", FailedEventList=[1, 2, 3, 4, 5]) api.insertFileProcQuality(fileQuality) except DbsApiException, ex: print "Caught API Exception %s: %s " % (ex.getClassName(), ex.getErrorMessage()) if ex.getErrorCode() not in (None, ""): print "DBS Exception Error Code: ", ex.getErrorCode() print "Done"