make launchpad integration optional
launchpad integration is nice, but it's incredibly slow. So there are times where it would be nice if it was optional. You can specify it on the command line with the -l flag. Change-Id: I7d5d57750c82efbc0936186625ceacecaf350085
This commit is contained in:
@@ -30,6 +30,9 @@ def get_options():
|
|||||||
description='Query for existing recheck bugs.')
|
description='Query for existing recheck bugs.')
|
||||||
parser.add_argument('--dir', '-d', help="Queries Directory",
|
parser.add_argument('--dir', '-d', help="Queries Directory",
|
||||||
default="queries")
|
default="queries")
|
||||||
|
parser.add_argument('--lp', '-l', help="Query Launchpad",
|
||||||
|
type=bool,
|
||||||
|
default=False)
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
@@ -53,7 +56,7 @@ def collect_metrics(classifier):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def print_metrics(data):
|
def print_metrics(data, with_lp=False):
|
||||||
print "Elastic recheck known issues"
|
print "Elastic recheck known issues"
|
||||||
print
|
print
|
||||||
|
|
||||||
@@ -62,6 +65,7 @@ def print_metrics(data):
|
|||||||
for d in sorted_data:
|
for d in sorted_data:
|
||||||
print("Bug: https://bugs.launchpad.net/bugs/%s => %s"
|
print("Bug: https://bugs.launchpad.net/bugs/%s => %s"
|
||||||
% (d[0], d[1]['query'].rstrip()))
|
% (d[0], d[1]['query'].rstrip()))
|
||||||
|
if with_lp:
|
||||||
get_launchpad_bug(d[0])
|
get_launchpad_bug(d[0])
|
||||||
print "Hits"
|
print "Hits"
|
||||||
for s in d[1]['hits'].keys():
|
for s in d[1]['hits'].keys():
|
||||||
@@ -85,7 +89,7 @@ def main():
|
|||||||
opts = get_options()
|
opts = get_options()
|
||||||
classifier = er.Classifier(opts.dir)
|
classifier = er.Classifier(opts.dir)
|
||||||
data = collect_metrics(classifier)
|
data = collect_metrics(classifier)
|
||||||
print_metrics(data)
|
print_metrics(data, with_lp=opts.lp)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user