autopkgtest: Save pending.json after every test request

We just had the autopkgtest queues DoSed because britney was crashing
after requesting each reverse dependency for a perl upload, but before
it had written pending.json out so it knew what not to request again.
This was 25,000 requests per arch...

Let's write pending.json straight after sending each request, so that
the next run - even after a crash - won't re-request the same things
again.
wip/linux-policy
Iain Lane 7 years ago
parent c201c000ee
commit e7bc681e9a

@ -339,6 +339,13 @@ class AutopkgtestPolicy(BasePolicy):
return valid_version
def save_pending_json(self):
# update the pending tests on-disk cache
self.logger.info('Updating pending requested tests in %s' % self.pending_tests_file)
with open(self.pending_tests_file + '.new', 'w') as f:
json.dump(self.pending_tests, f, indent=2)
os.rename(self.pending_tests_file + '.new', self.pending_tests_file)
def save_state(self, britney):
super().save_state(britney)
@ -352,11 +359,7 @@ class AutopkgtestPolicy(BasePolicy):
json.dump(test_results, f, indent=2)
os.rename(self.results_cache_file + '.new', self.results_cache_file)
# update the pending tests on-disk cache
self.logger.info('Updating pending requested tests in %s', self.pending_tests_file)
with open(self.pending_tests_file + '.new', 'w') as f:
json.dump(self.pending_tests, f, indent=2)
os.rename(self.pending_tests_file + '.new', self.pending_tests_file)
self.save_pending_json()
def apply_src_policy_impl(self, tests_info, item, source_data_tdist, source_data_srcdist, excuse):
# initialize
@ -1043,6 +1046,8 @@ class AutopkgtestPolicy(BasePolicy):
arch_list.append(arch)
arch_list.sort()
self.send_test_request(src, arch, full_trigger, huge=huge)
# save pending.json right away, so that we don't re-request if britney crashes
self.save_pending_json()
def result_in_baseline(self, src, arch):
'''Get the result for src on arch in the baseline

Loading…
Cancel
Save