Skip to content

Commit

Permalink
Bug/fix for circuits api error (#1775)
Browse files Browse the repository at this point in the history
* Stringify executor block for circuit info

* minor bug & test case fix for qelecton feature

* minor fix to handle pydantic version changes

* Fix for pydantic version conflict

---------

Co-authored-by: mpvgithub <[email protected]>
Co-authored-by: Manjunath PV <[email protected]>
  • Loading branch information
3 people authored Sep 12, 2023
1 parent 7611721 commit a0ca914
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 29 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UNRELEASED]

### Fixed

- Formatted executor block under Qelectron job details to handle any class-type values
- Fixed test-cases to handle latest pydantic version changes

### Changed

- Raised the minimum version of Pydantic from 1.10.1 to 2.1.1 in `requirements.txt`
Expand Down
4 changes: 3 additions & 1 deletion covalent_ui/api/v1/data_layer/electron_dal.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ def get_job_detail(self, dispatch_id, electron_id, job_id) -> JobDetailsResponse
"name": selected_job["qexecutor"]["name"]
if "qexecutor" in selected_job and "name" in selected_job["qexecutor"]
else None,
"executor": selected_job["qexecutor"] if "qexecutor" in selected_job else None,
"executor": str(selected_job["qexecutor"])
if "qexecutor" in selected_job
else None,
},
}

Expand Down
2 changes: 1 addition & 1 deletion covalent_ui/api/v1/models/electrons_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ElectronResponse(BaseModel):
runtime: Union[int, None] = None
description: Union[str, None] = None
qelectron_data_exists: bool = False
qelectron: dict = None
qelectron: Union[dict, None] = None


class ElectronFileResponse(BaseModel):
Expand Down
5 changes: 0 additions & 5 deletions tests/covalent_ui_backend_tests/end_points/summary_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,6 @@ def test_list_invalid_count():
query_data=test_data["request_data"]["query"],
)
assert response.status_code == test_data["status_code"]
if "response_data" in test_data:
api_response = response.json()
mock_response = test_data["response_data"]
# del api_response["detail"][0]["url"]
assert api_response == mock_response


def test_list_search():
Expand Down
23 changes: 1 addition & 22 deletions tests/covalent_ui_backend_tests/utils/assert_data/electrons.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,28 +277,7 @@ def seed_electron_data():
},
"executor": {
"name": "Simulator",
"executor": {
"persist_data": True,
"qnode_device_import_path": "pennylane.devices.default_qubit:DefaultQubit",
"qnode_device_shots": None,
"qnode_device_wires": 5,
"pennylane_active_return": True,
"device": "default.qubit",
"parallel": "thread",
"workers": 10,
"shots": 0,
"name": "Simulator",
"_backend": {
"persist_data": True,
"qnode_device_import_path": "pennylane.devices.default_qubit:DefaultQubit",
"qnode_device_shots": None,
"qnode_device_wires": 5,
"pennylane_active_return": True,
"device": "default.qubit",
"num_threads": 10,
"name": "BaseThreadPoolQExecutor",
},
},
"executor": "{'persist_data': True, 'qnode_device_import_path': 'pennylane.devices.default_qubit:DefaultQubit', 'qnode_device_shots': None, 'qnode_device_wires': 5, 'pennylane_active_return': True, 'device': 'default.qubit', 'parallel': 'thread', 'workers': 10, 'shots': 0, 'name': 'Simulator', '_backend': {'persist_data': True, 'qnode_device_import_path': 'pennylane.devices.default_qubit:DefaultQubit', 'qnode_device_shots': None, 'qnode_device_wires': 5, 'pennylane_active_return': True, 'device': 'default.qubit', 'num_threads': 10, 'name': 'BaseThreadPoolQExecutor'}}",
},
},
},
Expand Down

0 comments on commit a0ca914

Please sign in to comment.