|
|
8c0e7a9 |
From 4814d5f44861960233faca91c3e2a612346511e8 Mon Sep 17 00:00:00 2001
|
|
|
289d14a |
From: Adam Williamson <awilliam@redhat.com>
|
|
|
8c0e7a9 |
Date: Tue, 28 Feb 2017 16:33:40 -0800
|
|
|
289d14a |
Subject: [PATCH] Duplicate jobs on 'died' as well as 'quit'
|
|
|
289d14a |
|
|
|
289d14a |
This is effectively similar to the previous reversion of commit
|
|
|
289d14a |
21307cdec3974c334ec5aac30f9508b19d5b6fb2 , but with the revised
|
|
|
289d14a |
stop_job code that makes straight reversion impossible. It ought
|
|
|
289d14a |
to duplicate jobs that die as well as those that quit on a
|
|
|
8c0e7a9 |
signal. Note that with this change to the condition that triggers
|
|
|
8c0e7a9 |
the block, we must adjust the `_stop_job_finish` callback inside
|
|
|
8c0e7a9 |
the duplication block to *not* make the worker process quit if
|
|
|
8c0e7a9 |
`$aborted` was 'died', only if it was 'quit' (the hardcoded '1'
|
|
|
8c0e7a9 |
value is safe for upstream, but it's not safe for us with this
|
|
|
8c0e7a9 |
change).
|
|
|
289d14a |
---
|
|
|
8c0e7a9 |
lib/OpenQA/Worker/Jobs.pm | 4 ++--
|
|
|
8c0e7a9 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
289d14a |
|
|
|
289d14a |
diff --git a/lib/OpenQA/Worker/Jobs.pm b/lib/OpenQA/Worker/Jobs.pm
|
|
|
8c0e7a9 |
index 57569f1c..c102ef29 100644
|
|
|
289d14a |
--- a/lib/OpenQA/Worker/Jobs.pm
|
|
|
289d14a |
+++ b/lib/OpenQA/Worker/Jobs.pm
|
|
|
7292513 |
@@ -474,14 +474,14 @@ sub _stop_job_2 {
|
|
|
289d14a |
}
|
|
|
7292513 |
if (!$job_done && $aborted ne 'api-failure') {
|
|
|
55c630b |
log_debug(sprintf 'job %d incomplete', $job->{id});
|
|
|
289d14a |
- if ($aborted eq 'quit') {
|
|
|
289d14a |
+ if ($aborted eq 'quit' || $aborted eq 'died') {
|
|
|
289d14a |
log_debug(sprintf "duplicating job %d\n", $job->{id});
|
|
|
289d14a |
api_call(
|
|
|
289d14a |
'post',
|
|
|
8c0e7a9 |
'jobs/' . $job->{id} . '/duplicate',
|
|
|
8c0e7a9 |
params => {dup_type_auto => 1},
|
|
|
8c0e7a9 |
callback => sub {
|
|
|
8c0e7a9 |
- upload_status(1, sub { _stop_job_finish({result => 'incomplete'}, 1) });
|
|
|
8c0e7a9 |
+ upload_status(1, sub { _stop_job_finish({result => 'incomplete'}, $aborted eq 'quit') });
|
|
|
8c0e7a9 |
});
|
|
|
8c0e7a9 |
}
|
|
|
8c0e7a9 |
else {
|
|
|
289d14a |
--
|
|
|
8c0e7a9 |
2.12.0
|
|
|
289d14a |
|