Merge branch 'no-die-on-rabbitmq-failure'

less-recipients
Steve Langasek 9 months ago
commit 9e28fceafa

@ -1123,9 +1123,11 @@ class AutopkgtestPolicy(BasePolicy):
If huge is true, then the request will be put into the -huge instead of If huge is true, then the request will be put into the -huge instead of
normal queue. normal queue.
Return True if successfully queued, False if not.
''' '''
if self.options.dry_run or self.dry_run: if self.options.dry_run or self.dry_run:
return return True
params = {'triggers': triggers} params = {'triggers': triggers}
if self.options.adt_ppas: if self.options.adt_ppas:
@ -1140,9 +1142,12 @@ class AutopkgtestPolicy(BasePolicy):
if self.amqp_channel: if self.amqp_channel:
import amqplib.client_0_8 as amqp import amqplib.client_0_8 as amqp
params = json.dumps(params) params = json.dumps(params)
try:
self.amqp_channel.basic_publish(amqp.Message(src + '\n' + params, self.amqp_channel.basic_publish(amqp.Message(src + '\n' + params,
delivery_mode=2), # persistent delivery_mode=2), # persistent
routing_key=qname) routing_key=qname)
except ConnectionResetError:
return False
else: else:
# for file-based submission, triggers are space separated # for file-based submission, triggers are space separated
params['triggers'] = [' '.join(params['triggers'])] params['triggers'] = [' '.join(params['triggers'])]
@ -1150,6 +1155,7 @@ class AutopkgtestPolicy(BasePolicy):
assert self.amqp_file assert self.amqp_file
with open(self.amqp_file, 'a') as f: with open(self.amqp_file, 'a') as f:
f.write('%s:%s %s\n' % (qname, src, params)) f.write('%s:%s %s\n' % (qname, src, params))
return True
def pkg_test_request(self, src, arch, full_triggers, huge=False): def pkg_test_request(self, src, arch, full_triggers, huge=False):
'''Request one package test for one particular trigger '''Request one package test for one particular trigger
@ -1219,10 +1225,11 @@ class AutopkgtestPolicy(BasePolicy):
self.logger.info('Test %s/%s for %s is already pending, not queueing', src, arch, trigger) self.logger.info('Test %s/%s for %s is already pending, not queueing', src, arch, trigger)
else: else:
self.logger.info('Requesting %s autopkgtest on %s to verify %s', src, arch, trigger) self.logger.info('Requesting %s autopkgtest on %s to verify %s', src, arch, trigger)
if self.send_test_request(src, arch, full_triggers, huge=huge):
# save pending.json right away, so that we don't re-request
# if britney crashes
arch_list.append(arch) arch_list.append(arch)
arch_list.sort() arch_list.sort()
self.send_test_request(src, arch, full_triggers, huge=huge)
# save pending.json right away, so that we don't re-request if britney crashes
self.save_pending_json() self.save_pending_json()
def result_in_baseline(self, src, arch): def result_in_baseline(self, src, arch):

Loading…
Cancel
Save