本文整理汇总了Python中buildbot.master.BuildMaster.config方法的典型用法代码示例。如果您正苦于以下问题:Python BuildMaster.config方法的具体用法?Python BuildMaster.config怎么用?Python BuildMaster.config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类buildbot.master.BuildMaster
的用法示例。
在下文中一共展示了BuildMaster.config方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upgradeDatabase
# 需要导入模块: from buildbot.master import BuildMaster [as 别名]
# 或者: from buildbot.master.BuildMaster import config [as 别名]
def upgradeDatabase(config, master_cfg):
if not config['quiet']:
print("upgrading database (%s)"
% (stripUrlPassword(master_cfg.db['db_url'])))
print("Warning: Stopping this process might cause data loss")
def sighandler(signum, frame):
msg = " ".join("""
WARNING: ignoring signal %s.
This process should not be interrupted to avoid database corruption.
If you really need to terminate it, use SIGKILL.
""".split())
print(msg % signum)
prev_handlers = {}
try:
for signame in ("SIGTERM", "SIGINT", "SIGQUIT", "SIGHUP",
"SIGUSR1", "SIGUSR2", "SIGBREAK"):
if hasattr(signal, signame):
signum = getattr(signal, signame)
prev_handlers[signum] = signal.signal(signum, sighandler)
master = BuildMaster(config['basedir'])
master.config = master_cfg
master.db.disownServiceParent()
db = connector.DBConnector(basedir=config['basedir'])
db.setServiceParent(master)
yield db.setup(check_version=False, verbose=not config['quiet'])
yield db.model.upgrade()
yield db.masters.setAllMastersActiveLongTimeAgo()
finally:
# restore previous signal handlers
for signum, handler in prev_handlers.items():
signal.signal(signum, handler)
示例2: do_test_master
# 需要导入模块: from buildbot.master import BuildMaster [as 别名]
# 或者: from buildbot.master.BuildMaster import config [as 别名]
def do_test_master(self):
# create the master and set its config
m = BuildMaster(self.basedir, self.configfile)
m.config = config.MasterConfig.loadConfig(
self.basedir, self.configfile)
# update the DB
yield m.db.setup(check_version=False)
yield m.db.model.upgrade()
# stub out m.db.setup since it was already called above
m.db.setup = lambda : None
# mock reactor.stop (which trial *really* doesn't
# like test code to call!)
mock_reactor = mock.Mock(spec=reactor)
mock_reactor.callWhenRunning = reactor.callWhenRunning
# start the service
yield m.startService(_reactor=mock_reactor)
self.failIf(mock_reactor.stop.called,
"startService tried to stop the reactor; check logs")
# stop the service
yield m.stopService()
# and shutdown the db threadpool, as is normally done at reactor stop
m.db.pool.shutdown()
示例3: doCleanupDatabase
# 需要导入模块: from buildbot.master import BuildMaster [as 别名]
# 或者: from buildbot.master.BuildMaster import config [as 别名]
def doCleanupDatabase(config, master_cfg):
if not config["quiet"]:
print("cleaning database (%s)" % (master_cfg.db["db_url"]))
master = BuildMaster(config["basedir"])
master.config = master_cfg
db = master.db
yield db.setup(check_version=False, verbose=not config["quiet"])
res = yield db.logs.getLogs()
i = 0
percent = 0
saved = 0
for log in res:
saved += yield db.logs.compressLog(log["id"], force=config["force"])
i += 1
if not config["quiet"] and percent != i * 100 / len(res):
percent = i * 100 / len(res)
print(" {0}% {1} saved".format(percent, saved))
saved = 0
sys.stdout.flush()
if master_cfg.db["db_url"].startswith("sqlite"):
if not config["quiet"]:
print("executing sqlite vacuum function...")
# sqlite vacuum function rebuild the whole database to claim
# free disk space back
def thd(engine):
r = engine.execute("vacuum;")
r.close()
yield db.pool.do(thd)
示例4: upgradeDatabase
# 需要导入模块: from buildbot.master import BuildMaster [as 别名]
# 或者: from buildbot.master.BuildMaster import config [as 别名]
def upgradeDatabase(config, master_cfg):
if not config['quiet']:
print "upgrading database (%s)" % (master_cfg.db['db_url'])
master = BuildMaster(config['basedir'])
master.config = master_cfg
db = connector.DBConnector(master, basedir=config['basedir'])
yield db.setup(check_version=False, verbose=not config['quiet'])
yield db.model.upgrade()
示例5: getMaster
# 需要导入模块: from buildbot.master import BuildMaster [as 别名]
# 或者: from buildbot.master.BuildMaster import config [as 别名]
def getMaster(self, config_dict):
"""
Create a started ``BuildMaster`` with the given configuration.
"""
basedir = FilePath(self.mktemp())
basedir.createDirectory()
master = BuildMaster(
basedir.path, reactor=reactor, config_loader=DictLoader(config_dict))
master.config = master.config_loader.loadConfig()
return master
示例6: upgradeDatabase
# 需要导入模块: from buildbot.master import BuildMaster [as 别名]
# 或者: from buildbot.master.BuildMaster import config [as 别名]
def upgradeDatabase(config, master_cfg):
if not config['quiet']:
print("upgrading database (%s)" % (master_cfg.db['db_url']))
master = BuildMaster(config['basedir'])
master.config = master_cfg
master.db.disownServiceParent()
db = connector.DBConnector(basedir=config['basedir'])
db.setServiceParent(master)
yield db.setup(check_version=False, verbose=not config['quiet'])
yield db.model.upgrade()
yield db.masters.setAllMastersActiveLongTimeAgo()
示例7: createDB
# 需要导入模块: from buildbot.master import BuildMaster [as 别名]
# 或者: from buildbot.master.BuildMaster import config [as 别名]
def createDB(config, _noMonkey=False):
# apply the db monkeypatches (and others - no harm)
if not _noMonkey: # pragma: no cover
monkeypatches.patch_all()
# create a master with the default configuration, but with db_url
# overridden
master_cfg = config_module.MasterConfig()
master_cfg.db['db_url'] = config['db']
master = BuildMaster(config['basedir'])
master.config = master_cfg
db = connector.DBConnector(master, config['basedir'])
yield db.setup(check_version=False, verbose=not config['quiet'])
if not config['quiet']:
print "creating database (%s)" % (master_cfg.db['db_url'],)
yield db.model.upgrade()
示例8: get_master
# 需要导入模块: from buildbot.master import BuildMaster [as 别名]
# 或者: from buildbot.master.BuildMaster import config [as 别名]
def get_master(basedir):
cfg = cm.MasterConfig.loadConfig(basedir, 'master.cfg')
master = BuildMaster(basedir)
master.config = cfg
return master