mirror of
https://github.com/nasa/trick.git
synced 2025-01-21 12:05:13 +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
186e623a25
commit
86b5158e84
@ -133,12 +133,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) ;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,6 +39,7 @@ namespace Trick {
|
||||
CORED, /**< core dumped */
|
||||
TIMEDOUT, /**< timed out */
|
||||
NO_PERM, /**< could not write output files */
|
||||
BAD_INPUT, /**< problem parsing monte carlo input */
|
||||
UNKNOWN /**< unrecognized return code */
|
||||
};
|
||||
|
||||
|
@ -58,7 +58,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",
|
||||
|
@ -100,7 +100,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