UCOSP Blog Post – November 6th

Hi everyone! My name is Wesley Ellis and I’m a 4th year Computer Science/International Development student at McGill university and I’ve had a lot of fun working on Reviewboard so far. This past summer I did a lot of web development in Ruby using the Rails framework and it has been very interesting to see how python and Django stack up. I do miss Ruby’s collection.each{|a| do_something(a)} but I’m looking forward to abusing using list comprehensions.

My project this semester has been to create tools for ReviewBot, an extension to Reviewboard that’s actively under development. The first tool, which I’m still working on, is to integrate BuildBot’s ability to “try” and build the code contained in review once it has been posted, and then add the status of the build to the review request. Buildbot was an obvious first choice for the Reviewboard project because that’s what we use! If you’re interested you can see the status of our test suite run against a multitude of different Django versions and operating systems at build.reviewboard.org .

ReviewBot in generall has me quite excited. I think there are many tools that would be useful to run on code that has been submitted for review. Test suites are the most obvious thing to run, especially if the test suite runs long or involves different architectures. It would be impractical to expect a contributor to be able to manage three or four installs of Django just for testing purposes. In addition, I think this is a better solution than TravisCI because it doesn’t depend on the use of git for your version control.

Automagically running code style tools like pep8 (which is already part of buildbot) and JSLint (which a fellow student is working on) can also be useful. I know that a good portion of the feedback that the mentors leave on a UCOSP student’s first review is style related. By automating this process, reviewers can focus on more important aspects of the code, like structure. You could also create a tool to run a spell checker through code comments or announce newly  posted/changed reviews to IRC, Campfire or Twitter.

Personally, I’ve found that ReviewBot has some really fascinating architecture that I’d like to try an explain here. First of all, when I say ReviewBot I’m actually referring to 2 different things. There’s the ReviewBot extension which is installed on a Reviewboard server and there’s the ReviewBot bot or worker which can be installed on any machine as long as it can contact the Reviewboard server. At first I was perplexed about this design choice, but it makes sense once explained. Some of the tasks I’ve mentioned above could be quite long running or require a special configuration, so it would be a bad design choice to require ReviewBot tools to be executed on the same server as ReviewBoard. It’s also quite possible that some people have to a tool run on Windows, but their Reviewboard server is a linux machine. No problem with this setup, but much more challenging if tools were tied more closely to the extension. ReviewBot deals with this seperation by using Celery, a distributed message processing system. In plain English, that means that workers listen for messages on a queue that the extension submits requests to in order to run certain tools on certain reviews. Sadly, the docs on Celery are a bit… lacking so I spent quite some time attempting to get what should have been (and even turned out to be!) a simple attribute, but it’s a fascinating application to learn about. While slightly more complex than one might expect at first, the benefit of isolating workers is that they can be setup to run in different environments and scaling is as easy as adding more workers.

Welp, that’s all for now folks. I hope you learned something and now want to write some awesome tools for ReviewBot!

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s