Announce: gerrymander 1.3 “Any history of sanity in the family?” – a client API and command line tool for gerrit

Posted: July 30th, 2014 | Filed under: Coding Tips, Fedora, OpenStack, Virt Tools | Tags: , , , , | No Comments »

I’m pleased to announce the availability of a new release of gerrymander, version 1.3. Gerrymander provides a python command line tool and APIs for querying information from the gerrit review system, as used in OpenStack and many other projects. You can get it from pypi

# pip install gerrymander

Or straight from GitHub

# git clone git://github.com/berrange/gerrymander.git

If you’re the impatient type, then go to the README file which provides a quick start guide to using the tool.

This release contains a mixture of bug fixes and two new features. When displaying a list of changes, one of the fields that can be shown per-change is the approvals. This is rendered as a list of all the -2/-1/+1/+2 votes made against the current patch set. The text is also coloured to make it easier to tell at a glance what the overall state of the change is. There are two problems with this, first when there were a lot of votes on a change the list gets rather too wide. The bigger problem though has been the high level of false failures in the OpenStack CI testing system. This results in many patches receiving -1’s from testing, which caused gerrymander to colour them in red:

+-------------------------------------+-------------------------------------------------------+----------+-----------------------+
| URL                                 | Subject                                               | Created  | Approvals             |
+-------------------------------------+-------------------------------------------------------+----------+-----------------------+
| https://review.openstack.org/68942  | Power off commands should give guests a chance to ... | 186 days | w= v=1,1,1,1 c=-2,-1  |
| https://review.openstack.org/77027  | Support image property for config drive               | 152 days | w= v=1,-1,-1,-1 c=-1  |
| https://review.openstack.org/82409  | Fixes a Hyper-V list_instances localization issue     | 128 days | w= v=1,-1 c=-1        |
| https://review.openstack.org/88067  | Allow deleting instances while uuid lock is held      | 104 days | w= v=1,1,1,1 c=2      |
| https://review.openstack.org/108013 | Fixes Hyper-V agent force_hyperv_utils_v1 flag iss... | 12 days  | w= v=1,1,1,-1 c=1,1,1 |

My workflow is to focus on things which do not have negative feedback and so I found this was discouraging me from reviewing stuff that was only marked negative due to bogus CI failures. So in this new release, the display is now using separate columns to report test votes, code review votes and workflow votes, each column being separately coloured. Also, instead of showing each individual vote, we only show the so called “casting vote” – ie the one that’s most important, (order is -2, +2, -1, +1)

+-------------------------------------+-------------------------------------------------------+----------+-------+---------+----------+
| URL                                 | Subject                                               | Created  | Tests | Reviews | Workflow |
+-------------------------------------+-------------------------------------------------------+----------+-------+---------+----------+
| https://review.openstack.org/68942  | Power off commands should give guests a chance to ... | 186 days | 1     | -2      |          |
| https://review.openstack.org/77027  | Support image property for config drive               | 152 days | -1    | -1      |          |
| https://review.openstack.org/82409  | Fixes a Hyper-V list_instances localization issue     | 128 days | -1    | -1      |          |
| https://review.openstack.org/88067  | Allow deleting instances while uuid lock is held      | 104 days | 1     | 2       |          |
| https://review.openstack.org/108013 | Fixes Hyper-V agent force_hyperv_utils_v1 flag iss... | 12 days  | -1    | 1       |          |

The second new feature is the ‘patchreviewrates’ command which is reports on the review comment activity of people over time. We already have ‘patchreviewstats’ command which gives information about review activity over a fixed window, but this doesn’t let us see long term trends. With the new command we’re reporting on the daily number of review comments per person, averaging over a week, and reported for the last 52 weeks. This lets us see how review activity from contributors goes up and down over the course of a year (or 2 dev cycles). I used this to produced a report which I then imported to LibreOffice to create a graph showing the nova-core team activity over the past two cycles (click image to enlarge)

Nova core team review rates

Nova core team review rates

In summary the changes in version 1.2 of gerrymander are

  • Exclude own changes in the todo lists
  • Add CSV as an output format for some reports
  • Add patchreviewrate report for seeing historica approvals per day
  • Replace ‘Approvals’ column with ‘Test’, ‘Review’ and ‘Workflow’ columns in change reports
  • Allow todo lists to be filtered per branch
  • Reorder sorting of votes to prioritize +2/-2s over +1/-1s
  • Avoid exception from unexpected approval vote types
  • Avoid creating empty cache file when Ctrl-C’ing ssh client
  • Run ssh in batch mode to avoid hang when host key is unknown

Thanks to everyone who contributed patches that went into this new release