Blob Blame History Raw
From 1a3bc938bbbba20846860630a544d989fd18b0a9 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Sat, 10 Sep 2016 21:21:04 -0700
Subject: [PATCH] Revert "Disable auto-duplication of jobs (poo#13042)"

This reverts commit 21307cdec3974c334ec5aac30f9508b19d5b6fb2.
I like auto-duplication of jobs. It prevents me suffering ulcers
when random weird crap like 'asset upload failed for no real
reason' or 'worker couldn't connect to VNC for no real reason'
happens.
---
 lib/OpenQA/Worker/Jobs.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/OpenQA/Worker/Jobs.pm b/lib/OpenQA/Worker/Jobs.pm
index 089691d..7cde4d9 100644
--- a/lib/OpenQA/Worker/Jobs.pm
+++ b/lib/OpenQA/Worker/Jobs.pm
@@ -323,7 +323,13 @@ sub _stop_job($;$) {
     }
     unless ($job_done || $aborted eq 'api-failure') {
         upload_status(1);
-        printf "job %d incomplete\n", $job->{id};
+        # set job to done. if priority is less than threshold duplicate it
+        # with worse priority so it can be picked up again.
+        my %args;
+        $args{dup_type_auto} = 1;
+        printf "duplicating job %d\n", $job->{id};
+        # make it less attractive so we don't get it again
+        api_call('post', 'jobs/' . $job->{id} . '/duplicate', \%args);
         api_call('post', 'jobs/' . $job->{id} . '/set_done', {result => 'incomplete'});
     }
     warn sprintf("cleaning up %s...\n", $job->{settings}->{NAME});
-- 
2.9.3