-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export execution details #1193
Export execution details #1193
Conversation
Signed-off-by: Philippe Edwards <[email protected]>
Signed-off-by: Philippe Edwards <[email protected]>
Signed-off-by: Philippe Edwards <[email protected]>
Signed-off-by: Philippe Edwards <[email protected]>
Signed-off-by: Philippe Edwards <[email protected]>
Signed-off-by: Philippe Edwards <[email protected]>
Signed-off-by: Philippe Edwards <[email protected]>
Part of this PR can actually make debugging harder because you lose access to the stack trace. Should I add a business error log in the catch to log the error and its stack trace? |
… the information Signed-off-by: Philippe Edwards <[email protected]>
Added a business error |
@@ -66,8 +65,8 @@ public RaoResult deserialize(JsonParser jsonParser, DeserializationContext deser | |||
raoResult.setComputationStatus(deserializeStatus(jsonParser.nextTextValue())); | |||
break; | |||
|
|||
case OPTIMIZATION_STEPS_EXECUTED: | |||
raoResult.setOptimizationStepsExecuted(deserializeOptimizedStepsExecuted(jsonParser.nextTextValue())); | |||
case OPTIMIZATION_STEPS_EXECUTED, EXECUTION_DETAILS: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be handled as a version increment, with a checkDeprecatedField ?
|
||
if (!(raoResult instanceof FailedRaoResultImpl)) { | ||
OptimizationStepsExecuted optimizationStepsExecuted = raoResult.getOptimizationStepsExecuted(); | ||
jsonGenerator.writeStringField(OPTIMIZATION_STEPS_EXECUTED, serializeOptimizedStepsExecuted(optimizationStepsExecuted)); | ||
jsonGenerator.writeStringField(EXECUTION_DETAILS, raoResult.getExecutionDetails()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXECUTION_DETAILS written twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this was not caught by a unit test, I'll add one
assertEquals("The RaoResult object should not be modified outside of its usual routine", exception.getMessage()); | ||
exception = assertThrows(OpenRaoException.class, () -> output.setOptimizationStepsExecuted(OptimizationStepsExecuted.FIRST_PREVENTIVE_FELLBACK_TO_INITIAL_SITUATION)); | ||
assertEquals("The RaoResult object should not be modified outside of its usual routine", exception.getMessage()); | ||
setUp(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already called with @beforeeach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed!
# Conflicts: # data/rao-result/rao-result-api/src/test/java/com/powsybl/openrao/data/raoresult/api/OptimizationStepsExecutedTest.java # data/rao-result/rao-result-io/rao-result-json/src/main/java/com/powsybl/openrao/data/raoresult/io/json/RaoResultJsonConstants.java # data/rao-result/rao-result-io/rao-result-json/src/main/java/com/powsybl/openrao/data/raoresult/io/json/serializers/RaoResultSerializer.java # data/rao-result/rao-result-io/rao-result-json/src/test/java/com/powsybl/openrao/data/raoresult/io/json/RaoResultJsonConstantsTest.java # ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/result/impl/FailedRaoResultImpl.java # ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/result/impl/FailedRaoResultImplTest.java
Signed-off-by: Thomas Bouquet <[email protected]>
… ordering of states in range action results Signed-off-by: Philippe Edwards <[email protected]>
…/open-rao into export_execution_details Signed-off-by: Philippe Edwards <[email protected]>
Signed-off-by: Godelaine de Montmorillon <[email protected]>
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
Fixes #1137
What kind of change does this PR introduce?
Feature
What is the current behavior?
The RaoResult only exports executed steps (for non failing RAOs)
What is the new behavior (if this is a feature change)?
We now export either the steps executed or a failure reason (as a string). Also surronded the main parts of the RAO to be able to return a FailedRaoResult instead of crashing when an unexpected RuntimeException happens.
Does this PR introduce a breaking change or deprecate an API?
If yes, please check if the following requirements are fulfilled
What changes might users need to make in their application due to this PR? (migration steps)
If you use RaoResult.getOptimizationSteps, you will have to replace it with RaoResult.getExecutionDetails