Merge ~vorlon/britney/+git/britney2-ubuntu:no-die-on-rabbitmq-failure into ~ubuntu-release/britney/+git/britney2-ubuntu:master

Proposed by Steve Langasek
Status: Merged
Merged at revision: 9e28fceafab53fa6a3f9994295a28fe490c3bfe7
Proposed branch: ~vorlon/britney/+git/britney2-ubuntu:no-die-on-rabbitmq-failure
Merge into: ~ubuntu-release/britney/+git/britney2-ubuntu:master
Diff against target: 59 lines (+16/-9)
1 file modified
britney2/policies/autopkgtest.py (+16/-9)
Reviewer Review Type Date Requested Status
Brian Murray Approve
Review via email: mp+463777@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Steve Langasek (vorlon) wrote :

hit this again today while queuing a million perl tests...

Revision history for this message
Brian Murray (brian-murray) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/britney2/policies/autopkgtest.py b/britney2/policies/autopkgtest.py
2index 264a34c..1dd3be4 100644
3--- a/britney2/policies/autopkgtest.py
4+++ b/britney2/policies/autopkgtest.py
5@@ -1123,9 +1123,11 @@ class AutopkgtestPolicy(BasePolicy):
6
7 If huge is true, then the request will be put into the -huge instead of
8 normal queue.
9+
10+ Return True if successfully queued, False if not.
11 '''
12 if self.options.dry_run or self.dry_run:
13- return
14+ return True
15
16 params = {'triggers': triggers}
17 if self.options.adt_ppas:
18@@ -1140,9 +1142,12 @@ class AutopkgtestPolicy(BasePolicy):
19 if self.amqp_channel:
20 import amqplib.client_0_8 as amqp
21 params = json.dumps(params)
22- self.amqp_channel.basic_publish(amqp.Message(src + '\n' + params,
23- delivery_mode=2), # persistent
24- routing_key=qname)
25+ try:
26+ self.amqp_channel.basic_publish(amqp.Message(src + '\n' + params,
27+ delivery_mode=2), # persistent
28+ routing_key=qname)
29+ except ConnectionResetError:
30+ return False
31 else:
32 # for file-based submission, triggers are space separated
33 params['triggers'] = [' '.join(params['triggers'])]
34@@ -1150,6 +1155,7 @@ class AutopkgtestPolicy(BasePolicy):
35 assert self.amqp_file
36 with open(self.amqp_file, 'a') as f:
37 f.write('%s:%s %s\n' % (qname, src, params))
38+ return True
39
40 def pkg_test_request(self, src, arch, full_triggers, huge=False):
41 '''Request one package test for one particular trigger
42@@ -1219,11 +1225,12 @@ class AutopkgtestPolicy(BasePolicy):
43 self.logger.info('Test %s/%s for %s is already pending, not queueing', src, arch, trigger)
44 else:
45 self.logger.info('Requesting %s autopkgtest on %s to verify %s', src, arch, trigger)
46- arch_list.append(arch)
47- arch_list.sort()
48- self.send_test_request(src, arch, full_triggers, huge=huge)
49- # save pending.json right away, so that we don't re-request if britney crashes
50- self.save_pending_json()
51+ if self.send_test_request(src, arch, full_triggers, huge=huge):
52+ # save pending.json right away, so that we don't re-request
53+ # if britney crashes
54+ arch_list.append(arch)
55+ arch_list.sort()
56+ self.save_pending_json()
57
58 def result_in_baseline(self, src, arch):
59 '''Get the result for src on arch in the baseline

Subscribers

People subscribed via source and target branches