Commit a49c39b5 authored by Dan Gebhardt's avatar Dan Gebhardt

Added support for two types of measurement scheduling: 'forever' and 'temp'

A user can set the duration of a measurement set with the -d option in
testsend.pl and manager.pl . The change occurs for the given number of
seconds. After expiration, the old measurement period is used. The logic
behind when/how to change is fairly complex - see bgmon.pl for more details.
parent d9e7a94f
......@@ -20,9 +20,10 @@ my %test_per = ( # defaults
my %intersitenodes = (); #final list for fully-connected test
my @constrnodes; #test constrained to these nodes
my %sitenodes; #hash listing all sites => nodes
my $CPUUSAGETHRESHOLD = 1; #should help prevent flip-flopping between
my $CPUUSAGETHRESHOLD = 10; #should help prevent flip-flopping between
#"best" nodes at a site
my $SITEDIFFTHRESHOLD = 1; #number of site differences between period
#TODO: document normal range of values for CPU
my $SITEDIFFTHRESHOLD = 5; #number of site differences between period
#calculations that trigger an update
my $IPERFDURATION = 5; #duration in seconds of iperf test
my %allnodes;
......@@ -104,8 +105,9 @@ if( defined $constrFilename )
# print "stopping $node\n";
stopnode($node);
}
}else{
#stop all nodes from XML-RPC query
}
#stop all nodes from XML-RPC query
else{
getnodeinfo();
foreach my $site (keys %sitenodes){
foreach my $node (@{$sitenodes{$site}}){
......@@ -217,11 +219,12 @@ sub choosenodes
delete $intersitenodes{$site};
}
elsif( defined $intersitenodes{$site} &&
$intersitenodes{$site} ne $bestnode
#&& isnodeinconstrset($bestnode)
( $intersitenodes{$site} ne $bestnode ||
getstatus($bestnode) eq "anyscheduled_no"
)
)
{
print time()." SECTION 3: node change at $site from ".
print time()." SECTION 3: node change/restart at $site from ".
"$intersitenodes{$site} to $bestnode\n";
# ** This section handles when a "bestnode" at a site changes
......@@ -289,14 +292,14 @@ sub modifytests
if( !$opt{B} ){
$test_per{bw} = $bwper;
print "new BW per = $bwper\n";
}
$lastupdated_numnodes = $numsites;
updateTests(); #handles changing number of sites
updateTests(1,0); #handles changing number of sites.
# only update bandwidth
}
}
if( defined $f_forceInit && $f_forceInit != 0 ){
updateTests(); #handles changing number of sites
updateTests(1,1);
}
}
......@@ -347,8 +350,12 @@ sub choosebestnode($)
# print "choosing best node for site $site\n";
#first time thru loop...
if( $bestnode eq "NONE" ){
#set this to be best node if it responds to a ping
if( edittest($node,"NOADDR",0,"bw") == 1 ){
#set this to be best node if it responds to a command
# if( edittest($node,"NOADDR",0,"bw") == 1 ){
# $bestnode = $node;
# }
if( getstatus($node) ne "error" ){
$bestnode = $node;
}
}else{
......@@ -356,9 +363,10 @@ sub choosebestnode($)
- $CPUUSAGETHRESHOLD) &&
(edittest($node,"NOADDR",0,"bw") == 1) )
{
# print '$allnodes{$node}{cpu}'." $allnodes{$node}{cpu}\n";
# print '$allnodes{$bestnode}{cpu}'.
# " $allnodes{$bestnode}{cpu}\n";
print '$allnodes{$node}{cpu}'.
" $allnodes{$node}{cpu}\n";
print '$allnodes{best$node}{cpu}'.
" $allnodes{$bestnode}{cpu}\n";
$bestnode = $node;
}
}
......@@ -399,15 +407,17 @@ sub isnodeinconstrset($)
#
# update all nodes with new test periods and destination nodes
#
sub updateTests
# Two parameters: first is flag to update bw, second to update latency
sub updateTests($$)
{
my ($f_updatebw, $f_updatelat) = @_;
print "UPDATING TESTS\n";
my $srcnode;
my $bw_destnodes;
my $destnode;
#init bandwidth
if( $f_updatebw ){
foreach my $srcsite (keys %intersitenodes){
$srcnode = $intersitenodes{$srcsite};
$bw_destnodes = "";
......@@ -423,8 +433,10 @@ sub updateTests
}
initnode($srcnode, $bw_destnodes, $test_per{bw}, "bw");
}
}
#init latency: fully connected, but only one direction each path
if( $f_updatelat ){
my %initstrs; #build init strings for each site node
my @sitekeys = keys %intersitenodes;
for( my $i = 0; $i < @sitekeys-1; $i++ ){
......@@ -442,9 +454,10 @@ sub updateTests
# now send the inits to all nodes
foreach my $srcsite (keys %intersitenodes){
$srcnode = $intersitenodes{$srcsite};
initnode($srcnode, $initstrs{$srcnode}, $test_per{latency}, "latency");
initnode($srcnode, $initstrs{$srcnode},
$test_per{latency}, "latency");
}
}
}
#
......
This diff is collapsed.
......@@ -33,8 +33,9 @@ my @expnodes;
sub usage
{
warn "Usage: $0 [-p port] [-e pid/eid]".
"[-l latency period] [-b bandwidth period] [-a]".
"[-o outputport] [-L] <input_file>\n".
" [-l latency period] [-b bandwidth period] [-a]".
" [-d testduration]".
" [-o outputport] [-L] <input_file>\n".
"where -a = measure all pairs\n".
" -L = do not init Latency\n".
" -B = do not init bandwidth\n";
......@@ -64,10 +65,11 @@ $settings{"expt"} = "__none";
#*****************************************
my %opt = ();
getopts("s:p:o:h:e:l:b:aBL", \%opt);
getopts("s:p:o:h:e:d:l:b:aBL", \%opt);
if ($opt{h}) { exit &usage; }
if ($opt{e}) { $settings{"expt"} = $opt{e}; }
if ($opt{d}) { $settings{"testduration"} = $opt{d}; }
if ($opt{a}) { $settings{"allpairs"} = 1; }
if ($opt{L}) { $settings{"noLatency"} = 1; }
if ($opt{B}) { $settings{"noBW"} = 1; }
......@@ -276,7 +278,8 @@ sub initnode($$$$)
cmdtype => "INIT",
destnodes => $destnodes,
testtype => $testtype,
testper => $testper
testper => $testper,
duration => $settings{testduration}
);
sendcmd($node,\%cmd);
......
......@@ -8,16 +8,17 @@ use Getopt::Std;
use strict;
sub usage {
warn "Usage: $0 [-p port] [-e pid/eid] <monitoraddr> <link dest> ".
warn "Usage: $0 [-p port] [-e pid/eid] [-d testduration] <monitoraddr> <link dest> ".
"<testtype> <testper(seconds)> <COMMAND>\n";
return 1;
}
my %opt = ();
getopts("e:s:p:h",\%opt);
getopts("e:d:p:h",\%opt);
my ($expt, $port);
my ($expt, $port, $testduration);
if ($opt{e}) { $expt = $opt{e}; } else { $expt = "__none"; }
if ($opt{d}) { $testduration = $opt{d}; }
if ($opt{p}) { $port = $opt{p}; } else{ $port = 5052; }
if ($opt{h}) { exit &usage; }
if (@ARGV != 5) { exit &usage; }
......@@ -31,7 +32,8 @@ my %cmd = ( expid => $expt,
cmdtype => $cmd,
dstnode => $destnode,
testtype => $testtype,
testper => $testper
testper => $testper,
duration => $testduration
);
my $socket;
......
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