Skip to content

Commit

Permalink
Merge pull request #14040 from mlschroe/master
Browse files Browse the repository at this point in the history
[backend] kiwi product: check right away if a gbininfo fetch is in pr…
  • Loading branch information
mlschroe committed Mar 20, 2023
2 parents e6b7809 + 8de2286 commit ee16b52
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 19 deletions.
17 changes: 5 additions & 12 deletions src/backend/BSSched/BuildJob/Aggregate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,7 @@ sub check {
for my $aggregate (@$aggregates) {
my $aprojid = $aggregate->{'project'};
my $proj = $remoteprojs->{$aprojid} || $projpacks->{$aprojid};
if (!$proj) {
push @broken, $aprojid;
next;
}
if ($proj->{'error'}) {
if (BSSched::RPC::is_transient_error($proj->{'error'})) {
# XXX: hmm, there's already a project retryevent on $aprojid
$gctx->{'retryevents'}->addretryevent({'type' => 'package', 'project' => $projid, 'package' => $packid});
$delayed = 1;
}
if (!$proj || $proj->{'error'}) {
push @broken, $aprojid;
next;
}
Expand Down Expand Up @@ -252,9 +243,11 @@ sub check {
if (@broken) {
my $error = 'missing repositories: '.join(', ', @broken);
print " - $packid (aggregate)\n";
if ($delayed) {
print " delayed ($error)\n";
return ('delayed', $error);
}
print " broken ($error)\n";
print " (delayed)\n" if $delayed;
return ('delayed', $error) if $delayed;
return ('broken', $error);
}
if (@blocked) {
Expand Down
41 changes: 34 additions & 7 deletions src/backend/BSSched/BuildJob/KiwiProduct.pm
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,27 @@ sub check {
}
}

# check right away if some gbininfo fetch is in progress
my $delayed_errors = '';
if (!$ctx->{'isreposerver'}) {
for my $aprp (@aprps) {
my ($aprojid, $arepoid) = split('/', $aprp, 2);
next unless $remoteprojs->{$aprojid};
for my $arch (reverse @archs) {
next if $myarch ne $buildarch && $myarch ne $arch;
$delayed_errors .= ", project binary state of $aprp/$arch is unavailable" if $ctx->gbininfo_is_delayed($aprp, $arch);
}
}
if ($delayed_errors) {
substr($delayed_errors, 0, 2, '');
if ($ctx->{'verbose'}) {
print " - $packid (kiwi-product)\n";
print " $delayed_errors (delayed)\n";
}
return ('delayed', $delayed_errors);
}
}

my $allpacks = $deps{'*'} ? 1 : 0;
my $nodbgpkgs = $info->{'nodbgpkgs'};
my $nosrcpkgs = $info->{'nosrcpkgs'};
Expand All @@ -277,7 +298,6 @@ sub check {

my $maxblocked = 20;
my %blockedarch;
my $delayed_errors = '';
my $projpacks = $gctx->{'projpacks'};
my %unneeded_na;
my %archs = map {$_ => 1} @archs;
Expand All @@ -298,15 +318,14 @@ sub check {
my $gbininfo = $ctx->read_gbininfo($aprp, $arch, $ps);
if (!$gbininfo && $remoteprojs->{$aprojid}) {
my $error = "project binary state of $aprp/$arch is unavailable";
$error .= " (delayed)" if defined $gbininfo;
if ($ctx->{'verbose'}) {
print " - $packid (kiwi-product)\n";
print " $error\n";
}
if (defined $gbininfo) {
$delayed_errors .= ", $error";
next;
}
if ($ctx->{'verbose'}) {
print " - $packid (kiwi-product)\n";
print " $error\n";
}
return ('broken', $error);
}
next if $delayed_errors;
Expand Down Expand Up @@ -479,7 +498,15 @@ sub check {
last if @blocked > $maxblocked;
}

return ('delayed', substr($delayed_errors, 2)) if $delayed_errors;
if ($delayed_errors) {
substr($delayed_errors, 0, 2, '');
if ($ctx->{'verbose'}) {
print " - $packid (kiwi-product)\n";
print " $delayed_errors (delayed)\n";
}
return ('delayed', $delayed_errors);
}

if ($markerdir && $myarch eq $buildarch) {
# update waiting_for markers
for my $arch (grep {$_ ne $buildarch} @archs) {
Expand Down
6 changes: 6 additions & 0 deletions src/backend/BSSched/Checker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1550,6 +1550,12 @@ sub read_gbininfo {
return $gbininfo;
}

sub gbininfo_is_delayed {
my ($ctx, $prp, $arch) = @_;
my $gc = ($ctx->{'gbininfo_cache'} || {})->{"$prp/$arch"};
return $gc && defined($gc->[0]) && !$gc->[0] ? 1 : 0;
}

sub rebuild_gbininfo {
my ($ctx, $prp) = @_;
my $gctx = $ctx->{'gctx'};
Expand Down

0 comments on commit ee16b52

Please sign in to comment.