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

Resolves #262: add qiskit.backend methods... #363

Merged
merged 44 commits into from
Mar 27, 2018

Conversation

ewinston
Copy link
Contributor

Adds backend methods for getting parameter, calibration, and status similar to how calibration is currently retrieved.

Description

One difference between how this is implemented and configuration, however, is that these methods get query the device whenever the method is called whereas "configuration" only gets it when backends are discovered.

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

for getting parameter, calibration, and status.
@ajavadia ajavadia self-requested a review March 25, 2018 17:02
ajavadia and others added 9 commits March 25, 2018 13:04
1. Added to the quantum program warnings — may of done this incorrect
2. Removed old versions
3. In the configuration we lost the rewrite of the mapping. I agree we
want to update the API but first we need the backend configuration to
work
4. Made the test use quantum program

Still to be done — check why failing some test
— add some test to backend that test the test_basebackends  that test
new methods
@ajavadia
Copy link
Member

@ewinston Thanks Erick. Getting status, configuration, calibration and parameters are indeed best done using the backends module.

I made some linter changes, and marked as approved.

@jaygambetta is creating some extra features such as DeprecationWarnings, to warn users that support for these functions will be dropped from the quantumprogram module.

@jaygambetta
Copy link
Member

jaygambetta commented Mar 25, 2018

@ajavadia @ewinston there is some test i missed that are using the old coupling map. I will try and fix them but we should start to move towards the new coupling_map otherwise it will grow too much to change when in the future.

jaygambetta and others added 12 commits March 25, 2018 21:20
Add a context manager for ensuring the DeprecationWarnings are shown
regardless of the user configuration, as by default they are hidden for
end users (ie. when not on an interpreter).
Revise the strings for the warnings and add entries to the docstrings
for visually showing them on the online docs.
Enable the display of deprecation warnings during qiskit.__init__
instead of via a context manager, for simplifying the deprecated calls
and help providing visual aids for the editors.
@ajavadia
Copy link
Member

@diego-plan9 Can we clarify what the QISKit convention for displaying warnings should be?
Previously I had always used logger.warning(). I can see that warnings.warn() is used here, which could be useful for specifying the warning category, here DeprecationWarning. But I just want to make sure we are consistent.

@diego-plan9
Copy link
Member

Yes, they have a different semantic meaning (and also are treated differently): the short version is that logger.warning (and the rest of logger.xxx() methods) should still be the preferred method for "printing notable events and information for the end user", while warnings are more for "notifying the user that he needs to take action and modify his code" (https://docs.python.org/3/howto/logging.html#when-to-use-logging). In practice it is usually way less common to have the need warnings, but if you feel it's needed we can add some mention of it in our documentation?

ewinston and others added 5 commits March 26, 2018 12:31
These were pylint warnings. The configuration one was due to having a function of
of the same name as a parameter in _backendutils.py.
@jaygambetta
Copy link
Member

@ajavadia @ewinston @diego-plan9 i think we are good.

Fix several backendutils methods raising ConnectionError instead of
LookupError when the entities were not found.
Update the structure of those methods for simplicity and consistency.
Fix commented out code on tests.
@diego-plan9
Copy link
Member

It seems we are indeed! I did some further plumbing at 864a068 (mostly, revising some lines that were commented probably inadvertently and homogenized a bit the family of qiskit.backend functions that retrieve information) - merging, thanks everyone!

@diego-plan9 diego-plan9 merged commit cc2546b into Qiskit:master Mar 27, 2018
@jaygambetta jaygambetta mentioned this pull request Mar 27, 2018
9 tasks
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
* Resolves Qiskit#262: add qiskit.backend methods...

for getting parameter, calibration, and status.

* linting quantumprogram

* Update _backendutils.py

* Update _backendutils.py

* Update _basebackend.py

* Update _qeremote.py

* Update _basebackend.py

* Update _quantumprogram.py

* Update _qeremote.py

* Warning, updates to test, and backencs

1. Added to the quantum program warnings — may of done this incorrect
2. Removed old versions
3. In the configuration we lost the rewrite of the mapping. I agree we
want to update the API but first we need the backend configuration to
work
4. Made the test use quantum program

Still to be done — check why failing some test
— add some test to backend that test the test_basebackends  that test
new methods

* Fixing some spelling and linting

* Spelling fixes

* Lint and spelling

* Linter fixes and some spelling in backendutils

* Cleaning up the coupling_map

@ewinston we decided that all new code should use the new map and all
old code the older one. I have remove the complicated identity map we
inserted :-)

* Renaming configuration as config to fix scope error

* Linting in test

* Linting more

* Fixing the vqe

* More linting

* Update test_quantumprogram.py

* lint errors I found trying to debug the error

* Removing backend from quantum_program test

* Making the backend object based

* Adding tests for the backend object

* Linting tests

* Spelling and linting

* Removing some set_api that are not needed

* set log level to debug

* Removing the api from the tests and needed by the program

* Cleaning up and adding a discover

* correct travis.yml env variable specification

* Removing more old code

* Updated lengths with rename of q_name and c_name

* Lint errors found from travis fixed

* Moving import order to help travis linter

* Revise DeprecationWarnings, add note to docstrings

Add a context manager for ensuring the DeprecationWarnings are shown
regardless of the user configuration, as by default they are hidden for
end users (ie. when not on an interpreter).
Revise the strings for the warnings and add entries to the docstrings
for visually showing them on the online docs.

* Enable deprecation warnings during __init__

Enable the display of deprecation warnings during qiskit.__init__
instead of via a context manager, for simplifying the deprecated calls
and help providing visual aids for the editors.

* fix cyclic import and scope of configuration

These were pylint warnings. The configuration one was due to having a function of
of the same name as a parameter in _backendutils.py.

* fix linter

* remove converting coupling_map to dict

* minor lint fix

* Small fix to the backends.

* Fix LookupErrors, style, comments

Fix several backendutils methods raising ConnectionError instead of
LookupError when the entities were not found.
Update the structure of those methods for simplicity and consistency.
Fix commented out code on tests.
@ewinston ewinston deleted the backend-info branch June 9, 2020 19:51
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.

4 participants