Mailinglist Archive: opensuse-buildservice (266 mails)

< Previous Next >
[opensuse-buildservice] Monitor Shall Count Blocked Packages / b.n.c 264499
  • From: "Jan-Simon Möller" <dl9pf@xxxxxx>
  • Date: Wed, 26 Nov 2008 09:19:39 +0100
  • Message-id: <200811260919.39713.dl9pf@xxxxxx>
Hi!

Here's a patch to add this funtionality. Its also attached to #264499 .

Best regards,
Jan-Simon
Index: src/backend/BSXML.pm
===================================================================
--- src/backend/BSXML.pm (Revision 5689)
+++ src/backend/BSXML.pm (Arbeitskopie)
@@ -485,6 +485,10 @@
'arch',
'starttime',
]],
+ [[ 'blocked', =>
+ 'arch',
+ 'jobs',
+ ]],
[[ 'waiting', =>
'arch',
'jobs',
@@ -752,6 +756,11 @@
[ 'blocked' ],
];

+our $blockedcount = [
+ 'blockedcount' =>
+ ['blocked'],
+];
+
our $collection = [
'collection' =>
[ $request ],
Index: src/backend/bs_repserver
===================================================================
--- src/backend/bs_repserver (Revision 5689)
+++ src/backend/bs_repserver (Arbeitskopie)
@@ -648,6 +648,7 @@
my @a;
@a = ls($jobsdir) unless $cgi->{'scheduleronly'};
my @waiting;
+ my @blocked;
for my $a (@a) {
my @d = grep {!/^\./ && !/:(?:dir|new)$/} ls("$jobsdir/$a");
my %d = map {$_ => 1} @d;
@@ -667,10 +668,18 @@
delete $d{$d};
}
push @waiting, {'arch' => $a, 'jobs' => scalar(keys %d)};
+ my $blockedfile = join('', $reporoot, '/', $a, '_blocked.xml');
+ my $b = readxml("$blockedfile", $BSXML::blockedcount, 1) || {};
+ if ($b->{'blocked'}) {
+ push @blocked, {'arch' => $a, 'jobs' => $b->{'blocked'}[0]};
+ } else {
+ push @blocked, {'arch' => $a, 'jobs' => "0"};
+ }
}
@idle = sort {$a->{'workerid'} cmp $b->{'workerid'} || $a->{'uri'} cmp
$b->{'uri'} || $a cmp $b} @idle;
@building = sort {$a->{'workerid'} cmp $b->{'workerid'} || $a->{'uri'} cmp
$b->{'uri'} || $a cmp $b} @building;
@waiting = sort {$a->{'arch'} cmp $b->{'arch'} || $a cmp $b} @waiting;
+ @blocked = sort {$a->{'arch'} cmp $b->{'arch'} || $a cmp $b} @blocked;

my @scheddata;
my @schedarchs = grep {s/^bs_sched\.(.*)\.lock$/$1/} sort(ls($rundir));
@@ -700,6 +709,7 @@
$ret->{'building'} = \@building;
$ret->{'waiting'} = \@waiting;
$ret->{'idle'} = \@idle;
+ $ret->{'blocked'} = \@blocked;
}
$ret->{'scheduler'} = \@scheddata;
return ($ret, $BSXML::workerstatus);
Index: src/backend/bs_sched
===================================================================
--- src/backend/bs_sched (Revision 5689)
+++ src/backend/bs_sched (Arbeitskopie)
@@ -3718,6 +3718,22 @@
delete $globalnotready{$prp};
}

+ #for display of overall blocked jobs
+ my $blockedcount = 0;
+ my @myblockedcount;
+ for (keys %globalnotready) {
+ my $gnlist = $globalnotready{$_};
+ for (keys %$gnlist) {
+ $blockedcount++;
+ }
+ }
+ if ($blockedcount){
+ @myblockedcount = "$blockedcount";
+ my $xblockedfile = join('', $reporoot, '/.', $myarch, '_blocked.xml');
+ my $blockedfile = join('', $reporoot, '/', $myarch, '_blocked.xml');
+ writexml("$xblockedfile", "$blockedfile", {'blocked' => \@myblockedcount},
$BSXML::blockedcount);
+ }
+
# write blocked data into a file so that remote servers can
# fetch it
if (%notready) {
Index: src/webclient/app/views/monitor/_blocked.rhtml
===================================================================
--- src/webclient/app/views/monitor/_blocked.rhtml (Revision 0)
+++ src/webclient/app/views/monitor/_blocked.rhtml (Revision 0)
@@ -0,0 +1,5 @@
+<br>
+<h2>Blocked Queue</h2>
+<% @workerstatus.each_blocked.sort {|a,b| a.arch <=> b.arch }.each do |entry|
%>
+ <%= entry.arch %>: <%= entry.jobs %> blocked<br />
+<% end %>
Index: src/webclient/app/views/monitor/index.rhtml
===================================================================
--- src/webclient/app/views/monitor/index.rhtml (Revision 5689)
+++ src/webclient/app/views/monitor/index.rhtml (Arbeitskopie)
@@ -8,3 +8,4 @@
<%= render :partial => 'building' %>
<%= render :partial => 'idle' %>
<%= render :partial => 'waiting' %>
+<%= render :partial => 'blocked' %>
< Previous Next >
Follow Ups