我正在Windows7上运行BuildBot0.8.8版。
我有一个配置(master.cfg
)文件,它使用一个小技巧创建所有构建器。我从subversion中读取了一个XML文件,其中列出了构建器的所有步骤。类似于:
<Builder name="BuilderA" description="Builds the A project">
<Command name="Clean">-v -t realclean -p my\\projA</Command>
<Command name="Release">-v -t release -p my\\projA</Command>
</Builder>
<Builder name="BuilderB" description="Builds the B project">
<Command name="Clean">-v -t realclean -p my\\projB</Command>
<Command name="Release">-v -t release -p my\\projB</Command>
</Builder>
其思想是,任何开发人员都可以在subversion中更改XML文件,然后可以重新启动buildmaster,以获得新的buildbot配置。
我使用命令启动buildbot:
buildbot start C:\master_dir
我面临的问题是,当我试图
restart
buildbot时,它会抱怨buildmaster没有运行。深入挖掘源代码,我发现当试图打开buildbot\scripts\stop.py:34
文件时,它在twisted.pid
中失败。pidfile = os.path.join(basedir, 'twistd.pid')
try:
with open(pidfile, "rt") as f:
pid = int(f.read().strip())
except:
if not config['quiet']:
print "buildmaster not running"
return 0
我不知道这个
twisted.pid
文件是什么,为什么buildbot要找这个?如有任何帮助或想法,将不胜感激。谢谢。 最佳答案
我也遇到同样的问题。windows上似乎没有创建文件twistd.pid
。我不确定这个bug是从哪里来的,但我向buildbot团队报告了这个bug:http://trac.buildbot.net/ticket/3512
作为解决方法,我现在在master.cfg中添加了:
import os
if not os.path.exists("twistd.pid"):
with open("twistd.pid", "w") as pidfile:
pidfile.write("{}".format(os.getpid()))
编辑:事实上,停止后PID文件似乎没有被删除。。。所以我尝试了更多:
else:
realpid = os.getpid()
filepid = 0
with open("twistd.pid", "r") as pidfile:
filepid = int(pidfile.read())
if filepid == 0 or filepid != realpid:
with open("twistd.pid", "w") as pidfile:
pidfile.write("{}".format(realpid))
它似乎可以工作,但如果在buildbot确实不运行时尝试停止它,则会出现错误,因为PID文件将生成错误的PID并试图终止它。