本文整理汇总了Python中neubot.database.DATABASE.close方法的典型用法代码示例。如果您正苦于以下问题:Python DATABASE.close方法的具体用法?Python DATABASE.close怎么用?Python DATABASE.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neubot.database.DATABASE
的用法示例。
在下文中一共展示了DATABASE.close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from neubot.database import DATABASE [as 别名]
# 或者: from neubot.database.DATABASE import close [as 别名]
def main(args):
""" Main function """
if not system.has_enough_privs():
sys.exit('FATAL: you must be root')
common.main("agent", "Run in background, periodically run tests", args)
conf = CONFIG.copy()
privacy.complain_if_needed()
BACKEND.use_backend("neubot")
BACKEND.datadir_init()
# FIXME We're ignoring agent.api.{address,port} that are now
# deprecated and should be removed soon.
background_api.start_api()
if conf["agent.daemonize"]:
LOG.redirect()
system.go_background()
if conf["agent.use_syslog"]:
LOG.redirect()
#
# When we run as an agent we also save logs into
# the database, to easily access and show them via
# the web user interface.
#
LOG.use_database()
logging.info('%s for POSIX: starting up', utils_version.PRODUCT)
system.drop_privileges()
if os.getuid() == 0 or os.geteuid() == 0:
logging.error('agent: still running as root')
os._exit(1)
if conf["agent.rendezvous"]:
BACKGROUND_RENDEZVOUS.start()
POLLER.loop()
logging.info('%s for POSIX: shutting down', utils_version.PRODUCT)
LOG.writeback()
#
# Make sure that we do not leave the database
# in an inconsistent state.
#
DATABASE.close()
示例2: main
# 需要导入模块: from neubot.database import DATABASE [as 别名]
# 或者: from neubot.database.DATABASE import close [as 别名]
def main(args):
''' Main() function '''
try:
options, arguments = getopt.getopt(args[1:], '')
except getopt.error:
sys.exit('usage: neubot background_win32')
if options or arguments:
sys.exit('usage: neubot background_win32')
# Read settings from database
CONFIG.merge_database(DATABASE.connection())
BACKEND.use_backend("neubot")
BACKEND.datadir_init()
#
# Save logs into the database, to easily access
# and show them via the web user interface.
#
LOG.use_database()
logging.info('%s for Windows: starting up', utils_version.PRODUCT)
# Complain if privacy settings are not OK
privacy.complain_if_needed()
background_api.start_api()
BACKGROUND_RENDEZVOUS.start()
__start_updater()
POLLER.loop()
logging.info('%s for Windows: shutting down', utils_version.PRODUCT)
LOG.writeback()
#
# Make sure that we do not leave the database
# in an inconsistent state.
#
DATABASE.close()