Commit 054120b2 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Adjust the query so that we mark plab/jailed nodes down when they stop

reporting.
parent 08b05241
......@@ -22,6 +22,8 @@ my $TBLOGS = "@TBLOGSEMAIL@";
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/usr/site/bin';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
my $debug = 0;
#
# Turn off line buffering on output
#
......@@ -45,20 +47,24 @@ if (($UID != 0) && (!TBAdmin())) {
#
my $query_result =
DBQueryFatal("SELECT n.node_id,ns.status,r.pid,nt.isremotenode, ".
" UNIX_TIMESTAMP(now()) - ".
" UNIX_TIMESTAMP(ns.status_timestamp) ".
" nt.isvirtnode, now() - ns.status_timestamp ".
" from nodes as n ".
"left join node_types as nt on n.type=nt.type ".
"left join node_status as ns on ns.node_id=n.node_id ".
"left join reserved as r on r.node_id=n.node_id ".
"where nt.isvirtnode=0 and ".
# We ignore plab nodes, because the physical plab nodes do not
# do the keepalive
" n.type != 'pcplabphys' and " .
" (UNIX_TIMESTAMP(now()) - ".
" UNIX_TIMESTAMP(ns.status_timestamp)) > 90");
"where ".
# We ignore plab physical nodes, because the physical nodes
# do not do keepalive; handled by plab daemon instead.
" n.type != 'pcplabphys' && ns.status != 'down' && " .
# Jailed and PLAB virtnodes report every 600 seconds.
# Must be allocated to an experiment to be considerd.
" ((nt.isvirtnode=1 && r.pid is not null && ".
" ((now() - ns.status_timestamp) > 900)) || ".
# Local phys nodes report every 180 seconds.
" (nt.isvirtnode=0 && nt.isremotenode=0 && ".
" ((now() - ns.status_timestamp) > 300)))");
while (my ($node,$status,$pid,$remote,$timediff) =
while (my ($node,$status,$pid,$remote,$isvirt,$timediff) =
$query_result->fetchrow_array) {
my $newstatus = "down";
......@@ -81,7 +87,12 @@ while (my ($node,$status,$pid,$remote,$timediff) =
}
#
# Repeat the time check to avoid dropping a node that just came up.
#
DBQueryFatal("update node_status set status='$newstatus' ".
"where node_id='$node'");
#
if ($debug) {
print "$node ($timediff) goes from $status to $newstatus\n";
}
else {
DBQueryFatal("update node_status set status='$newstatus' ".
"where node_id='$node'");
}
}
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