-
Notifications
You must be signed in to change notification settings - Fork 178
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
feat(api, robot-server): set sent runtime values and report parameters in analysis #14735
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## edge #14735 +/- ##
==========================================
- Coverage 67.19% 67.19% -0.01%
==========================================
Files 2495 2495
Lines 71520 71460 -60
Branches 9020 9039 +19
==========================================
- Hits 48056 48015 -41
+ Misses 21342 21312 -30
- Partials 2122 2133 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
🙌 🎉 So exciting!! This looks really good!
Just have a few nitpicks
if isinstance(value, float) and parameter_type is int and value.is_integer(): | ||
validated_value = int(value) | ||
else: | ||
validated_value = value |
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.
if value = 123.4 and the parameter type is int
then this will assign 123.4 as the validated value instead of raising an error.
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.
Oh, is this value then going to go through validate_type
and will then raise an error?
In that case, can we add this explanation in the docstring?
validated_value: Union[float, bool, str] | ||
if isinstance(value, bool): | ||
raise ParameterValueError("Cannot send a boolean value as an enum type") | ||
elif isinstance(value, int): | ||
validated_value = float(value) | ||
else: | ||
validated_value = value | ||
return validated_value |
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.
Why is this necessary? I think pydantic will just accept the int without any issues. As for the boolean value, wouldn't that be covered by the conversion you do in as_protocol_engine_type
?
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 could have sworn I was getting mypy errors for this, but removing it has no issue. Guess it was the same memory I had of putting in the set_parameters method
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.
Thanks for making the changes!
…s in analysis (#14735) Runtime parameter values sent via protocols endpoint will now be set, and all parameters and values used are now reported in analysis.
Overview
Completes the analysis portion of AUTH-222.
This PR hooks up the runtime parameter API code to setting sent override values as well as reporting the parameters in the analysis summary, using the Pydantic models created in #14638 and #14718.
To report the parameters in analysis, a new method was added to the definitions to convert them into the Pydantic models. This method can then be used by the
ParameterContext
to get a list of all defined definitions. In order to have access to these after run execution, the ProtocolRunner was refactored to own this class so we can have access to it after the parameters are parsed and validated.A method to set the parameters was also added and hooked up to
excute
andrun_python
, which will validate and set all sent parameters to be used in the protocol, for both analysis and execution.Test Plan
Used this protocol and checked the analysis result to make sure all parameters were being properly reported.
and in the analysis
Changelog
protocols
endpoint (and theruns
in the future`) to set defined parametersReview requests
Risk assessment
Low, no significant architecture changes and mostly adding real data to stubs.