Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
Shut down train-test executor service (refs #360)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Sep 23, 2013
1 parent 741195b commit ebc9d85
Showing 1 changed file with 16 additions and 12 deletions.
Expand Up @@ -305,20 +305,24 @@ private void runEvaluations(List<List<TrainTestEvalJob>> jobGroups) throws TaskE
int nthreads = getProject().getConfig().getThreadCount();
logger.info("Running evaluator with {} threads", nthreads);
ExecutorService exec = Executors.newFixedThreadPool(nthreads);
for (List<TrainTestEvalJob> group: jobGroups) {
TaskGroupRunner runner = TaskGroupRunner.create(exec);
runner.submitAll(group);
try {
runner.waitForAll();
} catch (ExecutionException e) {
Throwable cause = e.getCause();
if (cause instanceof TrainTestJobException) {
cause = cause.getCause();
try {
for (List<TrainTestEvalJob> group: jobGroups) {
TaskGroupRunner runner = TaskGroupRunner.create(exec);
runner.submitAll(group);
try {
runner.waitForAll();
} catch (ExecutionException e) {
Throwable cause = e.getCause();
if (cause instanceof TrainTestJobException) {
cause = cause.getCause();
}
throw new TaskExecutionException(cause);
} catch (TrainTestJobException e) {
throw new TaskExecutionException(e);
}
throw new TaskExecutionException(cause);
} catch (TrainTestJobException e) {
throw new TaskExecutionException(e);
}
} finally {
exec.shutdown();
}
}

Expand Down

0 comments on commit ebc9d85

Please sign in to comment.