Skip to content

Commit

Permalink
review (bis)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-WorkGH committed Apr 9, 2024
1 parent 8301e9d commit 1a7f24d
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,19 @@ private Pair<Network, OpenReacResult> run(VoltageInitRunContext context, UUID re
Network network = voltageInitObserver.observe("network.load", () ->
getNetwork(context.getNetworkUuid(), context.getVariantId()));

AtomicReference<Reporter> rootReporter = new AtomicReference<>(Reporter.NO_OP);
if (context.getReportUuid() != null) {
String rootReporterId = context.getReporterId() == null ? VOLTAGE_INIT_TYPE_REPORT : context.getReporterId() + "@" + context.getReportType();
Reporter rootReporter = new ReporterModel(rootReporterId, rootReporterId);
context.setRootReporter(rootReporter.createSubReporter(context.getReportType(), VOLTAGE_INIT_TYPE_REPORT, VOLTAGE_INIT_TYPE_REPORT, context.getReportUuid().toString()));
rootReporter.set(new ReporterModel(rootReporterId, rootReporterId));
context.setRootReporter(rootReporter.get().createSubReporter(context.getReportType(), VOLTAGE_INIT_TYPE_REPORT, VOLTAGE_INIT_TYPE_REPORT, context.getReportUuid().toString()));
// Delete any previous VoltageInit computation logs
voltageInitObserver.observe("report.delete", () ->
reportService.deleteReport(context.getReportUuid(), context.getReportType()));
}
CompletableFuture<OpenReacResult> future = runVoltageInitAsync(context, network, resultUuid);
if (context.getReportUuid() != null) {
voltageInitObserver.observe("report.send", () ->
reportService.sendReport(context.getReportUuid(), context.getRootReporter()));
reportService.sendReport(context.getReportUuid(), rootReporter.get()));
}

return future == null ? Pair.of(network, null) : Pair.of(network, voltageInitObserver.observeRun("run", future::get));
Expand Down

0 comments on commit 1a7f24d

Please sign in to comment.