Skip to content

Commit

Permalink
Merge pull request #13951 from mlschroe/master
Browse files Browse the repository at this point in the history
[backend] BSSched::RPC.pm: log creation of new RPCs
  • Loading branch information
mlschroe authored Mar 7, 2023
2 parents 80b4a32 + 8103abe commit a1885f9
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/backend/BSSched/BuildJob/BuildEnv.pm
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ sub build {
# nope, need to search package data as well
for my $aprp (@{$ctx->{'prpsearchpath'}}) {
my ($aprojid, $arepoid) = split('/', $aprp, 2);
my $gbininfo = $ctx->read_gbininfo($aprp, $arch, 1) || {};
my $gbininfo = $ctx->read_gbininfo($aprp, $arch) || {};
for my $packid (sort keys %$gbininfo) {
for (map {$gbininfo->{$packid}->{$_}} sort keys %{$gbininfo->{$packid}}) {
next unless $_->{'name'} && $_->{'hdrmd5'};
Expand Down
17 changes: 11 additions & 6 deletions src/backend/BSSched/BuildJob/KiwiProduct.pm
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ sub check {
my %rpms_meta;
my %rpms_hdrmd5;
my $neverblock = $ctx->{'isreposerver'};
my $remoteprojs = $gctx->{'remoteprojs'};

#print "prps: @aprps\n";
#print "archs: @archs\n";
Expand Down Expand Up @@ -207,9 +208,11 @@ sub check {
push @{$used{$aprp}}, $pname;
}
for my $aprp (@aprps) {
my ($aprojid, $arepoid) = split('/', $aprp, 2);
next if $remoteprojs->{$aprojid}; # FIXME: should do something here
my %pnames = map {$_ => 1} @{$used{$aprp}};
next unless %pnames;
# FIXME: does not work for remote repos
next unless -e "$reporoot/$aprp/$localbuildarch/:packstatus";
my $ps = BSUtil::retrieve("$reporoot/$aprp/$localbuildarch/:packstatus", 1);
if (!$ps) {
$ps = (readxml("$reporoot/$aprp/$localbuildarch/:packstatus", $BSXML::packstatuslist, 1) || {})->{'packstatus'} || [];
Expand Down Expand Up @@ -264,7 +267,6 @@ sub check {
my %blockedarch;
my $delayed_errors = '';
my $projpacks = $gctx->{'projpacks'};
my $remoteprojs = $gctx->{'remoteprojs'};
for my $aprp (@aprps) {
my %known;
my ($aprojid, $arepoid) = split('/', $aprp, 2);
Expand All @@ -279,10 +281,13 @@ sub check {
}
for my $arch (@archs) {
next if $myarch ne $buildarch && $myarch ne $arch;
my $ps = BSUtil::retrieve("$reporoot/$aprp/$arch/:packstatus", 1);
if (!$ps) {
$ps = (readxml("$reporoot/$aprp/$arch/:packstatus", $BSXML::packstatuslist, 1) || {})->{'packstatus'} || [];
$ps = { 'packstatus' => { map {$_->{'name'} => $_->{'status'}} @$ps } };
my $ps;
if (!$remoteprojs->{$aprojid} && -e "$reporoot/$aprp/$arch/:packstatus") {
$ps = BSUtil::retrieve("$reporoot/$aprp/$arch/:packstatus", 1);
if (!$ps) {
$ps = (readxml("$reporoot/$aprp/$arch/:packstatus", $BSXML::packstatuslist, 1) || {})->{'packstatus'} || [];
$ps = { 'packstatus' => { map {$_->{'name'} => $_->{'status'}} @$ps } };
}
}
$ps = ($ps || {})->{'packstatus'} || {};

Expand Down
23 changes: 17 additions & 6 deletions src/backend/BSSched/Checker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ sub wipeobsolete {
$reason = 'excluded' if $info && ($info->{'error'} || '') eq 'excluded';
my $releasename = $pdata->{'releasename'} || $packid;
if ($ctx->{'excludebuild'}) {
$reason = 'excluded' if $ctx->{'excludebuild'}->{$packid} || $ctx->{'excludebuild'}->{$releasename};
$reason = 'excluded' if $ctx->{'excludebuild'}->{$packid} || $ctx->{'excludebuild'}->{$releasename};
}
if ($ctx->{'onlybuild'}) {
$reason = 'excluded' unless $ctx->{'onlybuild'}->{$packid} || $ctx->{'onlybuild'}->{$releasename};
Expand Down Expand Up @@ -1515,17 +1515,28 @@ sub read_gbininfo {
$arch ||= $gctx->{'arch'};
my $remoteprojs = $gctx->{'remoteprojs'};
my ($projid, $repoid) = split('/', $prp, 2);
if ($remoteprojs->{$projid}) {
return BSSched::Remote::read_gbininfo_remote($ctx, "$prp/$arch", $remoteprojs->{$projid}, $ps);
}

# a per ctx cache
my $gbininfo_cache = $ctx->{'gbininfo_cache'};
$gbininfo_cache = $ctx->{'gbininfo_cache'} = {} unless $gbininfo_cache;
my $gbininfo = $gbininfo_cache->{"$prp/$arch"};
my ($gbininfo, $ps2) = @{$gbininfo_cache->{"$prp/$arch"} || []};
if ($remoteprojs->{$projid}) {
if (!$gbininfo || !$ps2) {
return $gbininfo if defined($gbininfo) && !$gbininfo; # in progress
$ps2 = $ps ? {} : undef;
$gbininfo = BSSched::Remote::read_gbininfo_remote($ctx, "$prp/$arch", $remoteprojs->{$projid}, $ps2);
$gbininfo_cache->{"$prp/$arch"} = [ $gbininfo ] if defined($gbininfo) && !$gbininfo; # cache "in progress"
$gbininfo_cache->{"$prp/$arch"} = [ $gbininfo, $ps2 ] if $gbininfo && $ps2;
}
if ($gbininfo && $ps) {
$ps->{$_} = $ps2->{$_} for keys %{$ps2 || {}};
}
return $gbininfo;
}
if (!$gbininfo) {
my $reporoot = $gctx->{'reporoot'};
$gbininfo = BSSched::BuildResult::read_gbininfo("$reporoot/$prp/$arch", $arch eq $gctx->{'arch'} ? 0 : 1);
$gbininfo_cache->{"$prp/$arch"} = $gbininfo if $gbininfo;
$gbininfo_cache->{"$prp/$arch"} = [ $gbininfo ] if $gbininfo;
}
return $gbininfo;
}
Expand Down
18 changes: 18 additions & 0 deletions src/backend/BSSched/RPC.pm
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ sub xrpc {
$iswaiting->{$resource} = $handle;
return $handle;
}
print "new RPC $resource ($param->{'uri'})\n";
my $handle = BSRPC::rpc($param, @args);
$handle->{'_ctx'} = $ctx;
$handle->{'_iswaiting'} = $resource;
Expand Down Expand Up @@ -174,6 +175,10 @@ sub xrpc_dowakeup {
my $wakeup = delete $handle->{'_wakeup'};
delete $handle->{'_wakeup_have'};
my %did;
# do not trigger a wakeup if some other resources are still in progress
for my $rh (values(%{$rctx->{'iswaiting'}})) {
$did{$_} = 1 for keys %{$rh->{'_wakeup_have'} || {}};
}
for my $whandle (BSUtil::unify(@{$wakeup || []})) {
my $ctx = $whandle->{'_ctx'};
my $changeprp = $whandle->{'_changeprp'} || $ctx->{'changeprp'};
Expand Down Expand Up @@ -219,6 +224,19 @@ sub xrpc_printstats {
my ($rctx) = @_;
my $iswaiting = $rctx->{'iswaiting'};
return unless %$iswaiting;
my $showrunning;
if ($showrunning) {
print "async RPC requests:\n";
for my $resource (sort keys %$iswaiting) {
my $handle = $iswaiting->{$resource};
my $running = $handle->{'_xrpc_data'} ? '' : ' (running)';
my $nw = scalar(@{$handle->{'_wakeup'} || []});
$nw = $nw ? " wakeup:$nw" : '';
my $nq = scalar(@{$handle->{'_nextxrpc'} || []});
$nq = $nq ? " queued:$nq" : '';
print " - $resource$nq$nw$running\n";
}
}
my $iswaiting_server = $rctx->{'iswaiting_server'};
my $iswaiting_serverload = $rctx->{'iswaiting_serverload'};
my $iswaiting_serverload_low = $rctx->{'iswaiting_serverload_low'};
Expand Down

0 comments on commit a1885f9

Please sign in to comment.