Commit 62bae1b9 authored by Christopher Alfeld's avatar Christopher Alfeld
Browse files

Moved estimations out of tbprerun and into assign_wrapper. It'll update

them on the first run to accurate predictions.
parent cc6bec0f
......@@ -21,6 +21,7 @@ $maxrun = 5;
use DBI;
$DELAYCAPACITY = @DELAYCAPACITY@;
$TBROOT = "@prefix@";
$ENV{'PATH'} = "/usr/bin:$TBROOT/libexec:$TBROOT/sbin:$TBROOT/bin";
$TBDB = "@TBDBNAME@";
......@@ -46,13 +47,6 @@ sub printdb {
}
};
# Let's read the minimum requirements for this experiment.
$sth = $dbh->prepare("SELECT minimum_nodes from experiments" .
" where pid=\"$pid\" and eid=\"$eid\"");
$sth->execute;
($minimum_nodes) = $sth->fetchrow_array;
$sth->finish;
######################################################################
# Step 1 - Setup virtual topology
#
......@@ -226,10 +220,15 @@ open(TOPFILE,"> $topfile") || do {
exit(1);
};
$nodes=0;
$delaynodes=0;
foreach $node (keys(%nodes)) {
# Shark hack
if ($nodes{$node} ne "shark") {
print TOPFILE "node $node $nodes{$node}\n";
$nodes++;
}
# End Shark hack
}
......@@ -256,6 +255,7 @@ foreach $lan (keys(%lans)) {
join(" ",@{$delaynodes{"linksdelaysrc/$lan"}}) . "\n";
$delayid++;
print TOPFILE "node $delayname delay\n";
$delaynodes++;
print TOPFILE "link linksdelaysrc/$lan $node0 $delayname"
. " $bandwidth\n";
print TOPFILE "link linksdelaydst/$lan $node1 $delayname"
......@@ -281,6 +281,7 @@ foreach $lan (keys(%lans)) {
" = " . join(" ",@{$delaynodes{"linkdelaysrc/$lan/$member"}}) . "\n";
$delayid++;
print TOPFILE "node $delayname delay\n";
$delaynodes++;
print TOPFILE "link linkdelaysrc/$lan/$member" .
" $node $delayname $bandwidth\n";
print TOPFILE "link linkdelaydst/$lan/$member" .
......@@ -295,6 +296,14 @@ foreach $lan (keys(%lans)) {
close TOPFILE;
# Set estimations
$minimum_nodes = $nodes + $delaynodes/$DELAYCAPACITY;
$maximum_nodes = $nodes + $delaynodes;
$dbh->do("UPDATE experiments set maximum_nodes=$maximum_nodes, " .
"minimum_nodes=$minimum_nodes where pid=\"$pid\" and eid=\"$eid\"");
print "Minumum nodes = $minimum_nodes\n";
print "Maximum nodes = $maximum_nodes\n";
######################################################################
# Step 2 - Assign Loop
#
......
......@@ -18,12 +18,6 @@ $ENV{'PATH'} = "/usr/bin:$TBROOT/libexec:$TBROOT/libexec/ns2ir" .
":$TBROOT/sbin:$TBROOT/bin";
push(@INC,$TBSETUPLIB);
# This is the average number of delay links that can go through a
# delay node. To calculate this number take 1/2 the interfaces
# rounded down on every node capable node in the testbed and average
# them.
$DELAYCAPACITY = @DELAYCAPACITY@;
# Turn off line buffering.
$| = 1;
......@@ -112,51 +106,6 @@ if (&tbs_exec("parse.tcl $pid $eid $nsfile")) {
exit(1);
}
&tbs_out("Estimating resource usage.\n");
$numnodes = $dbh->do("SELECT * from virt_nodes where pid=\"$pid\"" .
" and eid=\"$eid\"");
$min = $max = $numnodes;
# XXX - Need to fix this.
# XXX - Need to adjust estimations. Basically -1 delay for every
# delayed LAN that has only two nodes. Probably want to add all of
# this to parser.
#$bw_query = "";
#$sth = $dbh->prepare("SELECT max_speed from interface_types");
#$sth->execute();
#($speed) = $sth->fetchrow_array();
#$bw_query .= "bandwidth != $speed";
#while (($speed) = $sth->fetchrow_array()) {
# $bw_query .= " and bandwidth != $speed";
#}
$bw_query = "bandwidth != 100";
$numdelays = $dbh->do("SELECT * from virt_lans where (delay != 0" .
" or lossrate != 0 or ($bw_query))" .
" and pid=\"$pid\" and eid=\"$eid\"");
$min += $numdelays/$DELAYCAPACITY;
$max += $numdelays;
$min = ceil($min);
$max = ceil($max);
# Shark hack
$numsharks = $dbh->do("SELECT * from virt_nodes where type = \"shark\"" .
" and pid=\"$pid\" and eid=\"$eid\"");
$min -= $numsharks;
$max -= $numsharks;
# End Shark Hack
&tbs_out(" Minimum $min Maximum $max\n");
$sth = $dbh->prepare("UPDATE experiments set minimum_nodes = $min," .
"maximum_nodes = $max where pid = \"$pid\"" .
"and eid = \"$eid\"");
if (! $sth->execute()) {
&tbs_out("Failed to set estimates.\n");
cleanup;
exit(1);
}
$sth->finish();
&tbs_out("Marking as prerunned.\n");
$sth = $dbh->prepare("UPDATE experiments set state = \"swapped\"" .
"where pid = \"$pid\" and eid = \"$eid\"");
......
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