Commit 5fc5ff17 authored by Gary Wong's avatar Gary Wong

Add optional reservation admission control debugging output.

parent dbe2baf2
......@@ -549,9 +549,9 @@ sub Tidy($)
return 1;
}
sub LookupAll($$;$)
sub LookupAll($$;$$)
{
my ($class, $type, $include_pending) = @_;
my ($class, $type, $include_pending, $details) = @_;
return $cache{$type} if( exists( $cache{$type} ) );
......@@ -615,6 +615,8 @@ sub LookupAll($$;$)
"GROUP BY e.pid, e.eid, n.reserved_pid, " .
"nr.pid, UNIX_TIMESTAMP( pr.end )";
my $query_result = DBQueryWarn( $query );
$$details = "--- Node usage:\n" if( ref( $details ) );
while( my($count, $pid, $eid, $uid, $end, $autoswap, $next_reserve,
$slice_expire, $slice_lockdown, $reserved_pid, $pr_end,
......@@ -622,6 +624,13 @@ sub LookupAll($$;$)
$query_result->fetchrow_array() ) {
my $endtime;
if( ref( $details ) ) {
no warnings 'uninitialized';
$$details = $$details . "$count, $pid, $eid, $uid, $end, " .
"$autoswap, $next_reserve, $slice_expire, $slice_lockdown, " .
"$reserved_pid, $pr_end, $expt_lockdown, $swappable\n";
}
if( defined( $slice_expire ) ) {
# Node(s) allocated to a GENI slice. Treat as unavailable
# if locked down, otherwise assume released at slice expiry
......@@ -681,6 +690,8 @@ sub LookupAll($$;$)
push( @reservations, $res );
}
}
$$details = $$details . "\n--- Reservations:\n" if( ref( $details ) );
$query_result = DBQueryWarn( "SELECT pid, uid, UNIX_TIMESTAMP( start ), " .
"UNIX_TIMESTAMP( end ), nodes, idx FROM " .
......@@ -693,6 +704,11 @@ sub LookupAll($$;$)
my $res = Create( $class, $pid, $uid, $start, $end, $type, $nodes );
$res->{'IDX'} = $idx;
push( @reservations, $res );
if( ref( $details ) ) {
no warnings 'uninitialized';
$$details = $$details . "$pid, $uid, $start, $end, $nodes, $idx\n";
}
}
$cache{$type} = \@reservations;
......
......@@ -44,7 +44,7 @@ use Reservation;
sub usage()
{
print STDERR "Usage: predict [-p] [-u] [-t time] type\n";
print STDERR "Usage: predict [-p] [-u] [-t time] [-v] type\n";
print STDERR " predict -c type [pid...]\n";
print STDERR " predict -l type [pid...]\n";
print STDERR " predict -n [-t time] [-D duration] type [pid...]\n";
......@@ -61,11 +61,12 @@ sub usage()
print STDERR " -p Identify by pid only, not pid/eid\n";
print STDERR " -t Give time/date for prediction (defaults to now)\n";
print STDERR " -u Interpret/display all times in UTC\n";
print STDERR " -v Verbose (debugging) output for node usage\n";
exit( -1 );
}
my $optlist = "cdD:hlnpPt:T:x";
my $optlist = "cdD:hlnpPt:T:xv";
my $debug = 0;
my $duration = 365 * 24 * 60 * 60; # default to 1 year ~= infinity
my $time = time; # default to now
......@@ -116,6 +117,9 @@ if (defined($options{"u"})) {
if (defined($options{h})) {
usage();
}
if (defined($options{v})) {
$debug = 1;
}
if (defined($options{p})) {
$pidonly = 1;
}
......@@ -230,13 +234,17 @@ if( $unfulfilled ) {
exit( 0 );
}
my $reservations = Reservation->LookupAll( $type );
my $details;
my $reservations = Reservation->LookupAll( $type, 0,
$debug ? \$details : undef );
my @timeline = ();
my $free = 0;
my %used = ();
my %reserved = ();
my %usedexp = ();
print $details if( $debug );
foreach my $reservation ( @$reservations ) {
my $start;
my $end;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment