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

Fix for Service Serialization #796

Merged
merged 12 commits into from
May 18, 2022
11 changes: 9 additions & 2 deletions qiskit_experiments/database_service/db_experiment_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1835,8 +1835,6 @@ def __json_encode__(self):
for att in [
"_metadata",
"_source",
"_service",
ItamarGoldman marked this conversation as resolved.
Show resolved Hide resolved
"_backend",
"_id",
"_parent_id",
"_type",
Expand All @@ -1861,6 +1859,15 @@ def __json_encode__(self):
# Handle non-serializable objects
json_value["_jobs"] = self._safe_serialize_jobs()

# the attribute self._service in charge of the connection and communication with the
# experiment db. It doesn't have meaning in the json format so there is no need to serialize
# it.
for att in ["_service", "_backend"]:
json_value[att] = None
value = getattr(self, att)
if value is not None:
LOG.info("%s cannot be JSON serialized", str(type(value)))

return json_value

@classmethod
Expand Down