Commit dbcb664e authored by Robert Ricci's avatar Robert Ricci

Add a node_features table - just like the node_type_features table,

but it's per node, not per type. Will initially be used to store
inforomation about planetlab nodes.
parent 4c027f76
......@@ -2,7 +2,7 @@
--
-- Host: localhost Database: tbdb
---------------------------------------------------------
-- Server version 3.23.52-log
-- Server version 3.23.54-log
--
-- Table structure for table 'cdroms'
......@@ -669,6 +669,17 @@ CREATE TABLE node_auxtypes (
PRIMARY KEY (node_id,type)
) TYPE=MyISAM;
--
-- Table structure for table 'node_features'
--
CREATE TABLE node_features (
node_id varchar(30) NOT NULL default '',
feature varchar(30) NOT NULL default '',
weight float NOT NULL default '0',
PRIMARY KEY (node_id,feature)
) TYPE=MyISAM;
--
-- Table structure for table 'node_idlestats'
--
......@@ -694,7 +705,6 @@ CREATE TABLE node_status (
PRIMARY KEY (node_id)
) TYPE=MyISAM;
--
-- Table structure for table 'node_type_features'
--
......
......@@ -940,3 +940,11 @@ last_net_act,last_cpu_act,last_ext_act);
NOT NULL default '0' after sync_server;
alter table experiments add mem_usage tinyint(4) unsigned \
NOT NULL default '0' after cpu_usage;
1.180: Add a node_features table, just like the node_type_features
table, but for individual nodes.
create table node_features (node_id varchar(30) not null,
feature varchar(30) not null, weight float not null default 0.0,
primary key (node_id,feature));
......@@ -112,13 +112,25 @@ while (($class,$type,$delaycapacity,$vcap) = $result->fetchrow_array) {
#
$result = DBQueryFatal("select type, feature, weight from node_type_features");
while (my ($type, $feature, $weight) = $result->fetchrow()) {
if (! defined($features{$type})) {
$features{$type} = "$feature:$weight";
next;
if (! defined($type_features{$type})) {
$type_features{$type} = ["$feature:$weight"];
} else {
push @{$type_features{$type}}, "$feature:$weight";
}
$features{$type} .= " $feature:$weight";
}
#
# Read the features table for each individual node
#
$result = DBQueryFatal("select node_id, feature, weight from node_features");
while (my ($node_id, $feature, $weight) = $result->fetchrow()) {
if (! defined($features{$node_id})) {
$features{$node_id} = ["$feature:$weight"];
next;
} else {
push @{$features{$node_id}}, "$feature:$weight";
}
}
#
# Read in the node_auxtypes table for each node.
#
......@@ -262,8 +274,11 @@ foreach $node (keys(%nodes)) {
}
# Add features
if (defined($features{$type})) {
push @features, "$features{$type}";
if (defined($type_features{$type})) {
push @features, @{$type_features{$type}};
}
if (defined($features{$node})) {
push @features, @{$features{$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