<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tony&#039;s Blog &#187; sysadmin</title>
	<atom:link href="http://stolennotebook.com/anthony/category/sysadmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://stolennotebook.com/anthony</link>
	<description>Just another Stolen Notebook weblog</description>
	<lastBuildDate>Tue, 07 Sep 2010 16:24:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Getting File Changes From Buildbot</title>
		<link>http://stolennotebook.com/anthony/2007/01/19/18/</link>
		<comments>http://stolennotebook.com/anthony/2007/01/19/18/#comments</comments>
		<pubDate>Sat, 20 Jan 2007 03:27:17 +0000</pubDate>
		<dc:creator>tonymagro</dc:creator>
				<category><![CDATA[buildbot]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.stolennotebook.com/anthony/2007/01/19/18/</guid>
		<description><![CDATA[During a Buildbot build step you might need to have a list of files which have changed as a result of a commit to your repository. A quick way to get this information during a build step is to subclass the build step class of your choice and overload its start() function. A build step&#8217;s [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>During a Buildbot build step you might need to have a list of files which have changed as a  result of a commit to your repository. A quick way to get this information during a build step is to subclass the build step class of your choice and overload its start() function.</p>
<p>A build step&#8217;s start() function is responsible for telling the slave to start executing the command. Each step class has a member variable called &#8220;build&#8221; of type &#8220;buildbot.process.base.Build&#8221; which it inherits from its main parent class &#8220;buildbot.process.buildstep.BuildStep&#8221;. Here is a quick example of getting file change information during a ShellCommand step in your master.cfg file:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;color: #111;"><span style="color: #ff7700;font-weight:bold;color: #B83A24;">from</span> twisted.<span style="color: black;color: #517656">python</span> <span style="color: #ff7700;font-weight:bold;color: #B83A24;">import</span> log
<span style="color: #ff7700;font-weight:bold;color: #B83A24;">from</span> buildbot.<span style="color: black;color: #517656">steps</span> <span style="color: #ff7700;font-weight:bold;color: #B83A24;">import</span> shell
<span style="color: #ff7700;font-weight:bold;color: #B83A24;">from</span> buildbot.<span style="color: black;color: #517656">process</span>.<span style="color: black;color: #517656">buildstep</span> <span style="color: #ff7700;font-weight:bold;color: #B83A24;">import</span> RemoteShellCommand
&nbsp;
<span style="color: #808080; font-style: italic;color: #CDC;"># Executes a remote command with changed files appended onto the end</span>
<span style="color: #ff7700;font-weight:bold;color: #B83A24;">class</span> ShellCommandChangeList<span style="color: black;color: #729AE3;">&#40;</span>shell.<span style="color: black;color: #517656">ShellCommand</span><span style="color: black;color: #729AE3;">&#41;</span>:
  <span style="color: #ff7700;font-weight:bold;color: #B83A24;">def</span> start<span style="color: black;color: #729AE3;">&#40;</span><span style="color: #008000;color: #B83A24;">self</span><span style="color: black;color: #729AE3;">&#41;</span>:
    <span style="color: #808080; font-style: italic;color: #CDC;"># Substitute build properties into command</span>
    command = <span style="color: #008000;color: #B83A24;">self</span>._interpolateProperties<span style="color: black;color: #729AE3;">&#40;</span><span style="color: #008000;color: #B83A24;">self</span>.<span style="color: black;color: #517656">command</span><span style="color: black;color: #729AE3;">&#41;</span>
    <span style="color: #808080; font-style: italic;color: #CDC;"># fail assert if command is not of correct type</span>
    <span style="color: #ff7700;font-weight:bold;color: #B83A24;">assert</span> <span style="color: #008000;color: #B83A24;">isinstance</span><span style="color: black;color: #729AE3;">&#40;</span>command, <span style="color: black;color: #729AE3;">&#40;</span><span style="color: #008000;color: #B83A24;">list</span>, <span style="color: #008000;color: #B83A24;">tuple</span>, <span style="color: #008000;color: #B83A24;">str</span><span style="color: black;color: #729AE3;">&#41;</span><span style="color: black;color: #729AE3;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;color: #CDC;"># Get changed file list from the build which invoked this step</span>
    files = <span style="color: #008000;color: #B83A24;">self</span>.<span style="color: black;color: #517656">build</span>.<span style="color: black;color: #517656">allFiles</span><span style="color: black;color: #729AE3;">&#40;</span><span style="color: black;color: #729AE3;">&#41;</span>
    <span style="color: #808080; font-style: italic;color: #CDC;"># Log the changed files to twistd.log</span>
    log.<span style="color: black;color: #517656">msg</span><span style="color: black;color: #729AE3;">&#40;</span><span style="color: #483d8b;color: #666666;">&quot;Build Files: %s&quot;</span> <span style="color: #66cc66;color: #729AE3;">%</span> files<span style="color: black;color: #729AE3;">&#41;</span>
    <span style="color: #808080; font-style: italic;color: #CDC;"># Now we can do whatever we want with the list of changed files.</span>
    <span style="color: #808080; font-style: italic;color: #CDC;"># I will just append them to the end of the command.</span>
&nbsp;
    <span style="color: #808080; font-style: italic;color: #CDC;"># Convert file list so it can be appended to the command's type</span>
    <span style="color: #ff7700;font-weight:bold;color: #B83A24;">if</span> <span style="color: #008000;color: #B83A24;">isinstance</span><span style="color: black;color: #729AE3;">&#40;</span>command, <span style="color: #008000;color: #B83A24;">str</span><span style="color: black;color: #729AE3;">&#41;</span>:
        files = <span style="color: #483d8b;color: #666666;">&quot; &quot;</span>.<span style="color: black;color: #517656">join</span><span style="color: black;color: #729AE3;">&#40;</span>files<span style="color: black;color: #729AE3;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;color: #B83A24;">elif</span> <span style="color: #008000;color: #B83A24;">isinstance</span><span style="color: black;color: #729AE3;">&#40;</span>command, <span style="color: #008000;color: #B83A24;">tuple</span><span style="color: black;color: #729AE3;">&#41;</span>:
        files = <span style="color: #008000;color: #B83A24;">tuple</span><span style="color: black;color: #729AE3;">&#40;</span>files<span style="color: black;color: #729AE3;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;color: #CDC;"># append files to end of command</span>
    command += files
&nbsp;
    <span style="color: #808080; font-style: italic;color: #CDC;"># We have created the final command string</span>
    <span style="color: #808080; font-style: italic;color: #CDC;"># so we can fill out the arguments for a RemoteShellCommand</span>
    <span style="color: #808080; font-style: italic;color: #CDC;"># using our new command string</span>
    kwargs = <span style="color: #008000;color: #B83A24;">self</span>.<span style="color: black;color: #517656">remote_kwargs</span>
    kwargs<span style="color: black;color: #729AE3;">&#91;</span><span style="color: #483d8b;color: #666666;">'command'</span><span style="color: black;color: #729AE3;">&#93;</span> = command
    kwargs<span style="color: black;color: #729AE3;">&#91;</span><span style="color: #483d8b;color: #666666;">'logfiles'</span><span style="color: black;color: #729AE3;">&#93;</span> = <span style="color: #008000;color: #B83A24;">self</span>.<span style="color: black;color: #517656">logfiles</span>
&nbsp;
    <span style="color: #808080; font-style: italic;color: #CDC;"># Create the RemoteShellCommand and start it</span>
    <span style="color: #dc143c;color: #8FB394;">cmd</span> = RemoteShellCommand<span style="color: black;color: #729AE3;">&#40;</span><span style="color: #66cc66;color: #729AE3;">**</span>kwargs<span style="color: black;color: #729AE3;">&#41;</span>
    <span style="color: #008000;color: #B83A24;">self</span>.<span style="color: black;color: #517656">setupEnvironment</span><span style="color: black;color: #729AE3;">&#40;</span><span style="color: #dc143c;color: #8FB394;">cmd</span><span style="color: black;color: #729AE3;">&#41;</span>
    <span style="color: #008000;color: #B83A24;">self</span>.<span style="color: black;color: #517656">checkForOldSlaveAndLogfiles</span><span style="color: black;color: #729AE3;">&#40;</span><span style="color: black;color: #729AE3;">&#41;</span>
    <span style="color: #008000;color: #B83A24;">self</span>.<span style="color: black;color: #517656">startCommand</span><span style="color: black;color: #729AE3;">&#40;</span><span style="color: #dc143c;color: #8FB394;">cmd</span><span style="color: black;color: #729AE3;">&#41;</span></pre></div></div>

<p>You can use the new ShellCommandChangeList class in the same way you use the ShellCommand class. The only difference being the ShellCommandChangeList class will append a list of changed files to the end of the step&#8217;s shell command. We use a similar class and method at Stolen Notebook to build large source asset files (models, levels, art, etc.) automatically with buildbot when they are checked into our repository.</p>
<p>Here is a short contrived example of using the new ShellCommandChangeList build step with a BuildFactory to call a remote command for a fictional program named `checksum`. Let&#8217;s say that `checksum` is a program which takes filenames as input, computes the checksum of those files and prints those checksums to standard out.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;color: #111;"><span style="color: #ff7700;font-weight:bold;color: #B83A24;">from</span> buildbot.<span style="color: black;color: #517656">steps</span> <span style="color: #ff7700;font-weight:bold;color: #B83A24;">import</span> source, shell
<span style="color: #ff7700;font-weight:bold;color: #B83A24;">from</span> buildbot.<span style="color: black;color: #517656">process</span> <span style="color: #ff7700;font-weight:bold;color: #B83A24;">import</span> factory
&nbsp;
f = factory.<span style="color: black;color: #517656">BuildFactory</span><span style="color: black;color: #729AE3;">&#40;</span><span style="color: black;color: #729AE3;">&#41;</span>
f.<span style="color: black;color: #517656">addStep</span><span style="color: black;color: #729AE3;">&#40;</span>source.<span style="color: black;color: #517656">SVN</span>, svnurl=<span style="color: #483d8b;color: #666666;">&quot;http://svn.example.org/Trunk/&quot;</span><span style="color: black;color: #729AE3;">&#41;</span>
f.<span style="color: black;color: #517656">addStep</span><span style="color: black;color: #729AE3;">&#40;</span>ShellCommandChangeList, command=<span style="color: black;color: #729AE3;">&#91;</span><span style="color: #483d8b;color: #666666;">&quot;checksum&quot;</span><span style="color: black;color: #729AE3;">&#93;</span><span style="color: black;color: #729AE3;">&#41;</span></pre></div></div>

<p>Lets say two files named main.cpp and main.h are changed in the src directory of our svnurl and submitted to the repository which triggers this build. The normal ShellCommand step would just call &#8220;checksum&#8221; remotely. The ShellCommandChangeList step on the other hand would call &#8220;checksum src/main.cpp src/main.h&#8221;</p>
<p>You should note that the way your VC system works and how your repository is set up in terms of file location and branches may affect how the file change paths are presented to you. You can easily see the list of file changes by using log.msg in your start() function to print them to the twistd.log file.</p>
]]></content:encoded>
			<wfw:commentRss>http://stolennotebook.com/anthony/2007/01/19/18/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Buildbot as a Windows XP Service Part 2</title>
		<link>http://stolennotebook.com/anthony/2007/01/15/buildbot-as-a-windows-xp-service-part-2/</link>
		<comments>http://stolennotebook.com/anthony/2007/01/15/buildbot-as-a-windows-xp-service-part-2/#comments</comments>
		<pubDate>Mon, 15 Jan 2007 18:06:25 +0000</pubDate>
		<dc:creator>tonymagro</dc:creator>
				<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.stolennotebook.com/anthony/2007/01/15/buildbot-as-a-windows-xp-service-part-2/</guid>
		<description><![CDATA[This is a quick update to my last article on Running Buildbot as a Windows XP Service. There was an interesting comment posted by jdpipe regarding the previous article . He offered a nice solution for some issues I was having with environment variables and stopping the Buildbot service. You can check out the article [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>This is a quick update to my last article on <a title="Running Bulidbot as a WindowsXP Service" href="http://www.stolennotebook.com/anthony/2006/07/03/running-buildbot-as-a-windows-xp-service/">Running Buildbot as a Windows XP Service</a>. There was an interesting comment posted by <em>jdpipe </em>regarding the previous article . He offered a <a title="The ASCEND BuildBot" href="http://ascendwiki.cheme.cmu.edu/BuildBot">nice solution</a> for some issues I was having with environment variables and stopping the Buildbot service. You can check out the article he wrote about it at <a title="The ASCEND BuildBot" href="http://ascendwiki.cheme.cmu.edu/BuildBot">https://pse.cheme.cmu.edu/wiki/view/Ascend/BuildBot</a><cite>.</cite></p>
<p>He recommends using a python script instead of a batch file to ensure the build environment is setup correctly. By using a python script the service now launches pythonw.exe directly. This solves the Buildbot  service issue where it&#8217;s not able to stop or restart properly as a result of being launched from a batch file. The <a title="The ASCEND BuildBot" href="http://ascendwiki.cheme.cmu.edu/BuildBot">article</a> by jdpipe has excellent information on setting this up along with some pictures to help illustrate the process.</p>
]]></content:encoded>
			<wfw:commentRss>http://stolennotebook.com/anthony/2007/01/15/buildbot-as-a-windows-xp-service-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SNTask Utility</title>
		<link>http://stolennotebook.com/anthony/2006/09/05/sntask-utility/</link>
		<comments>http://stolennotebook.com/anthony/2006/09/05/sntask-utility/#comments</comments>
		<pubDate>Tue, 05 Sep 2006 07:09:12 +0000</pubDate>
		<dc:creator>tonymagro</dc:creator>
				<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.stolennotebook.com/anthony/2006/09/05/sntask-utility/</guid>
		<description><![CDATA[I have been working on setting up the new automated build system. We were having some hardware problems with the new server which was very unfortunate. Denrei tracked it down to the new gigabit NIC I installed. For now, we are going to revert back to the 100 Mbit onboard NIC. Despite the problems, the [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p class="MsoNormal">
<p class="MsoNormal">I have been working on setting up the new automated build system. We were having some hardware problems with the new server which was very unfortunate. Denrei tracked it down to the new gigabit NIC I installed. For now, we are going to revert back to the 100 Mbit onboard NIC. Despite the problems, the build system seems to be working. The server seems stable, so I am finishing the automatic game source asset creation. Our build system notifies developers, via email, about updates to the distributed files. This is a good method for keeping developers up to date on the status of distributed files, but it is far too slow. If a developer is using files that are changing, they need to know immediately when those files change. As a result, we created a small utility called SNTask, that sits in the task bar. It shows developers the status of the build system in real-time, so they will know immediately when there have been changes to files.</p>
<p class="MsoNormal">
]]></content:encoded>
			<wfw:commentRss>http://stolennotebook.com/anthony/2006/09/05/sntask-utility/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automated Build System</title>
		<link>http://stolennotebook.com/anthony/2006/08/28/automated-build-system/</link>
		<comments>http://stolennotebook.com/anthony/2006/08/28/automated-build-system/#comments</comments>
		<pubDate>Mon, 28 Aug 2006 10:03:50 +0000</pubDate>
		<dc:creator>tonymagro</dc:creator>
				<category><![CDATA[game]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.stolennotebook.com/anthony/2006/08/28/automated-build-system/</guid>
		<description><![CDATA[One part of our next milestone consists of extending our automated build system. We already use Buildbot to automate most of our builds and testing. Every time source code is checked into the repository it is compiled and all unit tests are run. If the compile or unit tests fail the entire team is notified [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p class="MsoNormal">One part of our next milestone consists of extending our automated build system. We already use <a title="The Buildbot" href="http://buildbot.sourceforge.net/">Buildbot</a> to automate most of our builds and testing. Every time source code is checked into the repository it is compiled and all unit tests are run. If the compile or unit tests fail the entire team is notified via email.</p>
<p class="MsoNormal">Our next milestone requires us to take our automated build system one step further. Source code and game source assets will be automatically built and distributed for all to use when checked into the repository. Any changes to the source code or game assets will result in all developers automatically using the updated version. If bad source code is checked in (it doesn’t compile or fails a unit test) then the build will fail, the team is notified and the broken version is not automatically deployed. There are many other cool extras we get for free when using this system. For example the ability to automatically deploy any version of the repository. If something went horribly wrong with the latest checked in version we can instantly build and deploy any prior version of the repository and all developers will automatically be using that version. Developers can deploy and work on different versions of the repository at the same time. This can also extend to branches and tags. We can have one part of our team working on an unstable branch of the engine while the other part is working on the main trunk of the repository which is stable. Each team works on their own branch and any changes they make are automatically deployed to the others using that same branch. When the unstable branch becomes stable and is merged into the main trunk then the new changes are instantly deployed to the group working with the main trunk.</p>
<p class="MsoNormal">This will also be very useful for game assets. The artist never has to compile or generate game assets from their source assets and then check the generated game assets into the repository. They just check in their source assets which are  then automatically built into game assets and deployed to all developers. To test the new automated build system we decided to make another small game. <a title="Gavin's Blog" href="http://www.stolennotebook.com/gavin/">Gavin</a> and I are going to do most of the modeling so we can become acquainted with Maya. The game is a simple target range where you can shoot at various objects. As a result I felt compelled to name our current milestone &#8220;Hogan’s Alley&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://stolennotebook.com/anthony/2006/08/28/automated-build-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back Online</title>
		<link>http://stolennotebook.com/anthony/2006/08/24/back-online/</link>
		<comments>http://stolennotebook.com/anthony/2006/08/24/back-online/#comments</comments>
		<pubDate>Fri, 25 Aug 2006 01:03:52 +0000</pubDate>
		<dc:creator>tonymagro</dc:creator>
				<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.stolennotebook.com/anthony/2006/08/24/back-online/</guid>
		<description><![CDATA[We finally got internet at our new place today. The release of our Pub Crawl milestone should happen shortly. We also replaced our old 100 Mbit networking hardware with new 1 Gbit switches. I was worried about the cost being too much for the extra speed. I was also worried that we wouldn&#8217;t see a [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p class="MsoNormal">We finally got internet at our new place today. The release of our Pub Crawl milestone should happen shortly. We also replaced our old 100 Mbit networking hardware with new 1 Gbit switches. I was worried about the cost being too much for the extra speed. I was also worried that we wouldn&#8217;t see a big difference in our transfer rates. After hooking up the new switches my worries were quickly put to rest. The new transfer speeds over the network are wonderful and it was worth every penny. If you are deciding whether or not to switch to Gigabit Ethernet I highly recommend you do. If your computers don’t have Gigabit Ethernet cards you can pick them up pretty cheap and the money saved by using 100 Mbit hardware will not justify the slower transfer rates.</p>
]]></content:encoded>
			<wfw:commentRss>http://stolennotebook.com/anthony/2006/08/24/back-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running Buildbot as a Windows XP Service</title>
		<link>http://stolennotebook.com/anthony/2006/07/03/running-buildbot-as-a-windows-xp-service/</link>
		<comments>http://stolennotebook.com/anthony/2006/07/03/running-buildbot-as-a-windows-xp-service/#comments</comments>
		<pubDate>Mon, 03 Jul 2006 22:39:25 +0000</pubDate>
		<dc:creator>tonymagro</dc:creator>
				<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.stolennotebook.com/anthony/?p=6</guid>
		<description><![CDATA[This is an in progress tutorial on how to run buildbot as a Windows XP service. Most of the information comes from these three articles by Grig Gheorghiu: continuous-integration-with-buildbot running-buildbot-on-various-platforms running-python-script-as-windows At Stolen Notebook we use Buildbot for our automated testing. Buildbot is a system that automates project builds and tests. It helps our team [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p class="MsoNormal">This is an in progress tutorial on how to run buildbot as a Windows XP service. Most of the information comes from these three articles by Grig Gheorghiu:</p>
<p class="MsoNormal"><a href="http://agiletesting.blogspot.com/2006/02/continuous-integration-with-buildbot.html">continuous-integration-with-buildbot</a><br />
<a href="http://agiletesting.blogspot.com/2006/03/running-buildbot-on-various-platforms.html">running-buildbot-on-various-platforms</a><br />
<a href="http://agiletesting.blogspot.com/2005/09/running-python-script-as-windows.html">running-python-script-as-windows</a>
</p>
<p class="MsoNormal">
<p class="MsoNormal">At Stolen Notebook we use <a href="http://buildbot.sourceforge.net/">Buildbot</a> for our automated testing. Buildbot is a system that automates project builds and tests. It helps our team quickly identify errors in our code before they become problems. Buildbot runs after every repository check-in and compiles the code with tests. If the build or tests fail our team receives an email indicating who checked in code last and why the build failed. This aids in catching small problems such as forgetting to add a new file to the repository. A missing file is a very simple problem which can hold up other developers in a big way. Buildbot can also immediately catch larger issues such as tests failing due to new code changes. If you are new to buildbot there is a nice article by Grig Gheorghiu on setting up buildbot at <a href="http://agiletesting.blogspot.com/2006/02/continuous-integration-with-buildbot.html">continuous-integration-with-buildbot</a>. If you are setting up buildslaves on multiple platforms he also has a nice article at <a href="http://agiletesting.blogspot.com/2006/03/running-buildbot-on-various-platforms.html">running-buildbot-on-various-platforms</a>.</p>
<p class="MsoNormal">
<p class="MsoNormal">Once you get your buildbot farm going you might want to run your Windows NT/XP/2003 buildslaves as windows services. Our WindowsXP buildslave serves multiple purposes. Different users log in and out of it on a regular basis. Running buildbot from the command line doesn’t work very well in this situation. The easiest solution is to run buildbot as a Windows Service. This allows buildbot to start running when Windows begins. Buildbot then runs in the background despite which users log in or out of the machine.  Some small issues may arise when turning buildbot into a service so it is best to make sure buildbot is working from the command line first.</p>
<p class="MsoNormal">
<p class="MsoNormal">Here is an article about running a python script as a windows service <a href="http://agiletesting.blogspot.com/2005/09/running-python-script-as-windows.html">running-python-script-as-windows</a></p>
<p class="MsoNormal">
<p class="MsoNormal">I created a buildslave user and got my slave working on the command line under that user’s account. I then created a service called BuildSlave and set it to run under the buildslave user. You can do this by going to Control Panel-&gt; Administrative Tools-&gt;Services. Right click on the Buildslave service and select Properites. Go to the “Log On” tab and under “Log on as:” select “This account:” Now type in the buildslave username (I named mine buildslave) and password. The service will now run as the buildslave user. Some environmental variables might not get set. See the Problem Solving section below for a more detailed description.</p>
<p class="MsoNormal">
<p class="MsoNormal">
<p class="MsoNormal">There are different methods for launching the python script. The one mentioned in the article uses a batch file.</p>
<p class="MsoNormal"><em><strong>UPDATE</strong></em>: A comment by jdpipe mentions a better way to launch buildbot by using a python script instead of a windows batch file. Check out his article at <a title="The ASCEND BuildBot" href="http://ascendwiki.cheme.cmu.edu/BuildBot"> http://ascendwiki.cheme.cmu.edu/BuildBot</a>.</p>
<p class="MsoNormal">For buildbot you would make a batch file with the contents:</p>
<p class="MsoNormal">
<p><code>C:\Python24\python C:\buildbot\bin\buildbot start c:\buildslave\game</code></p>
<p class="MsoNormal">
<p class="MsoNormal">Make sure to substitute the correct paths for python, buildbot, and the buildslave directory. I named my batch file startslave.bat.</p>
<p class="MsoNormal">
<p class="MsoNormal">It should be mentioned that if the batch file method is used then stopping the service might not kill the python.exe process. You will have to kill it manually.</p>
<p class="MsoNormal">
<p class="MsoNormal"><strong>Problem Solving:</strong></p>
<p class="MsoNormal"><strong><em>Buildslave stays in ACTIVE state:</em></strong><br />
A problem I had was when a buildslave would do a build and then never return to the IDLE state. On the next build the buildmaster would go through the buildslaves looking for IDLE ones but the buildslave would still be in the ACTIVE state and get skipped.  Since it would never return to the IDLE state it would never do another build. I believe this problem was caused by not calling a superclass’s __init__ function from a subclass in my master.cfg file. If you have a configuration where you are subclassing a buildbot class(Such as subclassing step.ShellCommand to change the name of a build step) make sure you call the superclass’s __init__ function from the subclass’s __init__ function. If you don’t the effects could be small and unnoticeable at first but cause the buildslaves or buildmaster to behave in very strange ways because certain classes were not initialized properly.
</p>
<p class="MsoNormal">
<p class="MsoNormal"><strong><em>Buildslave hangs or doesn’t start a build when running as a service:</em></strong><br />
When buildbot is started as a service the windows environment may be different even if you run the service as the same user you ran buildbot as from the command line. Certain environment variables which are set and valid when you run your slave from the command line might be invalid or not even exists when the slave is run as a service. Two big variables are HOMEPATH and HOMEDRIVE. If your buildbot setup requires some programs which rely on config files in the buildslave user’s home directory they might use those environment variables to find where those files reside. If the variables don’t exist those programs might use default options which cause them to just sit there and do nothing. When buildbot receives a command it dumps the environment just before running the command. A good idea is you run the buildslave from the command line and take a look at the environment. Then run the buildslave as a service and compare the two environments. You can find all logged messages in the twistd.log file which resides in your buildslave&#8217;s configuration directory. After comparing environments I found the service environment was missing both the HOMEPATH and HOMEDRIVE variables. My ssh setup required config files in those directories and was unable to find them. I then set those variables in my startslave.bat(which is launched by the BuildSlave service) prior to launching buildbot. It now looks like this:</p>
<p class="MsoNormal"><pre><code>set HOMEDRIVE = &quot;C:&quot;
set HOMEPATH = &quot;\Documents and Settings\buildslave&quot;
C:\Python24\python C:\buildbot\bin\buildbot start c:\buildslave\game</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://stolennotebook.com/anthony/2006/07/03/running-buildbot-as-a-windows-xp-service/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
