All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 3daf343d authored by Sachin Goyal's avatar Sachin Goyal

flexdatasrv:
Added a new option for meastype 'both' that checks for both lat and bw
measurements.

goodnodes.pl:
Added options for specifying meastype and searchtype
parent 54e44982
......@@ -262,7 +262,7 @@ class flexlab:
run a max clique heuristic over the set of nodes
that are supplied (or all known nodes, if none are
supplied), and will select the k-best nodes.
meastype (str) Measurements to be considered - 'lat' or 'bw'
meastype (str) Measurements to be considered - 'lat','bw','both'
Returns:
A list of Emulab node_ids.
"""
......@@ -277,7 +277,7 @@ class flexlab:
size = int(argdict["size"])
except:
return FlexlabInvalidArgumentFault(11,"Must supply a positive set size!")
if size <= 0:
if size < 0:
return FlexlabInvalidArgumentFault(11,"Must supply a positive set size!")
pass
else:
......@@ -286,6 +286,7 @@ class flexlab:
nodefilterlist = []
filtertype = True
meastype = ''
searchtype = ''
if argdict.has_key("nodefilter"):
nodefilterlist = argdict["nodefilter"]
......@@ -298,13 +299,22 @@ class flexlab:
if argdict.has_key("meastype"):
meastype = argdict["meastype"]
if meastype != 'lat' and meastype != 'bw':
return FlexlabInvalidArgumentFault(12,"meastype can be only lat or bw!")
if meastype != 'lat' and meastype != 'bw' and meastype != 'both':
return FlexlabInvalidArgumentFault(12,"meastype can be only lat, bw or both!")
pass
else:
meastype = 'lat'
pass
if argdict.has_key("searchtype"):
searchtype = argdict["searchtype"]
if searchtype != 'fastfallible' and searchtype != 'maxclique':
return FlexlabInvalidArgumentFault(12,"searchtype can be only fastfallible or maxclique!")
pass
else:
searchtype = 'maxclique'
pass
if argdict.has_key("filtertype"):
filtertype = argdict["filtertype"]
if type(filtertype) == types.IntType:
......@@ -332,7 +342,10 @@ class flexlab:
pass
try:
retval = self._GraphGoodnodes(meastype,size,finalnodes)
if searchtype == 'maxclique':
retval = self._GraphGoodnodes(meastype,size,finalnodes)
else:
retval = self._simpleGoodnodes(size,finalnodes)
except:
raise
......@@ -510,6 +523,12 @@ class flexlab:
G.add_edge((ss, ds))
pass
pass
if (meastype == "both"):
both = lat + fbw + bbw
if both > 2:
G.add_edge((ss, ds))
pass
pass
pass
......
......@@ -38,16 +38,18 @@ $| = 1;
sub usage {
print "Usage: $0 [-e pid/eid] [-f blacklistfilename] [-t type] [-v] ".
"[-0 starttime] [-1 endtime] <numNodes>\n";
"[-m meastype] [-s searchtype] <numNodes>\n";
return 1;
}
my ($pid, $eid);
my $blacklistfilename;
my $type = "";
my $meastype = "both";
my $searchtype = "maxclique";
my $verbose = 0;
my ($t0, $t1);
my %opt = ();
getopts("0:1:e:f:t:v", \%opt);
getopts("0:1:e:f:t:vm:s:", \%opt);
if ($opt{e}) {
($pid,$eid) = split('/', $opt{e});
} else {
......@@ -55,12 +57,26 @@ if ($opt{e}) {
}
if ($opt{f}) { $blacklistfilename = $opt{f}; }
if ($opt{t}) { $type = $opt{t}; }
if ($opt{m}) { $meastype = $opt{m}; }
if ($opt{s}) { $searchtype = $opt{s}; }
if ($opt{v}) { $verbose = 1; }
if ($opt{0}) { $t0 = $opt{0}; } else { $t0 = time()-$windowHrsDef*60*60; }
if ($opt{1}) { $t1 = $opt{1}; }
elsif($opt{0}) { $t1 = $t0+$windowHrsDef*60*60; }
else { $t1 = time(); }
if (@ARGV !=1) { exit &usage; }
if (($meastype ne 'lat') && ($meastype ne 'bw') && ($meastype ne 'both')) {
print "Wrong value of meastype (-m option). It can be only".
"'lat', 'bw', or 'both' \n";
exit 1;
}
if (($searchtype ne 'fastfallible') && ($searchtype ne 'maxclique')) {
print "Wrong value of searchtype (-s option). It can be only".
"'fastfallible' or 'maxclique'\n";
exit 1;
}
#
# These are globals
......@@ -164,6 +180,8 @@ my ($DEF_HOST,$DEF_PORT,$DEF_URL) = ('ops.emulab.net','3993','/');
my $xurl = "http://${DEF_HOST}:${DEF_PORT}${DEF_URL}";
my $xargs = { 'size' => $numnodes,
'nodefilter' => \@allnodes,
'meastype' => $meastype,
'searchtype' => $searchtype,
'filtertype' => 1 };
my $respref = libxmlrpc::CallMethodHTTP($xurl,'flexlab.getFullyConnectedSet',
$xargs);
......
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