def initializeHandler(cls, _serviceInfoDict): """ initialize handler """ try: cls.fts3db = FTS3DB() except RuntimeError, error: gLogger.exception(error) return S_ERROR(error)
def initialize(self): """ agent's initialization """ self.fts3db = FTS3DB() self._globalContextCache = {} # name that will be used in DB for assignment tag self.assignmentTag = gethostname().split('.')[0] res = self.__readConf() self.jobsThreadPool = ThreadPool(self.maxNumberOfThreads) self.opsThreadPool = ThreadPool(self.maxNumberOfThreads) return res
def initialize(self): """Agent's initialization :return: S_OK()/S_ERROR() """ self._globalContextCache = {} # name that will be used in DB for assignment tag self.assignmentTag = gethostname().split(".")[0] res = self.__readConf() # We multiply by two because of the two threadPools self.fts3db = FTS3DB(pool_size=2 * self.maxNumberOfThreads) self.jobsThreadPool = ThreadPool(self.maxNumberOfThreads) self.opsThreadPool = ThreadPool(self.maxNumberOfThreads) return res
def _perf(self): db = FTS3DB() listOfIds = [] persistStart = time.time() for i in xrange(1000): op = self.generateOperation('Transfer', i % 20 + 1, ['Dest1']) res = db.persistOperation(op) self.assertTrue(res['OK']) listOfIds.append(res['Value']) persistEnd = time.time() for opId in listOfIds: res = db.getOperation(opId) self.assertTrue(res['OK']) getEnd = time.time() print "Generation of 1000 operation and 10500 files %s s, retrival %s s" % ( persistEnd - persistStart, getEnd - persistEnd)
def setUp(self): self.client = FTS3Client() self.db = FTS3DB() self.fileCounter = 0