def startService(self): log.info("starting DBase Service") yield self.schema() self.startTasks() # Remainder Service initialization Service.startService(self) log.info("Database operational.")
def __init__(self, options, **kargs): Service.__init__(self) self.options = options self.depth = options['depth'] self.enabled = options['enabled'] self.fifos = dict() setLogLevel(namespace=NAMESPACE, levelStr=options['log_level'])
def startService(self): log.info("starting DBase Service on {database}", database=self.options['connection_string']) self.schema() # setup the connection pool for asynchronouws adbapi self.openPool() self.startTasks() # Remainder Service initialization Service.startService(self) log.info("Database operational.")
def __init__(self, options, **kargs): Service.__init__(self) self.options = options self.paused = False self.onBoot = True self.timeStatList = [] self.nrowsStatList = [] self.sunriseTask = task.LoopingCall(self.sunrise) setLogLevel(namespace='dbase', levelStr=options['log_level']) setLogLevel(namespace='register', levelStr=options['register_log_level']) if self.options['secs_resolution'] not in self.SECS_RESOLUTION: raise DiscreteValueError(self.options['secs_resolution'], self.SECS_RESOLUTION)
def __init__(self, options, **kargs): Service.__init__(self) self.options = options self.paused = False self.onBoot = True self.timeStatList = [] self.nrowsStatList = [] setLogLevel(namespace='dbase', levelStr=options['log_level']) setLogLevel(namespace='registry', levelStr=options['register_log_level']) if self.options['secs_resolution'] not in self.SECS_RESOLUTION: raise DiscreteValueError(self.options['secs_resolution'], self.SECS_RESOLUTION) # Import appropiate DAO module if self.options['type'] == "sqlite3": import sqlite3 from .sqlite3 import getPool, Date, TimeOfDay, TESSUnits, Location, TESS, TESSReadings if not os.path.exists(options['connection_string']): raise IOError( "No SQLite3 Database file found in {0}. Exiting ...". format(options['connection_string'])) # synchronous database initialization uses standard API, not adbapi connection = sqlite3.connect(options['connection_string']) self.getPoolFunc = getPool else: msg = "No database driver found for '{0}'".format( self.options['type']) raise ImportError(msg) # Create DAO objects self.pool = None self.connection = connection self.tess = TESS(connection) self.tess_units = TESSUnits(connection) self.tess_readings = TESSReadings(connection, self) self.tess_locations = Location(connection) self.date = Date(connection) self.time = TimeOfDay(connection, self.options['secs_resolution'])
def stopService(self): try: yield Service.stopService(self) except Exception as e: log.error("Exception {excp!s}", excp=e) reactor.stop()
def stopService(self): self.pool.close() d = Service.stopService() log.info("Database stopped.") return d
def stopService(self): self.closePool() d = Service.stopService() log.info("Database stopped.") return d