Merge pull request #988 from nosqlbench/nosqlbench-987-statemodel

fixes for missing errored state in activity
This commit is contained in:
Jonathan Shook 2023-02-03 17:11:01 -06:00 committed by GitHub
commit fdb07bf84f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -106,7 +106,7 @@ public enum RunState {
case Stopping, Finished, Errored -> true;// A motor has exhausted its input, and is finished with its work
default -> false;
};
case Stopping -> (target == Stopped||target==Finished); // A motor was stopped by request before exhausting input
case Stopping -> (target == Stopped||target==Finished||target==Errored); // A motor was stopped by request before exhausting input
case Finished -> (target == Running); // A motor was restarted?
case Errored -> target==Errored;
};

View File

@ -87,10 +87,10 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
activity.setRunState(RunState.Stopping);
motors.forEach(Motor::requestStop);
tally.awaitNoneOther(RunState.Stopped, RunState.Finished);
tally.awaitNoneOther(RunState.Stopped, RunState.Finished, RunState.Errored);
shutdownExecutorService(Integer.MAX_VALUE);
tally.awaitNoneOther(RunState.Stopped, RunState.Finished);
tally.awaitNoneOther(RunState.Stopped, RunState.Finished, RunState.Errored);
activity.setRunState(RunState.Stopped);
logger.info(() -> "stopped: " + this.getActivityDef().getAlias() + " with " + motors.size() + " slots");
@ -349,7 +349,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
return activity;
}
public void notifyException(Thread t, Throwable e) {
public synchronized void notifyException(Thread t, Throwable e) {
logger.debug(() -> "Uncaught exception in activity thread forwarded to activity executor: " + e.getMessage());
this.exception = new RuntimeException("Error in activity thread " + t.getName(), e);
this.requestStopMotors();