Commit 5630d472 authored by Robert Ricci's avatar Robert Ricci

Change the messages that come out of the type precheck, to distinguish

between the given type not having enough _available_ nodes and not
having enough _suitable_ nodes.

Also, fix a silly bug in which I was running the type precheck one too
many times. This didn't hurt anything, just took a little bit of time.
parent 37ff40e4
...@@ -414,11 +414,22 @@ void print_help() { ...@@ -414,11 +414,22 @@ void print_help() {
// Perfrom a pre-cehck to make sure that there are enough free nodes of the // Perfrom a pre-cehck to make sure that there are enough free nodes of the
// proper types. Returns 1 if the proper types exist, 0 if they do not. // proper types. Returns 1 if the proper types exist, 0 if they do not.
// TODO - move away from using global variables // TODO - move away from using global variables
int type_precheck() { int type_precheck(int round) {
cout << "Type precheck:" << endl; cout << "Type precheck, round " << round << ":" << endl;
bool ok = true; bool ok = true;
/*
* Tailor our error messages, depending on the round - the first round of
* the precheck is looking for available pnodes, the second is looking for
* sutiable nodes (ie. at least one vnode could map to it)
*/
char *round_str;
if (round == 1) {
round_str = "available";
} else {
round_str = "suitable";
}
// First, check the regular types // First, check the regular types
for (name_count_map::iterator vtype_it=vtypes.begin(); for (name_count_map::iterator vtype_it=vtypes.begin();
vtype_it != vtypes.end();++vtype_it) { vtype_it != vtypes.end();++vtype_it) {
...@@ -426,16 +437,16 @@ int type_precheck() { ...@@ -426,16 +437,16 @@ int type_precheck() {
// Check to see if there were any pnodes of the type at all // Check to see if there were any pnodes of the type at all
tb_ptype_map::iterator ptype_it = ptypes.find(vtype_it->first); tb_ptype_map::iterator ptype_it = ptypes.find(vtype_it->first);
if (ptype_it == ptypes.end()) { if (ptype_it == ptypes.end()) {
cout << " *** No physical nodes of type " << vtype_it->first cout << " *** No " << round_str << " physical nodes of type "
<< " found" << endl; << vtype_it->first << " found" << endl;
ok = false; ok = false;
} else { } else {
// Okay, there are some - are there enough? // Okay, there are some - are there enough?
if (ptype_it->second->pnode_slots() < vtype_it->second) { if (ptype_it->second->pnode_slots() < vtype_it->second) {
cout << " *** " << vtype_it->second << " nodes of type " << cout << " *** " << vtype_it->second << " nodes of type " <<
vtype_it->first << " requested, but only " vtype_it->first << " requested, but only " <<
<< ptype_it->second->pnode_slots() << " suitable nodes of " ptype_it->second->pnode_slots() << " " << round_str <<
<< "type " << vtype_it->first<< " found" << endl; " nodes of type " << vtype_it->first<< " found" << endl;
ok = false; ok = false;
} }
// Okay, there are enough - but are we allowed to use them? // Okay, there are enough - but are we allowed to use them?
...@@ -476,8 +487,8 @@ int type_precheck() { ...@@ -476,8 +487,8 @@ int type_precheck() {
} }
if (!found_match) { if (!found_match) {
cout << " *** No physical nodes can satisfy vclass " << cout << " *** No " << round_str <<
vclass_it->first << endl; " physical nodes can satisfy vclass " << vclass_it->first << endl;
ok = false; ok = false;
} }
} }
...@@ -899,7 +910,7 @@ int main(int argc,char **argv) { ...@@ -899,7 +910,7 @@ int main(int argc,char **argv) {
*/ */
// Run the type precheck // Run the type precheck
if (!type_precheck()) { if (!type_precheck(1)) {
exit(EXIT_UNRETRYABLE); exit(EXIT_UNRETRYABLE);
} }
...@@ -917,17 +928,12 @@ int main(int argc,char **argv) { ...@@ -917,17 +928,12 @@ int main(int argc,char **argv) {
* we mave to run the type precheck before the mapping precheck. And, * we mave to run the type precheck before the mapping precheck. And,
* the type precheck is very fast. * the type precheck is very fast.
*/ */
if (!type_precheck()) { if (!type_precheck(2)) {
exit(EXIT_UNRETRYABLE); exit(EXIT_UNRETRYABLE);
} }
} }
#endif #endif
// Run the type precheck
if (!type_precheck()) {
exit(EXIT_UNRETRYABLE);
}
// Bomb out early if we're only doing the prechecks // Bomb out early if we're only doing the prechecks
if (prechecks_only) { if (prechecks_only) {
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
......
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