Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# Copyright 2019-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"). You 

4# may not use this file except in compliance with the License. A copy of 

5# the License is located at 

6# 

7# http://aws.amazon.com/apache2.0/ 

8# 

9# or in the "license" file accompanying this file. This file is 

10# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 

11# ANY KIND, either express or implied. See the License for the specific 

12# language governing permissions and limitations under the License. 

13 

14from typing import List, Optional, Tuple 

15 

16from pydantic import BaseModel, Field 

17 

18from braket.device_schema.device_execution_window import DeviceExecutionWindow 

19from braket.schema_common import BraketSchemaBase, BraketSchemaHeader 

20 

21 

22class DeviceCost(BaseModel): 

23 

24 """ 

25 This class provides the details on the cost of a device. 

26 

27 Attributes: 

28 price: Price of the device in terms of US dollars 

29 unit: unit for charging the price, eg: minute, hour, task [price per task] 

30 

31 Examples: 

32 >>> import json 

33 >>> input_json = { 

34 ... "price": 0.25, 

35 ... "unit": "minute" 

36 ... } 

37 >>> DeviceCost.parse_raw(json.dumps(input_json)) 

38 """ 

39 

40 price: float 

41 unit: str 

42 

43 

44class DeviceDocumentation(BaseModel): 

45 """ 

46 This class provides the device documentations like image, summary of it and external documentation. 

47 

48 Attributes: 

49 imageUrl: url for the image of the device 

50 summary: brief description on the device 

51 externalDocumentationUrl: link to provide any useful information to the users. 

52 

53 Examples: 

54 >>> import json 

55 >>> input_json = { 

56 ... "imageUrl": "image_url", 

57 ... "summary": "Summary on the device", 

58 ... "externalDocumentationUrl": "exter doc link", 

59 ... } 

60 >>> DeviceDocumentation.parse_raw(json.dumps(input_json)) 

61 """ 

62 

63 imageUrl: Optional[str] 

64 summary: Optional[str] 

65 externalDocumentationUrl: Optional[str] 

66 

67 

68class DeviceServiceProperties(BraketSchemaBase): 

69 """ 

70 This class defines the common service properties for each device. 

71 

72 Attributes: 

73 executionWindows: List of the executionWindows, it tells us which days the device can 

74 execute a task. 

75 shotsRange: range of the shots for a given device. 

76 

77 Examples: 

78 >>> import json 

79 >>> input_json = { 

80 ... "braketSchemaHeader": { 

81 ... "name": "braket.device_schema.device_service_properties", 

82 ... "version": "1", 

83 ... }, 

84 ... "executionWindows": [ 

85 ... { 

86 ... "executionDay": "Everyday", 

87 ... "windowStartHour": "1966280412345.6789", 

88 ... "windowEndHour": "1966280414345.6789", 

89 ... } 

90 ... ], 

91 ... "shotsRange": [1,10], 

92 ... "deviceCost": { 

93 ... "price": 0.25, 

94 ... "unit": "minute" 

95 ... }, 

96 ... "deviceDocumentation": { 

97 ... "imageUrl": "image_url", 

98 ... "summary": "Summary on the device", 

99 ... "externalDocumentationUrl": "exter doc link", 

100 ... }, 

101 ... "deviceLocation": "us-east-1" 

102 ... } 

103 >>> DeviceServiceProperties.parse_raw_schema(json.dumps(input_json)) 

104 

105 """ 

106 

107 _PROGRAM_HEADER = BraketSchemaHeader( 

108 name="braket.device_schema.device_service_properties", version="1" 

109 ) 

110 braketSchemaHeader: BraketSchemaHeader = Field(default=_PROGRAM_HEADER, const=_PROGRAM_HEADER) 

111 executionWindows: List[DeviceExecutionWindow] 

112 shotsRange: Tuple[int, int] 

113 deviceCost: Optional[DeviceCost] 

114 deviceDocumentation: Optional[DeviceDocumentation] 

115 deviceLocation: Optional[str]