Skip to content
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

Merged
merged 17 commits into from
Nov 1, 2018

Conversation

Dominik-Vogel
Copy link
Contributor

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 :-)

@codecov
Copy link

codecov bot commented Nov 1, 2018

Codecov Report

Merging #1365 into master will increase coverage by 0.06%.
The diff coverage is 95.45%.

@@            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

@jenshnielsen
Copy link
Collaborator

Copy link
Collaborator

@jenshnielsen jenshnielsen left a 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():
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point!

Copy link
Contributor

@astafan8 astafan8 left a 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?

qcodes/dataset/data_set.py Outdated Show resolved Hide resolved
@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.
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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?

qcodes/dataset/measurements.py Show resolved Hide resolved
qcodes/dataset/data_set.py Show resolved Hide resolved
@astafan8
Copy link
Contributor

astafan8 commented Nov 1, 2018

@Dominik-Vogel Dominik-Vogel merged commit 34b2037 into microsoft:master Nov 1, 2018
giulioungaretti pushed a commit that referenced this pull request Nov 1, 2018
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):
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@Dominik-Vogel Dominik-Vogel deleted the default_subscription branch November 27, 2018 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants