def setup(self): self.pool = FPPool(POOL_ADDRESS) self.pool.setGlobalOption(FPLibrary.FP_OPTION_EMBEDDED_DATA_THRESHOLD, 100 * 1024) self.pool.getPoolInfo() # the application will be attached to the clip id self.pool.registerApplication("python wrapper read example", "1.0")
def __init__(self, pool_ip, options=POOL_DEFAULT_OPTIONS, application=("caspython-centera-library", _version), replace=None): """ Initialize a pool :param host: :param options: :param application: a couple (appname, version) attached to the clip_id :param replace: a translation map for replacing unsupported characters :return: """ self.log = logging.getLogger(__name__) self.pool = FPPool(pool_ip) for k, v in options.items(): self.pool.setGlobalOption(k, v) # getPoolInfo sets infos in self.pool. self.pool.getPoolInfo() # the application will be attached to the clip id self.pool.registerApplication(*application)
from Filepool.FPClientException import FPClientException from Filepool.FPException import FPException from Filepool.FPLibrary import FPLibrary from Filepool.FPNetException import FPNetException from Filepool.FPPool import FPPool from Filepool.FPQuery import FPQuery from Filepool.FPQueryExpression import FPQueryExpression from Filepool.FPQueryResult import FPQueryResult from Filepool.FPServerException import FPServerException from Filepool.util import parse_config try: sec_in_day = 86400 ip = raw_input("Pool address: ") or parse_config('test/test.ini') pool = FPPool(ip) queryExpression = FPQueryExpression() queryExpression.setType(FPLibrary.FP_QUERY_TYPE_EXISTING) # 1371735529 ts = int(time.time() - 15 * sec_in_day) queryExpression.setStartTime(ts) query = FPQuery(pool) query.open(queryExpression) queryExpression.close() status = 0 while True: res = FPQueryResult(query.fetchResult(0)) status = res.getResultCode()
def test_work_on_closed(): pool = FPPool(POOL_ADDRESS) log.info("Pool opened with handle: %r", pool.handle) pool.close() log.info("Pool opened with handle: %r", pool.handle) pool.getClusterTime()
def test_double_close(): pool = FPPool(POOL_ADDRESS) log.info("Pool opened with handle: %r", pool.handle) pool.close() log.info("Pool opened with handle: %r", pool.handle) pool.close()