Module: tools
Branch: master
Commit: 99fe00204051affc4800140afbdce4fada591d86
URL: https://source.winehq.org/git/tools.git/?a=commit;h=99fe00204051affc4800140…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Wed Feb 21 01:38:47 2018 +0100
testbot: Track the per-host queued tasks and use it for future VMs.
It is a better sign that the host is idle than checking it only has idle
VMs.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/WineTestBot/Jobs.pm | 33 +++++++++++++--------------------
1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/testbot/lib/WineTestBot/Jobs.pm b/testbot/lib/WineTestBot/Jobs.pm
index 7c9da68..56c903d 100644
--- a/testbot/lib/WineTestBot/Jobs.pm
+++ b/testbot/lib/WineTestBot/Jobs.pm
@@ -464,7 +464,8 @@ sub _GetSchedHost($$)
if (!$Sched->{hosts}->{$HostKey})
{
$Sched->{hosts}->{$HostKey} = {
- active => 0,
+ queued => 0, # Tasks
+ active => 0, # VMs...
idle => 0,
reverting => 0,
sleeping => 0,
@@ -865,6 +866,8 @@ sub _ScheduleTasks($)
$Sched->{blocked}++;
next;
}
+ my $Host = _GetSchedHost($Sched, $VM);
+ $Host->{queued}++;
$Sched->{queued}++;
if ($StepRank >= 2 or !$PreviousVMs)
@@ -906,7 +909,6 @@ sub _ScheduleTasks($)
# candidate for shutdown since it will be needed next.
delete $Sched->{lambvms}->{$VMKey};
- my $Host = _GetSchedHost($Sched, $VM);
# Dirty VMs are VMs that were running and have still not been
# powered off. Sleeping VMs may be VMs that are booting.
# So in both cases they may still be using CPU and I/O resources so
@@ -1099,24 +1101,15 @@ sub _RevertVMs($$)
my $NeedsSacrifice;
if (_GetNiceness($NeededVMs, $VMKey) >= $FUTURE_BASE)
{
- if (!exists $Host->{isidle})
- {
- # Only start preparing VMs for future jobs on a host which is idle.
- # FIXME As a proxy we currently check that the host only has idle VMs.
- # This is a bad proxy because:
- # - The host could still have pending tasks for a 'next step'. Once
- # those get closer to running, preparing those would be better than
- # preparing future VMs.
- # - Checking there are no queued tasks on that host would be better
- # but this information is not available on a per-host basis.
- # - It forces the host to go through an extra poweroff during which we
- # lose track of which VM is 'hot'.
- # - However on startup this helps ensure that we are not prevented
- # from preparing the best VM (e.g. build) just because it is still
- # being checked (i.e. marked dirty).
- $Host->{isidle} = ($Host->{active} == $Host->{idle});
- }
- if (!$Host->{isidle} or $Host->{MaxVMsWhenIdle} == 0)
+ # Only start preparing VMs for future jobs on a host which is idle, i.e.
+ # which no longer has queued tasks (ignoring blocked ones).
+ # Note that we could also check that the host only has idle VMs. This
+ # would help ensure that we are not prevented from preparing the best VM
+ # (e.g. build) on startup just because it is still being checked (i.e.
+ # marked dirty). But during regular operation this would force the host
+ # to go through an extra poweroff during which we lose track of which
+ # VM is 'hot'
+ if ($Host->{queued} != 0 or $Host->{MaxVMsWhenIdle} == 0)
{
# The TestBot is busy or does not prepare VMs when idle
next;
Module: tools
Branch: master
Commit: ab5406028e06f1c51341e88a89c5c2a6af0dfb3b
URL: https://source.winehq.org/git/tools.git/?a=commit;h=ab5406028e06f1c51341e88…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Wed Feb 21 01:38:29 2018 +0100
testbot/web: Show the number of blocked tasks on the activity page.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/WineTestBot/Activity.pm | 5 +++--
testbot/web/Activity.pl | 8 +++++---
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/testbot/lib/WineTestBot/Activity.pm b/testbot/lib/WineTestBot/Activity.pm
index 3016b14..acec606 100644
--- a/testbot/lib/WineTestBot/Activity.pm
+++ b/testbot/lib/WineTestBot/Activity.pm
@@ -68,6 +68,7 @@ for the specified timestamp. Entries have the following structure:
end => <EndTimestamp>,
runnable => <RunnableTasksCount>,
queued => <QueuedTasksCount>,
+ blocked => <TasksOnMaintenanceOrDisabledVMsCount>,
engine => <StartOrStop>,
statusvms => {
<VMName1> => {
@@ -145,7 +146,7 @@ sub GetActivity($;$)
my $Group = $ActivityHash->{$Record->RecordGroupId};
if ($Record->Type eq "tasks" and $Record->Name eq "counters")
{
- ($Group->{runnable}, $Group->{queued}) = split / /, $Record->Value;
+ ($Group->{runnable}, $Group->{queued}, $Group->{blocked}) = split / /, $Record->Value;
}
elsif ($Record->Type eq "engine" and $Record->Name =~ /^(?:start|stop)$/)
{
@@ -237,7 +238,7 @@ sub GetActivity($;$)
if ($LastGroup)
{
$LastGroup->{end} = $Group->{start};
- foreach my $Counter ('runnable', 'queued')
+ foreach my $Counter ('runnable', 'queued', 'blocked')
{
if (!exists $Group->{$Counter} and exists $LastGroup->{$Counter})
{
diff --git a/testbot/web/Activity.pl b/testbot/web/Activity.pl
index 13c77c6..91153b3 100644
--- a/testbot/web/Activity.pl
+++ b/testbot/web/Activity.pl
@@ -161,9 +161,11 @@ EOF
print "<td colspan='", scalar(@SortedVMs), "'><hr></td>\n";
next;
}
- if ($Group->{runnable} or $Group->{queued})
+ if ($Group->{runnable} or $Group->{queued} or $Group->{blocked})
{
- print "<td class='Record'>", ($Group->{runnable} || 0), " / ", ($Group->{queued} || 0), "</td>";
+ print "<td class='Record'>", ($Group->{runnable} || 0), " / ",
+ ($Group->{queued} || 0),
+ ($Group->{blocked} ? "+$Group->{blocked}" : ""), "</td>";
}
else
{
@@ -282,7 +284,7 @@ sub GenerateFooter($)
print "<span class='Record-running'>running</span> a task (in which case it links to it),<br>\n";
print "<span class='Record-dirty'>dirty</span> while the server is powering off the VM after a task or while it assesses its state on startup.</p>\n";
- print "<p>If no time is indicated then the VM remained in that state for less than 2 seconds. The tasks column indicates the number of runnable / queued tasks before that scheduling round. A long horizontal bar indicates the TestBot server was restarted. </p>\n";
+ print "<p>If no time is indicated then the VM remained in that state for less than 2 seconds. The tasks column indicates the number of runnable / queued tasks before that scheduling round. If any task needs to run on a maintenance, retired or deleted VM is is shown as +N. A long horizontal bar indicates the TestBot server was restarted. </p>\n";
print "<p>This <span class='Record Record-running Record-timeout'>border</span> indicates that the task timed out,<br>\n";
print "this <span class='Record Record-running Record-error'>border</span> denotes a transient (network?) error so the task will be re-run,<br>\n";
print "and this <span class='Record Record-running Record-boterror'>border</span> indicates a TestBot error.<br>\n";
Module: tools
Branch: master
Commit: 0003b2cf5f51c0da447a60c918ab442296415d12
URL: https://source.winehq.org/git/tools.git/?a=commit;h=0003b2cf5f51c0da447a60c…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Wed Feb 21 01:38:16 2018 +0100
testbot: Also record the number of blocked tasks.
A task is blocked if it should run on a retired or deleted VM, or one
which is undergoing maintenance.
Previously the runnable and queued task counters would include blocked
tasks which was wrong since, although they are queued, blocked tasks
cannot be run until some external actor makes the VM usable again.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/WineTestBot/Jobs.pm | 40 ++++++++++++++++++----------------------
1 file changed, 18 insertions(+), 22 deletions(-)
diff --git a/testbot/lib/WineTestBot/Jobs.pm b/testbot/lib/WineTestBot/Jobs.pm
index b71073a..7c9da68 100644
--- a/testbot/lib/WineTestBot/Jobs.pm
+++ b/testbot/lib/WineTestBot/Jobs.pm
@@ -572,6 +572,7 @@ sub _CheckAndClassifyVMs()
nicefuture => {},
runnable => 0,
queued => 0,
+ blocked => 0,
recordgroups => CreateRecordGroups(),
};
$Sched->{recordgroup} = $Sched->{recordgroups}->Add();
@@ -848,30 +849,29 @@ sub _ScheduleTasks($)
$Steps->AddFilter("Status", ["queued", "running"]);
foreach my $Step (sort { $a->No <=> $b->No } @{$Steps->GetItems()})
{
- my $Tasks = $Step->Tasks;
- $Tasks->AddFilter("Status", ["queued"]);
- $Sched->{queued} += $Tasks->GetItemsCount();
-
# StepRank 0 contains the runnable tasks, 1 the 'may soon be runnable'
# ones, and 2 and greater tasks we don't care about yet
- next if ($StepRank >= 2);
- if ($StepRank == 0)
- {
- $Step->HandleStaging() if ($Step->Status eq "queued");
- $Sched->{runnable} += $Tasks->GetItemsCount();
- }
- elsif (!$PreviousVMs)
- {
- # The previous step is nowhere near done so skip this one for now
- next;
- }
+ $Step->HandleStaging() if ($StepRank == 0 and $Step->Status eq "queued");
my $StepVMs = [];
+
+ my $Tasks = $Step->Tasks;
+ $Tasks->AddFilter("Status", ["queued"]);
foreach my $Task (@{$Tasks->GetItems()})
{
my $VM = $Task->VM;
- next if (!$VM->HasEnabledRole() or !$VM->HasEnabledStatus());
+ if (!$VM->HasEnabledRole() or !$VM->HasEnabledStatus())
+ {
+ $Sched->{blocked}++;
+ next;
+ }
+ $Sched->{queued}++;
+ if ($StepRank >= 2 or !$PreviousVMs)
+ {
+ # The previous step is nowhere near done so skip this one for now
+ next;
+ }
if ($StepRank == 1)
{
# Passing $PreviousVMs ensures this VM will be reverted if and only
@@ -880,6 +880,7 @@ sub _ScheduleTasks($)
_AddNeededVM($NeededVMs, $VM, $NEXT_BASE + $JobRank, $PreviousVMs);
next;
}
+ $Sched->{runnable}++; # $StepRank == 0
if (!_AddNeededVM($NeededVMs, $VM, $JobRank))
{
@@ -1108,9 +1109,6 @@ sub _RevertVMs($$)
# preparing future VMs.
# - Checking there are no queued tasks on that host would be better
# but this information is not available on a per-host basis.
- # - Also the number of queued tasks includes tasks scheduled to run
- # on maintenance and retired/deleted VMs. Any such task would prevent
- # preparing future VMs for no good reason.
# - It forces the host to go through an extra poweroff during which we
# lose track of which VM is 'hot'.
# - However on startup this helps ensure that we are not prevented
@@ -1253,9 +1251,7 @@ sub ScheduleJobs()
if (@{$Sched->{records}->GetItems()})
{
- # FIXME Add the number of tasks scheduled to run on a maintenance, retired
- # or deleted VM...
- my $TaskCounts = "$Sched->{runnable} $Sched->{queued} 0";
+ my $TaskCounts = "$Sched->{runnable} $Sched->{queued} $Sched->{blocked}";
if ($TaskCounts ne $_LastTaskCounts)
{
$Sched->{records}->AddRecord('tasks', 'counters', $TaskCounts);