diff --git a/trick_source/sim_services/MonteCarlo/MonteCarlo_funcs.cpp b/trick_source/sim_services/MonteCarlo/MonteCarlo_funcs.cpp
index 107ae65d..c6597608 100644
--- a/trick_source/sim_services/MonteCarlo/MonteCarlo_funcs.cpp
+++ b/trick_source/sim_services/MonteCarlo/MonteCarlo_funcs.cpp
@@ -397,24 +397,15 @@ Trick::MonteRun *Trick::MonteCarlo::get_next_dispatch() {
/**
- While there are remaining runs: */
while (!runs.empty()) {
MonteRun *curr_run = runs.front();
- /**
- If this run hasn't been dispatched before: */
- if (curr_run->num_tries == 0) {
- /**
- If it is in range, return it.
*/
- if (in_range(curr_run)) {
- return curr_run;
- /** - Otherwise, run the pre run jobs and dequeue it. */
- } else {
- if (verbosity >= ALL) {
- message_publish(MSG_WARNING, "Monte [Master] Run %d is out of range and has been skipped.\n", curr_run->id) ;
- }
- prepare_run(curr_run);
- }
- /**
- *
- If this run has been dispatched before, it may have been requeued due to a slave timeout for which the slave
- * later returned results. In such a case, do not dispatch it again (return NULL). Otherwise, return it.
- */
- } else if (curr_run->exit_status == MonteRun::INCOMPLETE) {
+ /**
- If it is in range, return it.
*/
+ if (in_range(curr_run)) {
return curr_run;
+ /** Otherwise, run the pre run jobs and dequeue it. */
+ } else {
+ if (verbosity >= ALL) {
+ message_publish(MSG_WARNING, "Monte [Master] Run %d is out of range and has been skipped.\n", curr_run->id) ;
+ }
+ prepare_run(curr_run);
}
}
return NULL;
diff --git a/trick_source/sim_services/MonteCarlo/MonteCarlo_receive_results.cpp b/trick_source/sim_services/MonteCarlo/MonteCarlo_receive_results.cpp
index 613889c2..998ff55c 100644
--- a/trick_source/sim_services/MonteCarlo/MonteCarlo_receive_results.cpp
+++ b/trick_source/sim_services/MonteCarlo/MonteCarlo_receive_results.cpp
@@ -81,7 +81,14 @@ void Trick::MonteCarlo::handle_run_data(Trick::MonteSlave& slave) {
}
/**
- * - This run may have already been resolved by another slave if
+ *
- Try to remove this run from the queue in case it was requeue by #check_timeouts.
+ * This covers the case in which the master determines that a slave has timed out, requeues
+ * the run, and then the slave reports results.
+ */
+ dequeue_run(slave.current_run);
+
+ /**
+ *
- This run may have already been resolved by another slave if
* this slave was marked as having timed out. If that is the case,
* discard these results.
*/
diff --git a/trick_source/sim_services/MonteCarlo/MonteCarlo_slave.cpp b/trick_source/sim_services/MonteCarlo/MonteCarlo_slave.cpp
index 2fce326b..12d54f40 100644
--- a/trick_source/sim_services/MonteCarlo/MonteCarlo_slave.cpp
+++ b/trick_source/sim_services/MonteCarlo/MonteCarlo_slave.cpp
@@ -16,7 +16,7 @@ int Trick::MonteCarlo::execute_as_slave() {
/**
- On a blocking read, wait for a MonteSlave::Command from the master. */
if (tc_accept(&listen_device, &connection_device) != TC_SUCCESS) {
if (verbosity >= ERROR) {
- message_publish(MSG_ERROR, "Monte [%s:%d] Lost connection to Master.\nShutting down.\n",
+ message_publish(MSG_ERROR, "Monte [%s:%d] Lost connection to Master. Shutting down.\n",
machine_name.c_str(), slave_id) ;
}
slave_shutdown();
@@ -24,7 +24,7 @@ int Trick::MonteCarlo::execute_as_slave() {
int command;
if (tc_read(&connection_device, (char *)&command, (int)sizeof(command)) != (int)sizeof(command)) {
if (verbosity >= ERROR) {
- message_publish(MSG_ERROR, "Monte [%s:%d] Lost connection to Master while receiving instructions.\nShutting down.\n",
+ message_publish(MSG_ERROR, "Monte [%s:%d] Lost connection to Master while receiving instructions. Shutting down.\n",
machine_name.c_str(), slave_id) ;
}
slave_shutdown();
@@ -44,7 +44,7 @@ int Trick::MonteCarlo::execute_as_slave() {
case MonteSlave::SHUTDOWN:
/**
- MonteSlave::SHUTDOWN: Call #slave_shutdown. */
if (verbosity >= INFORMATIONAL) {
- message_publish(MSG_INFO, "Monte [%s:%d] Shutdown command received from Master.\nShutting down.\n",
+ message_publish(MSG_INFO, "Monte [%s:%d] Shutdown command received from Master. Shutting down.\n",
machine_name.c_str(), slave_id) ;
}
slave_shutdown();
@@ -60,7 +60,7 @@ int Trick::MonteCarlo::execute_as_slave() {
default:
/**
- default: Call #slave_shutdown. */
if (verbosity >= ERROR) {
- message_publish(MSG_ERROR, "Monte [%s:%d] Unrecognized command %d received from Master.\nShutting down.\n",
+ message_publish(MSG_ERROR, "Monte [%s:%d] Unrecognized command %d received from Master. Shutting down.\n",
machine_name.c_str(), slave_id, command) ;
}
slave_shutdown();