hydra-update-gc-roots: Keep the most recent evaluations
We now keep all builds in the N most recent evaluations of a jobset, rather than the N most recent builds of every job. Note that this means that typically fewer builds will be kept (since jobs may be unchanged across evaluations).
This commit is contained in:
parent
8e1ade4422
commit
d16738e130
|
@ -110,7 +110,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">Number of builds to keep</label>
|
<label class="control-label">Number of evaluations to keep</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="number" class="span3" name="keepnr" [% HTML.attributes(value => jobset.keepnr) %]></input>
|
<input type="number" class="span3" name="keepnr" [% HTML.attributes(value => jobset.keepnr) %]></input>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
<td>[% HTML.escape(jobset.emailoverride) %]</td>
|
<td>[% HTML.escape(jobset.emailoverride) %]</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Number of builds to keep:</th>
|
<th>Number of evaluations to keep:</th>
|
||||||
<td>[% jobset.keepnr %]</td>
|
<td>[% jobset.keepnr %]</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -89,20 +89,16 @@ foreach my $project ($db->resultset('Projects')->search({}, { order_by => ["name
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# FIXME: base this on jobset evals?
|
print STDERR "*** looking for all builds in the $keepnr most recent evaluations of jobset ",
|
||||||
print STDERR "*** looking for the $keepnr most recent successful builds of each job in jobset ",
|
|
||||||
$project->name, ":", $jobset->name, "\n";
|
$project->name, ":", $jobset->name, "\n";
|
||||||
|
|
||||||
keepBuild $_ foreach $jobset->builds->search(
|
keepBuild $_ foreach $jobset->builds->search(
|
||||||
{ 'me.id' => { 'in' => \
|
{ finished => 1, buildStatus => 0
|
||||||
[ "select b2.id from Builds b2 join " .
|
, id => { -in =>
|
||||||
" (select distinct job, system, coalesce( " .
|
\ [ "select build from JobsetEvalMembers where eval in (select id from JobsetEvals where project = ? and jobset = ? and hasNewBuilds = 1 order by id desc limit ?)",
|
||||||
" (select id from builds where project = b.project and jobset = b.jobset and job = b.job and system = b.system and finished = 1 and buildStatus = 0 order by id desc offset ? limit 1)" .
|
[ '', $project->name ], [ '', $jobset->name ], [ '', $keepnr ] ] }
|
||||||
" , 0) as nth from builds b where project = ? and jobset = ? and isCurrent = 1) x " .
|
|
||||||
" on b2.project = ? and b2.jobset = ? and b2.job = x.job and b2.system = x.system and (id >= x.nth) where finished = 1 and buildStatus = 0"
|
|
||||||
, [ '', $keepnr - 1 ], [ '', $project->name ], [ '', $jobset->name ], [ '', $project->name ], [ '', $jobset->name ] ] }
|
|
||||||
},
|
},
|
||||||
{ order_by => ["job", "system", "id"], columns => [ @columns ] });
|
{ order_by => ["job", "id"], columns => [ @columns ] });
|
||||||
}
|
}
|
||||||
|
|
||||||
# Go over all views in this project.
|
# Go over all views in this project.
|
||||||
|
@ -115,7 +111,7 @@ foreach my $project ($db->resultset('Projects')->search({}, { order_by => ["name
|
||||||
# Keep all builds belonging to the most recent successful view result.
|
# Keep all builds belonging to the most recent successful view result.
|
||||||
my $latest = getLatestSuccessfulViewResult($project, $primaryJob, $jobs, 0);
|
my $latest = getLatestSuccessfulViewResult($project, $primaryJob, $jobs, 0);
|
||||||
if (defined $latest) {
|
if (defined $latest) {
|
||||||
print STDERR " keeping latest successful view result ", $latest->id, " (", $latest->get_column('releasename'), ")\n";
|
print STDERR " keeping latest successful view result ", $latest->id, " (", $latest->get_column('releasename') // "unnamed", ")\n";
|
||||||
my $result = getViewResult($latest, $jobs);
|
my $result = getViewResult($latest, $jobs);
|
||||||
keepBuild $_->{build} foreach @{$result->{jobs}};
|
keepBuild $_->{build} foreach @{$result->{jobs}};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue