Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e948dcf
extract step execution to commons
benrejebmoh Feb 24, 2026
2cb2968
extract step execution to commons
benrejebmoh Feb 24, 2026
46ec906
Merge remote-tracking branch 'origin/extract-step-execution-to-common…
benrejebmoh Feb 25, 2026
d74468d
Merge remote-tracking branch 'origin/extract-step-execution-to-common…
benrejebmoh Feb 25, 2026
e33e3c3
Merge remote-tracking branch 'origin/extract-step-execution-to-common…
benrejebmoh Feb 25, 2026
b9ad2dd
use abstract class intead of interface
benrejebmoh Mar 2, 2026
4bd8df6
Merge remote-tracking branch 'origin/main' into extract-step-executio…
benrejebmoh Mar 2, 2026
092d188
merge with main
benrejebmoh Mar 2, 2026
e345a58
resolve change request
benrejebmoh Mar 2, 2026
5f3529f
Merge branch 'main' into extract-step-execution-to-commons
benrejebmoh Mar 3, 2026
d9df308
merge with main
benrejebmoh Mar 3, 2026
f21a5ff
add unit tests
benrejebmoh Mar 3, 2026
e0a4e9b
add unit tests and fix sonar issues
benrejebmoh Mar 3, 2026
939a427
set Step and report publishers in the constructor of the parent class
benrejebmoh Mar 4, 2026
52e6c9e
activate gpg
benrejebmoh Mar 4, 2026
b522536
retry gpg
benrejebmoh Mar 4, 2026
1954243
extract step execution to commons
benrejebmoh Feb 24, 2026
6ba3d44
activate gpg
benrejebmoh Mar 4, 2026
4fc49c6
finishing rebase properly
benrejebmoh Mar 4, 2026
ac06bc1
extract step execution to commons
benrejebmoh Feb 24, 2026
76fbd0e
use abstract class intead of interface
benrejebmoh Mar 2, 2026
260bca0
Add debug mode to process execution (#40)
klesaulnier Feb 25, 2026
9c292e2
Implement state estimation result provider and service (#44)
achour94 Feb 25, 2026
ecc04fd
merge with main
benrejebmoh Mar 2, 2026
09a3315
resolve change request
benrejebmoh Mar 2, 2026
d03aaf9
Add endpoint to get all process configs of a given type (#42)
FranckLecuyer Feb 25, 2026
51bcf54
refactor: move modificationUuids from ProcessConfig to ModifyingProce…
KoloMenek Feb 26, 2026
eb9b4a0
Code improvements (#52)
antoinebhs Feb 27, 2026
81d7229
update to gridsuite-dependencies 49 (#53)
klesaulnier Feb 27, 2026
9dbd43e
Add copyright and author comments to SecurityAnalysisService (#54)
antoinebhs Feb 27, 2026
daed7f4
merge with main
benrejebmoh Mar 3, 2026
4c2fc29
add unit tests
benrejebmoh Mar 3, 2026
cc9e831
add unit tests and fix sonar issues
benrejebmoh Mar 3, 2026
5c0fb8e
set Step and report publishers in the constructor of the parent class
benrejebmoh Mar 4, 2026
262dfc4
activate gpg
benrejebmoh Mar 4, 2026
6a89f1d
retry gpg
benrejebmoh Mar 4, 2026
36fc0b6
extract step execution to commons
benrejebmoh Feb 24, 2026
6ae08fb
activate gpg
benrejebmoh Mar 4, 2026
d658a75
finishing rebase properly
benrejebmoh Mar 4, 2026
25e19ea
Merge remote-tracking branch 'origin/extract-step-execution-to-common…
benrejebmoh Mar 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions monitor-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,16 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-commons</artifactId>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.worker.server.dto;
package org.gridsuite.monitor.commons;

import com.powsybl.commons.report.ReportNode;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/**
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons.steps;

import org.gridsuite.monitor.commons.ProcessExecutionStep;
import org.gridsuite.monitor.commons.ReportInfos;
import org.gridsuite.monitor.commons.ResultInfos;
import org.gridsuite.monitor.commons.StepStatus;

import java.time.Instant;
import java.util.UUID;

/**
* @author Mohamed Ben-rejeb <mohamed.ben-rejeb at rte-france.com>
*/
public abstract class AbstractStepExecutor {

protected final StepStatusPublisher stepStatusPublisher;
protected final ReportPublisher reportPublisher;

protected AbstractStepExecutor(StepStatusPublisher stepStatusPublisher, ReportPublisher reportPublisher) {
this.stepStatusPublisher = stepStatusPublisher;
this.reportPublisher = reportPublisher;
}

public void skipStep(
UUID processExecutionId,
UUID stepExecutionId,
String stepTypeName,
int stepOrder,
Instant startedAt
) {
ProcessExecutionStep executionStep = ProcessExecutionStep.builder()
.id(stepExecutionId)
.stepType(stepTypeName)
.stepOrder(stepOrder)
.status(StepStatus.SKIPPED)
.startedAt(startedAt)
.completedAt(Instant.now())
.build();
stepStatusPublisher.updateStepStatus(processExecutionId, executionStep);
}

public void executeStep(
UUID processExecutionId,
UUID stepExecutionId,
String stepTypeName,
int stepOrder,
Instant startedAt,
UUID reportUuid,
ReportInfos reportInfos,
ResultInfos resultInfos,
Runnable stepExecution
) {
ProcessExecutionStep executionStep = ProcessExecutionStep.builder()
.id(stepExecutionId)
.stepType(stepTypeName)
.stepOrder(stepOrder)
.status(StepStatus.RUNNING)
.reportId(reportUuid)
.startedAt(startedAt)
.build();
stepStatusPublisher.updateStepStatus(processExecutionId, executionStep);

try {
stepExecution.run();
reportPublisher.sendReport(reportInfos);
updateStepStatus(
processExecutionId,
stepExecutionId,
stepTypeName,
stepOrder,
startedAt,
reportUuid,
resultInfos,
StepStatus.COMPLETED);
} catch (Exception e) {
updateStepStatus(
processExecutionId,
stepExecutionId,
stepTypeName,
stepOrder,
startedAt,
reportUuid,
resultInfos,
StepStatus.FAILED);
throw e;
}
}

private void updateStepStatus(
UUID processExecutionId,
UUID stepExecutionId,
String stepTypeName,
int stepOrder,
Instant startedAt,
UUID reportUuid,
ResultInfos resultInfos,
StepStatus status
) {
ProcessExecutionStep updated = ProcessExecutionStep.builder()
.id(stepExecutionId)
.stepType(stepTypeName)
.stepOrder(stepOrder)
.status(status)
.resultId(resultInfos != null ? resultInfos.resultUUID() : null)
.resultType(resultInfos != null ? resultInfos.resultType() : null)
.reportId(reportUuid)
.startedAt(startedAt)
.completedAt(Instant.now())
.build();
stepStatusPublisher.updateStepStatus(processExecutionId, updated);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons.steps;

import org.gridsuite.monitor.commons.ReportInfos;

/**
* @author Mohamed Ben-rejeb <mohamed.ben-rejeb at rte-france.com>
*/
@FunctionalInterface
public interface ReportPublisher {

void sendReport(ReportInfos reportInfos);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons.steps;

import org.gridsuite.monitor.commons.ProcessExecutionStep;

import java.util.UUID;

/**
* @author Mohamed Ben-rejeb <mohamed.ben-rejeb at rte-france.com>
*/
@FunctionalInterface
public interface StepStatusPublisher {

void updateStepStatus(UUID executionId, ProcessExecutionStep processExecutionStep);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons.steps;

import com.powsybl.commons.report.ReportNode;
import org.gridsuite.monitor.commons.ReportInfos;
import org.junit.jupiter.api.Test;

import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;

import static org.junit.jupiter.api.Assertions.assertSame;

/**
* @author Mohamed Ben-rejeb <mohamed.ben-rejeb at rte-france.com>
*/
class ReportPublisherTest {

@Test
void sendReportShouldForwardReportInfosToImplementation() {
AtomicReference<ReportInfos> published = new AtomicReference<>();
ReportPublisher reportPublisher = published::set;
ReportInfos reportInfos = new ReportInfos(UUID.randomUUID(), ReportNode.NO_OP);

reportPublisher.sendReport(reportInfos);

assertSame(reportInfos, published.get());
}
}
Loading