-
Notifications
You must be signed in to change notification settings - Fork 320
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
Add Subscribers from config #1365
Add Subscribers from config #1365
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1365 +/- ##
==========================================
+ Coverage 73.08% 73.15% +0.06%
==========================================
Files 79 79
Lines 9134 9155 +21
==========================================
+ Hits 6676 6697 +21
Misses 2458 2458 |
Should the plottr link be to https://github.com/kouwenhovenlab/plottr or https://github.com/wpfff/plottr ? |
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.
As discussed inline I would change the name of the test helper class,
|
||
VALUE = Union[str, Number, List, ndarray, bool] | ||
|
||
|
||
class TestSubscriber(): |
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 would suggest not calling this class Test... since it's not actually a test. \
This works fine at the moment because pytest only discovers methods starting with test
inside such a class and only if there is no init method but it's still potentially confusing
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.
good point!
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.
Super cool!
One thing: example notebook does not open inside github, doe sit contain something that github cannot digest?
@contextmanager | ||
def default_config(): | ||
def default_config(user_config: Optional[str]=None): | ||
""" | ||
Context manager to temporarily establish default config settings. | ||
This is achieved by overwritting the config paths of the user-, | ||
environment-, and current directory-config files with the path of the | ||
config file in the qcodes repository. |
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.
do empty strings assigned below to all the file name attributes mean the same as "the path of the config file in the qcodes repository"? I am not sure i'm following what's going on here but at least either the code change is too much or the docstring needs to be adjusted as well.
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.
Maybe these can be None
but it is all good as long as it is not a filename. I chose the empty string to be on the safe side with typing.
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.
ok, implementation is fine. My worry is about consistency of the docstring with the code. Now it claims smth that is not happening in the code, namely "overwritting the config paths of the user-, environment-, and current directory-config files with the path of the config file in the qcodes repository". What's happening now is "overwritting the config paths of the user-, environment-, and current directory-config files with empty strings", right?
Co-Authored-By: Dominik-Vogel <[email protected]>
…s into default_subscription
Merge: 43af32c 393498c Author: Dominik Vogel <[email protected]> Merge pull request #1365 from Dominik-Vogel/default_subscription
qcodes.config.core.db_location = db_location | ||
|
||
assert 'test_subscriber' not in qcodes.config.subscription.subscribers | ||
with pytest.raises(RuntimeError): |
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.
hope that it's fine now, but I recommend next time to also assert the exception message because there are many RuntimeErrors while we are looking for a very specific one.
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 agree. I was running out of time and the test should go in before a certain internal release yesterday.
This PR enables the creation of subscribers for e.g. live plotting by adding them to the config.
There are quite many issue concerning the subscription (i.e. accessing data from different subscriber threads). These are not addressed here :-(.
Take a look at the sample notebook :-)