mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 15:26:41 +00:00
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:
parent
2112dac2e0
commit
bc6cb589e3
@ -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 */
|
||||
};
|
||||
|
||||
|
@ -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 ;
|
||||
|
||||
}
|
||||
|
||||
|
@ -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) ;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user