From 4a37365dc220a84e952c8214cf3b9acfcafe746a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jelmer=20Vernoo=C4=B3?= Date: Thu, 12 Jun 2014 23:52:42 +0200 Subject: [PATCH] Add --debug-storm option. --- buildfarm/web/__init__.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py index 8f15f54b..438d4121 100755 --- a/buildfarm/web/__init__.py +++ b/buildfarm/web/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/python # This CGI script presents the results of the build_farm build -# Copyright (C) Jelmer Vernooij 2010 +# Copyright (C) Jelmer Vernooij 2010-2014 # Copyright (C) Matthieu Patou 2010-2012 # # Based on the original web/build.pl: @@ -33,6 +33,7 @@ from collections import defaultdict import os +import sys from buildfarm import ( hostdb, @@ -125,7 +126,8 @@ def build_uri(myself, build): def build_link(myself, build): - return "%s" % (build_uri(myself, build), html_build_status(build.status())) + return "%s" % ( + build_uri(myself, build), html_build_status(build.status())) def tree_uri(myself, tree): @@ -134,7 +136,8 @@ def tree_uri(myself, tree): def tree_link(myself, tree): """return a link to a particular tree""" - return "%s:%s" % (tree_uri(myself, tree), tree.name, tree.name, tree.branch) + return "%s:%s" % ( + tree_uri(myself, tree), tree.name, tree.name, tree.branch) def host_uri(myself, host): @@ -1119,6 +1122,8 @@ class BuildFarmApp(object): if __name__ == '__main__': import optparse parser = optparse.OptionParser("[options]") + parser.add_option("--debug-storm", help="Enable storm debugging", + default=False, action='store_true') parser.add_option("--port", help="Port to listen on [localhost:8000]", default="localhost:8000", type=str) opts, args = parser.parse_args() @@ -1146,6 +1151,9 @@ if __name__ == '__main__': except ValueError: address = "localhost" port = opts.port + if opts.debug_storm: + from storm.tracer import debug + debug(True, stream=sys.stdout) httpd = make_server(address, int(port), standaloneApp) print "Serving on %s:%d..." % (address, int(port)) httpd.serve_forever() -- 2.34.1