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

More robust local service implementation #1383

Open
nkanazawa1989 opened this issue Jan 29, 2024 · 1 comment
Open

More robust local service implementation #1383

nkanazawa1989 opened this issue Jan 29, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@nkanazawa1989
Copy link
Collaborator

nkanazawa1989 commented Jan 29, 2024

Suggested feature

One of the important features in the Qiskit Expeirments is the result data management through the Experiment service. We have local implementation of this in qiskit_experiments.test.fake_service, however, the implementation details are different in many places from one by IBM.

For example, when you retrieve the data from the service, it returns a list of AnalysisResult object which is implemented in https://github.com/Qiskit-Extensions/qiskit-experiments/blob/32474382ea28e36a7ffe5253d87e1aaa7e0c1a40/qiskit_experiments/framework/experiment_data.py#L1492-L1494

In the IBM service, the result object is created from the data dictionary. This dictionary has two fields value and _value. Non underscore one is a displayed value in the IBM experiment website, which is created from the original data when the result object is created for save https://github.com/Qiskit-Extensions/qiskit-experiments/blob/32474382ea28e36a7ffe5253d87e1aaa7e0c1a40/qiskit_experiments/framework/analysis_result.py#L186-L188
while the other is original data serialized and deserialized by our custom JSON encoder and decoder.

This mechanism is not implemented in the fake service, and accessing _value value raises the key error (likely this pattern is not tested):
https://github.com/Qiskit-Extensions/qiskit-experiments/blob/32474382ea28e36a7ffe5253d87e1aaa7e0c1a40/qiskit_experiments/framework/experiment_data.py#L1505

Apart from this, current fake service doesn't implement serialization and deserialization mechanism (it just stores raw data in the data frame). Form the local client viewpoint handling of data behind the scene doesn't matter, however, for the unit test purpose this could produce different situation from the online service.

This makes me think we need to promote the fake service to the qiskit_experiments.database_service.local_service so that the end users and test agent can reliably use (note that IBM service also implements local mode, but this is not necessary in my opinion). To achieve this, we need to define the protocol (or abstract service class) in this package, and let IBM project rewrite their service class based off of the protocol. Qiskit Expeirment should implement reliable local service as a reference implementation. This resembles the Qiskit Backend model / Qiskit IBM Backend.

@coruscating
Copy link
Collaborator

As discussed in the meeting, it would be good to have the same type of abstract class for interfacing with the provider so we don't directly edit ExperimentData when provider methods change. @ItamarGoldman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants