myThread.transaction.rollback() raise except Exception, ex: msg = "Unhandled exception while setting blocks in files.\n" msg += str(ex) logging.error(msg) logging.debug("Files to Update: %s\n" % self.filesToUpdate) myThread.transaction.rollback() raise DBSUploadException(msg) # Now that things are in DBSBuffer, we can put them in DBS for block in blocks: logging.debug("Found block %s in blocks" % block.getName()) block.setPhysicsGroup(group = self.physicsGroup) encodedBlock = block.data self.input.put({'name': block.getName(), 'block': encodedBlock}) if self.produceCopy: import json f = open(self.copyPath, 'w') f.write(json.dumps(encodedBlock)) f.close() self.queuedBlocks.append(block.getName()) # And all work is in and we're done for now return
for block in createInDBS: if len(block.files) < 1: # What are we doing? logging.debug("Skipping empty block") continue if not block.hasDataset(): # Then we have to fix the dataset dbsFile = block.files[0] block.setDataset(datasetName=dbsFile['datasetPath'], primaryType=self.primaryDatasetType, datasetType=self.datasetType, physicsGroup=dbsFile.get( 'physicsGroup', None), prep_id=dbsFile.get('prep_id', None)) logging.debug("Found block %s in blocks" % block.getName()) block.setPhysicsGroup(group=self.physicsGroup) encodedBlock = block.convertToDBSBlock() logging.info("About to insert block %s" % block.getName()) self.input.put({'name': block.getName(), 'block': encodedBlock}) self.blockCount += 1 if self.produceCopy: import json f = open(self.copyPath, 'w') f.write(json.dumps(encodedBlock)) f.close() self.queuedBlocks.append(block.getName()) # And all work is in and we're done for now return