Skip to content

Commit

Permalink
test: add integ test for queue_depth (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
virajvchaudhari authored Sep 19, 2023
1 parent 00d514e commit 6c46b72
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/braket/aws/queue_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class QueueDepthInfo:
Represents quantum tasks and hybrid jobs queue depth information.
Attributes:
quantum_task (str, Dict[QueuePriority, str]): number of quantum_tasks waiting
quantum_task (Dict[QueueType, str]): number of quantum_tasks waiting
to run on a device. This includes both 'Normal' and 'Priority' tasks.
For Example, {'quantum_task': {QueueType.NORMAL: '7', QueueType.PRIORITY: '3'}}
job (str): number of hybrid jobs waiting to run on a device. Additionally, for QPUs if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.


from braket.aws import AwsDevice, AwsQuantumJob
from braket.aws.queue_information import HybridJobQueueInfo, QuantumTaskQueueInfo, QueueType
from braket.aws.queue_information import (
HybridJobQueueInfo,
QuantumTaskQueueInfo,
QueueDepthInfo,
QueueType,
)
from braket.circuits import Circuit
from braket.devices import Devices

Expand Down Expand Up @@ -62,3 +66,19 @@ def test_job_queue_position(aws_session):
# assert message
assert queue_information.queue_position is None
assert isinstance(queue_information.message, str)


def test_queue_depth():
device = AwsDevice(Devices.Amazon.SV1)

# call the queue_depth method.
queue_information = device.queue_depth()

# data type validations
assert isinstance(queue_information, QueueDepthInfo)
assert isinstance(queue_information.quantum_task, dict)
assert isinstance(queue_information.job, str)

for key, value in queue_information.quantum_task.items():
assert isinstance(key, QueueType)
assert isinstance(value, str)

0 comments on commit 6c46b72

Please sign in to comment.