try: pass api.createProcessedDataset (hits) api.createProcessedDataset (digi) api.createProcessedDataset (dst) except DbsCgiObjectExists, ex: print "Object existed already, passing" # Attempt to insert a file print "trying to create file object" file = DbsFile (logicalFileName="LFN1xyz", fileSize=long(1), checkSum="cksum:1", fileType="EVD") print "Inserting file %s" % file try: pass api.insertFiles (block, [ file ]) except DbsCgiObjectExists, ex: print "Object existed already, passing" # Attempt to insert hit and digi event collections print "creating ev object" #ech = DbsEventCollection (collectionName="HC2", numberOfEvents=long(1), collectionStatus='NEW', fileList=[file]) ech = DbsEventCollection (collectionName="HC2", numberOfEvents=long(1), fileList=[file]) ecd = DbsEventCollection (collectionName="DC2", numberOfEvents=long(1), fileList=[file], parentageList=[ { 'parent' : ech, 'type' : 'Hit' } ]) ecs = DbsEventCollection (collectionName="SC2", numberOfEvents=long(1), fileList=[file], parentageList=[ { 'parent' : ecd, 'type' : 'Digi' } ]) print "Inserting event collections\n %s\n %s\n %s" % (ech, ecd, ecs) try: api.insertEventCollections (hits, [ ech ]) api.insertEventCollections (digi, [ ecd ])
numberOfEvents=long(10), fileList=[file5], parentageList=[{"parent": e4, "type": "Hit"}], ) e6 = DbsEventCollection( collectionName="tmpxE6", numberOfEvents=long(10), fileList=[file6], parentageList=[{"parent": e5, "type": "Hit"}], ) print "" print "Inserting file " try: pass api.insertFiles(block, [file1, file2, file3, file4, file5, file6, fileout]) except DbsCgiObjectExists, ex: print "Object existed already, passing" print "Inserting event collections\n %s " % (eout1) try: # pass api.insertEventCollections(hits, [e1]) api.insertEventCollections(hits, [e2]) api.insertEventCollections(hits, [e3]) api.insertEventCollections(hits, [e4]) api.insertEventCollections(hits, [e5]) api.insertEventCollections(hits, [e6]) api.insertEventCollections(digi, [eout1]) api.insertEventCollections(dst, [eout2])
files.append (f) evcs.append (e) print "Creating primary dataset %s" % primary api.createPrimaryDataset (primary) print "Creating processing %s" % processing api.createProcessing (processing) print "Creating file block %s" % block api.createFileBlock (block) print "Creating processed dataset %s" % gen api.createProcessedDataset (gen) for (files, evcs) in all: print "Inserting %d files into %s" % (len(files), block) api.insertFiles (block, files) print "Inserting %d evcs into %s" % (len(evcs), gen) api.insertEventCollections (gen, evcs) except InvalidDataTier, ex: print "Caught InvalidDataTier API exception: %s" % (ex.getErrorMessage()) except DbsApiException, ex: print "Caught API exception %s: %s" % (ex.getClassName(), ex.getErrorMessage()) except DbsException, ex: print "Caught exception %s: %s" % (ex.getClassName(), ex.getErrorMessage()) print "Done"