|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 23/33] cs-adjust-flight: Break out job removal machinery
Make @job_rm_qs a global variable (initialised idempotently by a new
function prep_rm_jobs) and $rm_job into a named global subroutine
do_rm_job.
No functional change.
Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
v2: New patch
---
cs-adjust-flight | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/cs-adjust-flight b/cs-adjust-flight
index 136ba5b..4056765 100755
--- a/cs-adjust-flight
+++ b/cs-adjust-flight
@@ -133,11 +133,25 @@ sub for_jobs ($$$;$) {
'flight = ?', [$flight]);
}
+our @job_rm_qs;
+
+sub prep_rm_jobs () {
+ return if @job_rm_qs;
+ @job_rm_qs = map { $dbh_tests->prepare($_) }
+ ("DELETE FROM runvars WHERE flight = ? AND job = ?",
+ "DELETE FROM jobs WHERE flight = ? AND job = ?");
+}
+
+sub do_rm_job ($) {
+ my ($job) = @_;
+ my $count = 0;
+ $count += $_->execute($dstflight, $job) foreach @job_rm_qs;
+ verbose "$dstflight.$job job deleted\n" if $count;
+}
+
sub copy_jobs ($$) {
my ($srcflight, $jobs) = @_;
- my @job_rm_qs = map { $dbh_tests->prepare($_) }
- ("DELETE FROM runvars WHERE flight = ? AND job = ?",
- "DELETE FROM jobs WHERE flight = ? AND job = ?");
+ prep_rm_jobs();
my @job_copy_qs = map { $dbh_tests->prepare($_) }
("INSERT INTO jobs".
" SELECT ?, job, recipe, 'queued'".
@@ -147,14 +161,8 @@ sub copy_jobs ($$) {
" SELECT ?, job, name, val, 'f'".
" FROM runvars".
" WHERE flight = ? AND job = ? AND NOT synth");
- my $rm_job = sub {
- my ($job) = @_;
- my $count = 0;
- $count += $_->execute($dstflight, $job) foreach @job_rm_qs;
- verbose "$dstflight.$job job deleted\n" if $count;
- };
- for_jobs($dstflight, $jobs, $rm_job, 1);
- for_jobs($srcflight, $jobs, $rm_job);
+ for_jobs($dstflight, $jobs, \&do_rm_job, 1);
+ for_jobs($srcflight, $jobs, \&do_rm_job);
for_jobs($srcflight, $jobs, sub {
my ($job) = @_;
$_->execute($dstflight, $srcflight, $job) foreach @job_copy_qs;
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |