Skip to content

Commit

Permalink
Call runAsync() in run()
Browse files Browse the repository at this point in the history
  • Loading branch information
yichen88 committed Sep 6, 2017
1 parent 79ac300 commit 2496312
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,19 +260,7 @@ private ImpactAnalysisResult after(Path workingDir, List<Contingency> contingenc

@Override
public ImpactAnalysisResult run(SimulationState state, Set<String> contingencyIds) throws Exception {
checkState(state);

try (CommandExecutor executor = computationManager.newCommandExecutor(DymolaUtil.createEnv(config), WORKING_DIR_PREFIX, config.isDebug())) {
Path workingDir = executor.getWorkingDir();

List<Contingency> contingencies = new ArrayList<>();
Command cmd = before(state, contingencyIds, workingDir, contingencies);

// start execution
ExecutionReport report = executor.start(new CommandExecution(cmd, contingencies.size(), priority, ImmutableMap.of("state", state.getName())));

return after(workingDir, contingencies, report);
}
return runAsync(state, contingencyIds, null).join();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,20 +517,7 @@ private ImpactAnalysisResult after(Path workingDir, List<Contingency> contingenc

@Override
public ImpactAnalysisResult run(SimulationState state, Set<String> contingencyIds) throws Exception {
checkState(state);

try (CommandExecutor executor = computationManager.newCommandExecutor(EurostagUtil.createEnv(config), WORKING_DIR_PREFIX, config.isDebug())) {

Path workingDir = executor.getWorkingDir();

List<Contingency> contingencies = new ArrayList<>();
Command cmd = before(state, contingencyIds, workingDir, contingencies);

// start execution
ExecutionReport report = executor.start(new CommandExecution(cmd, contingencies.size(), priority, ImmutableMap.of("state", state.getName())));

return after(workingDir, contingencies, report);
}
return runAsync(state, contingencyIds, null).join();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,17 +345,7 @@ private CommandExecution createCommandExecution() {

@Override
public StabilizationResult run() throws Exception {
try (CommandExecutor executor = computationManager.newCommandExecutor(EurostagUtil.createEnv(config), WORKING_DIR_PREFIX, config.isDebug())) {

Path workingDir = executor.getWorkingDir();

EurostagContext context = before(workingDir);

// start the execution
ExecutionReport report = executor.start(createCommandExecution());

return after(workingDir, context, report);
}
return runAsync(network.getStateManager().getWorkingStateId()).join();
}

@Override
Expand Down

0 comments on commit 2496312

Please sign in to comment.