Add dynamic shapes for inputs and outputs#62
Merged
Conversation
Introduce custom exception classes (PhiloteValidationError, PhiloteServerError), parameter validation in discipline base classes, gRPC error propagation via context.abort() in all server RPC methods, and client-side input validation with gRPC error wrapping. Fix missing space in RemoteImplicitComponent error message.
Cover all previously uncovered error handling paths: PhiloteValidationError and general Exception branches in server RPC methods, gRPC error wrapping in all client methods, and num_par_fd validation in OpenMDAO components.
Disciplines can now declare variables with `dynamic_shape=True` in `add_input`/`add_output`, indicating that the client is allowed to set the variable's shape at runtime. A new `SetVariableShapes` gRPC RPC lets clients send resolved shapes after querying variable definitions. Protocol changes: - Added `bool dynamic_shape` field to `VariableMetaData` in data.proto - Added `SetVariableShapes` streaming RPC to DisciplineService Server: - `add_input`/`add_output` accept `dynamic_shape` parameter - `SetVariableShapes` handler validates and updates shapes, including implicit residual entries - `preallocate_inputs` raises if a dynamic variable has no shape set Client: - `set_variable_shape`, `send_variable_shapes`, `get_dynamic_variables` helper methods OpenMDAO bindings: - Dynamic-shape variables map to `shape_by_conn=True` automatically - Resolved shapes are sent to the server before partials setup Includes FlexibleDiscipline example and 22 new tests (100% coverage).
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dynamic_shape=Trueso that the client can set the shape at runtime (Add dynamic shapes for inputs and outputs Philote-MDO#6)bool dynamic_shapefield toVariableMetaDataindata.protoand a newSetVariableShapesstreaming RPC toDisciplineServiceindisciplines.protoshape_by_conn=Trueand send resolved shapes back to the server before partials setupFlexibleDisciplineexample and 22 new tests with 100% code coverageTest plan
pytest tests/)pytest --cov=philote_mdo)