-
Notifications
You must be signed in to change notification settings - Fork 301
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
_BaseParameter cached value: add set_cache method, make _save_val method useless, convert raw_value attribute to property #1757
Conversation
Its logic mimic that of the "set" method. Tests are trying to cover all of the cases wrt scale/offset/validation/etc what the "set" method seems to support.
Codecov Report
@@ Coverage Diff @@
## master #1757 +/- ##
==========================================
+ Coverage 67.44% 67.48% +0.04%
==========================================
Files 147 147
Lines 18487 18511 +24
==========================================
+ Hits 12468 12493 +25
+ Misses 6019 6018 -1 |
it contains set_parser conversion, val_mapping conversion, offset handling, scale handling
in-memory, and with a fake instrument
@QCoDeS/core Let's start reviewing of this PR. Please have a look at the tests in order to find out if the captured behavior is the one that we want/like. Please also let know if ideologically/conceptually |
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, IMHO it's a bug in delegate parameter that get_latest on a delegate parameter does not always call get_latest on the parent parameter. This bug is made more obvious by this feature.
At a first glance I don't think there are any changes needed to parameterwithsetpoints
becuase it's a generated method, which sphinx can't discover
... DelegateParameter is to be fixed separately
because it just sets the raw value of cache, it doesn't do anything extra that "from" might imply
_save_val will be deprecated
@QCoDeS/core ready for review again - see the description for the scope and future todo (i'll either make PRs for them shortly after this merge or add cards to our board). |
... and not partial of the _save_val 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.
Only small comments for the code. Will have a look at the tests later
Description
This is needed for setting the cached value of a parameter without calling the meat of it's
set
method (for example, without communicating to the instrument, in case the parameter is part of an instrument).Use cases that this covers for sure:
ToDo/inventory:
wrap_set
method inset_cached
by refactoring-
_from_value_to_raw_valueinto its own method and use both places (also refactor
_from_raw_value_to_valuefrom
wrap_get`, just for fun)set_cache
fromset_latest
_update_cache_from
method that is the only one that updates the_latest
dictionary, and use it inwrap_get
make necessary changes to- a bug discovered whereDelegateParameter
delegate.get_latest()
does not forward the call tosource.get_latest()
which is a bug, issue Bug in DelegateParameter: get_latest and set_cache are not forwarded to source parameter #1782 created - fixing will happen in a separate PR.make necessary changes to- the're none, so nothing to doParameterWithSetpoints
to support itmention somewhere in the documentationwon't do in this PR sinceget_latest
is also not mentioned anywhere_save_val
in qcodes infra, useset_cache
or_update_cache_with
instead;_save_val
deprecation will follow in other PRsraw_value
attribute to a property: on get it returnsself._latest['raw_value']
and on set it only setsself._latest['raw_value']
; deprecation, forbidding settingraw_value
via the property, etc will follow in other PRsraw_value
property inparameter.py
Related tasks for other PRs:
_save_val
_save_val
in all known drivers, try using pre-this-PR API for this, for exampleset
; if not possible, then useset_cache
and bump the dependent qcodes versionqcodes
driversqcodes_contrib_drivers
drivers_save_val
, and define qcodes version when it will be removed_save_val
raw_value
raw_value
viaraw_value
attribute (well, now property) from all known instrument drivers - try to use existing API, for example,get_latest
qcodes
drivers- there seems to be noneqcodes_contrib_drivers
raw_value
viaraw_value
attribute from all known instrument drivers - try using pre-this-PR API for this, for exampleset
; if not possible, then useset_cache
and bump the dependent qcodes versionqcodes
drivers- there seems to be noneqcodes_contrib_drivers
raw_value
via attribute, and define qcodes version when it will be removedraw_value
via attribute, and define qcodes version when it will be removedraw_value
altogetherget_latest()
for_SetParamContext._original_value
, not_latest[
value]
get
andget_timestamp
, addget_raw_value
method toGetLatest
class thing that returnsself._latest['raw_value']
get_cache
/get_cache_raw
/get_cache_timestamp
which aliasesget_latest
, and refactor the meat fromget_latest
to be used in those new methods, also make sure thatparameter.get_latest
gets the doctoring ofGetLatest.get
method_from_*
methods for hypothesis-generated values, parsers, and all the other stufftest_parameter.py
, also use ONLYpytest
there