Skip to content

Conversation

FranckLecuyer
Copy link
Contributor

No description provided.

@FranckLecuyer FranckLecuyer changed the title [WIP] Stop sa computation fixes Stop sa computation fixes Mar 10, 2021
Add some tests for computation cancel requests

Signed-off-by: Franck LECUYER <[email protected]>
…status remain when error occur'

Signed-off-by: Franck LECUYER <[email protected]>
@FranckLecuyer FranckLecuyer force-pushed the stop-in-progress-sa-fixes branch from 5594bdc to 2ee713b Compare March 12, 2021 12:24
Mono<Network> network = getNetwork(networkUuid);
if (otherNetworkUuids.isEmpty()) {
return network;
} else {
Mono<List<Network>> otherNetworks = Flux.fromIterable(otherNetworkUuids)
.flatMap(this::getNetwork)
.flatMap(uuid -> {
if (resultUuid != null && cancelComputationRequests.get(resultUuid) != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually all these are done in parallel so can you remove this check which is not useful ? sorry for asking to add it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return Mono.empty();
}

LOGGER.info("Loading networks");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logs should happen when the operation is performed, not when the mono is created. There is the same problem for other log statements in this code, we should fix them all

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


Mono<Network> network = getNetwork(context.getNetworkUuid(), context.getOtherNetworkUuids(), resultUuid);

if (resultUuid != null && cancelComputationRequests.get(resultUuid) != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this "if" happens almost at the same time as the previous one, it's not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

CompletableFuture<SecurityAnalysisResult> future = securityAnalysis.run(VariantManagerConstants.INITIAL_VARIANT_ID, context.getParameters(), n -> tuple.getT2());
if (resultUuid != null) {
futures.put(resultUuid, future);
}
if (resultUuid != null && cancelComputationRequests.get(resultUuid) != null) {
return Mono.empty();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a log to all the short circuit returns because without it, the log will look like this:

Run security analysis on contingency lists: ...
loading resource network
loading resource ...
cancelling 
... tons of network-store-client logs because the operation continues...
...and nothing here to remind us that we didn't run the security analysis

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

87.5% 87.5% Coverage
0.0% 0.0% Duplication

FranckLecuyer and others added 3 commits May 26, 2021 08:32
and conflicts resolution

Signed-off-by: Franck LECUYER <[email protected]>
Resolving conflicts

Signed-off-by: Franck LECUYER <[email protected]>

# Conflicts:
#	src/main/java/org/gridsuite/securityanalysis/server/service/SecurityAnalysisService.java
#	src/main/java/org/gridsuite/securityanalysis/server/service/SecurityAnalysisWorkerService.java
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

84.6% 84.6% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants