Monte carlo AttributeError's caused by bad configuration still returns zero in master sim #269

The return code from parsing the monte carlo input was always set to zero and not checked.
Retured the return code from parsing the input. Added an exit if the input was not parsed
correctly.
This commit is contained in:
Alex Lin 2016-07-26 13:40:38 -05:00
parent 2112dac2e0
commit bc6cb589e3
6 changed files with 16 additions and 6 deletions

View File

@ -36,6 +36,7 @@ namespace Trick {
CORED, /**< core dumped */
TIMEDOUT, /**< timed out */
NO_PERM, /**< could not write output files */
BAD_INPUT, /**< problem parseing monte carlo input */
UNKNOWN /**< unrecognized return code */
};

View File

@ -141,12 +141,13 @@ int Trick::IPPython::init() {
//Command to parse the given string.
int Trick::IPPython::parse(std::string in_string) {
int ret ;
pthread_mutex_lock(&ip_mutex);
in_string += "\n" ;
PyRun_SimpleString(in_string.c_str()) ;
ret = PyRun_SimpleString(in_string.c_str()) ;
pthread_mutex_unlock(&ip_mutex);
return 0 ;
return ret ;
}

View File

@ -14,8 +14,7 @@
extern Trick::InputProcessor * the_ip ;
extern "C" int ip_parse(const char * in_string) {
the_ip->parse(in_string) ;
return(0) ;
return the_ip->parse(in_string) ;
}
/**

View File

@ -60,7 +60,7 @@ void Trick::MonteCarlo::shutdown_slaves() {
void Trick::MonteCarlo::print_statistics(FILE** fp) {
static const char *exit_status_string[] =
{"Incomplete", "Complete", "Core Dumped", "Timed Out",
"No Permission to Output Directory" } ;
"No Permission to Output Directory", "Bad Input" } ;
fprintf(*fp,
"\nMonte Carlo complete: %u runs (%zu successful) (%zu errors) (%u out of range)\n",

View File

@ -68,6 +68,13 @@ void Trick::MonteCarlo::receive_slave_results() {
}
resolve_run(curr_slave, MonteRun::UNKNOWN);
break;
case MonteRun::BAD_INPUT:
if (verbosity >= ERROR) {
message_publish(MSG_ERROR, "Monte [Master] %s:%d reported bad input for run %d. Skipping.\n",
curr_slave->machine_name.c_str(), curr_slave->id, curr_slave->current_run->id) ;
}
resolve_run(curr_slave, MonteRun::BAD_INPUT);
break;
case MonteRun::CORED:
if (verbosity >= ERROR) {
message_publish(MSG_ERROR, "Monte [Master] %s:%d reported core dump for run %d. Skipping.\n",

View File

@ -99,7 +99,9 @@ int Trick::MonteCarlo::slave_process_run() {
} else {
input[size] = '\0';
ip_parse(input);
if ( ip_parse(input) != 0 ) {
exit(MonteRun::BAD_INPUT);
}
/** <ul><li> Create the run directory. */
std::string output_dir = command_line_args_get_output_dir();