Skip to content

Commit

Permalink
Merge pull request #5797 from AdamWill/no-retry-on-post
Browse files Browse the repository at this point in the history
Do not retry jobs that were obsoleted
  • Loading branch information
mergify[bot] authored Jul 30, 2024
2 parents d9d83ae + efe1cde commit 8d1e8da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/OpenQA/Schema/Result/Jobs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,8 @@ sub is_ok ($self) {
sub is_ok_to_retry ($self) {
return 1 unless my $result = $self->result;
return 0 if grep { $_ eq $result } OK_RESULTS; # retry is not needed if job is ok
return 0 if $result eq USER_CANCELLED; # retry is not needed if job is user-cancelled
return 0 if $result eq USER_CANCELLED; # retry is not needed if job is user-cancelled...
return 0 if $result eq OBSOLETED; # ...or obsoleted
return 1;
}

Expand Down
4 changes: 4 additions & 0 deletions t/10-jobs.t
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,10 @@ subtest 'job setting based retriggering' => sub {
$job->done(result => USER_CANCELLED);
perform_minion_jobs($minion);
is $jobs->count, $jobs_nr + 1, 'no additional job retriggered if USER_CANCELLED (with retry)';
$job->update({state => SCHEDULED, result => NONE});
$job->done(result => OBSOLETED);
perform_minion_jobs($minion);
is $jobs->count, $jobs_nr + 1, 'no additional job retriggered if OBSOLETED (with retry)';
my $get_jobs = sub ($task) {
$minion->backend->pg->db->query(q{select * from minion_jobs where task = $1 order by id asc}, $task)->hashes;
# note: Querying DB directly as `$minion->jobs({tasks => [$task]})` does not return parents.
Expand Down

0 comments on commit 8d1e8da

Please sign in to comment.