|
22 | 22 | from enum import Enum
|
23 | 23 | from typing import Any, ClassVar, Optional
|
24 | 24 |
|
| 25 | +import pydantic |
25 | 26 | from botocore.errorfactory import ClientError
|
26 | 27 | from networkx import DiGraph, complete_graph, from_edgelist
|
27 | 28 |
|
@@ -379,13 +380,21 @@ def _populate_properties(self, session: AwsSession) -> None:
|
379 | 380 | self._status = metadata.get("deviceStatus")
|
380 | 381 | self._type = AwsDeviceType(metadata.get("deviceType"))
|
381 | 382 | self._provider_name = metadata.get("providerName")
|
382 |
| - self._properties = BraketSchemaBase.parse_raw_schema(metadata.get("deviceCapabilities")) |
383 |
| - device_poll_interval = self._properties.service.getTaskPollIntervalMillis |
384 |
| - self._poll_interval_seconds = ( |
385 |
| - device_poll_interval / 1000.0 |
386 |
| - if device_poll_interval |
387 |
| - else AwsQuantumTask.DEFAULT_RESULTS_POLL_INTERVAL |
388 |
| - ) |
| 383 | + try: |
| 384 | + self._properties = BraketSchemaBase.parse_raw_schema(metadata.get("deviceCapabilities")) |
| 385 | + device_poll_interval = self._properties.service.getTaskPollIntervalMillis |
| 386 | + self._poll_interval_seconds = ( |
| 387 | + device_poll_interval / 1000.0 |
| 388 | + if device_poll_interval |
| 389 | + else AwsQuantumTask.DEFAULT_RESULTS_POLL_INTERVAL |
| 390 | + ) |
| 391 | + except (pydantic.v1.ValidationError, pydantic.ValidationError): |
| 392 | + warnings.warn( |
| 393 | + f"Unable to determine device capabilities for '{self._arn}'." |
| 394 | + " Please make sure you are using the latest version of amazon-braket-schemas.", |
| 395 | + stacklevel=1, |
| 396 | + ) |
| 397 | + self._poll_interval_seconds = AwsQuantumTask.DEFAULT_RESULTS_POLL_INTERVAL |
389 | 398 | self._topology_graph = None
|
390 | 399 | self._frames = None
|
391 | 400 | self._ports = None
|
|
0 commit comments