mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
1191 monte exit code (#1196)
* #1191 refactor monte exit_string_status and fix char*[] array values closes #1191
This commit is contained in:
parent
5b3770d15a
commit
087c98ce01
@ -21,6 +21,18 @@
|
||||
%template(MonteVarVector) std::vector<Trick::MonteVar*>;
|
||||
#endif
|
||||
|
||||
/* strings to match ExitStatus enum in MonteRun */
|
||||
static const char* MC_exit_status_string[] = {
|
||||
"Incomplete",
|
||||
"Complete",
|
||||
"Failed",
|
||||
"Core Dumped",
|
||||
"Timed Out",
|
||||
"No Permission to Output Directory",
|
||||
"Bad Input",
|
||||
"Unrecognized Return Code"
|
||||
} ;
|
||||
|
||||
namespace Trick {
|
||||
|
||||
/**
|
||||
@ -36,7 +48,10 @@ namespace Trick {
|
||||
class MonteRun {
|
||||
|
||||
public:
|
||||
/** Details the manner in which this run exited. */
|
||||
/**
|
||||
* Details the manner in which this run exited. Update
|
||||
* Strings in MC_exit_status_string above when editing enum.
|
||||
*/
|
||||
enum ExitStatus {
|
||||
MC_RUN_INCOMPLETE, /**< not completed */
|
||||
MC_RUN_COMPLETE, /**< process completed with exit status zero */
|
||||
@ -78,6 +93,8 @@ namespace Trick {
|
||||
end_time(0),
|
||||
exit_status(MC_RUN_INCOMPLETE) {}
|
||||
|
||||
/* return exit status string that matches enum value */
|
||||
const char* exit_status_string() const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -72,4 +72,8 @@ Trick::MonteCarlo::~MonteCarlo() {
|
||||
connection_device.error_handler = NULL ;
|
||||
}
|
||||
|
||||
const char* Trick::MonteRun::exit_status_string() const {
|
||||
return MC_exit_status_string[exit_status];
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,10 +60,8 @@ 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", "Bad Input" } ;
|
||||
|
||||
fprintf(*fp,
|
||||
"\nMonte Carlo complete: %u runs (%zu successful) (%zu non-zero exit status) (%zu errors) (%u out of range)\n",
|
||||
@ -109,7 +107,7 @@ void Trick::MonteCarlo::print_statistics(FILE** fp) {
|
||||
fprintf(*fp, "\nThe following runs failed to complete:\n");
|
||||
for (const MonteRun* run : error_runs) {
|
||||
fprintf(*fp, "RUN_%05d MonteRun::ExitStatus = %s (%d)\n", run->id,
|
||||
exit_status_string[run->exit_status], run->exit_status);
|
||||
run->exit_status_string(), run->exit_status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user