Skip to content

Commit

Permalink
Updating the execution window hours (#28)
Browse files Browse the repository at this point in the history
* Updating the execution window hours

* Adding updatedAt to deviceProperties

* Updating version to 0.2.6

Co-authored-by: πŸ…β“š <vundela@amazon.com>
  • Loading branch information
kalhanreddy and πŸ…β“š committed Aug 4, 2020
1 parent 5689474 commit 427b488
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 58 deletions.
7 changes: 4 additions & 3 deletions src/braket/device_schema/device_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class DeviceCapabilities(BaseModel):
... "executionWindows": [
... {
... "executionDay": "Everyday",
... "windowStartHour": "1966280412345.6789",
... "windowEndHour": "1966280414345.6789",
... "windowStartHour": "09:00",
... "windowEndHour": "19:00",
... }
... ],
... "shotsRange": [1, 10],
Expand All @@ -56,7 +56,8 @@ class DeviceCapabilities(BaseModel):
... "summary": "Summary on the device",
... "externalDocumentationUrl": "exter doc link",
... },
... "deviceLocation": "us-east-1"
... "deviceLocation": "us-east-1",
... "updatedAt": "2020-06-16T19:28:02.869136"
... },
... "action": {
... "braket.ir.jaqcd.program": {
Expand Down
14 changes: 7 additions & 7 deletions src/braket/device_schema/device_execution_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from datetime import datetime
from datetime import time
from enum import Enum

from pydantic import BaseModel
Expand Down Expand Up @@ -53,20 +53,20 @@ class DeviceExecutionWindow(BaseModel):
Attributes:
executionDay: Days of the execution window
windowStartHour: UTC timestamp of the time when the execution window starts
windowEndHour: UTC timestamp of the time when the execution window ends
windowStartHour: UTC 24-hour format of the time when the execution window starts
windowEndHour: UTC 24-hour format of the time when the execution window ends
Examples:
>>> import json
>>> input_json = {
... "executionDay": "Everyday",
... "windowStartHour": "1966280412345.6789",
... "windowEndHour": "1966280414345.6789",
... "windowStartHour": "09:00",
... "windowEndHour": "19:00",
... }
>>> DeviceExecutionWindow.parse_raw(json.dumps(input_json))
"""

executionDay: ExecutionDay
windowStartHour: datetime
windowEndHour: datetime
windowStartHour: time
windowEndHour: time
13 changes: 10 additions & 3 deletions src/braket/device_schema/device_service_properties_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from datetime import datetime
from typing import List, Optional, Tuple

from pydantic import BaseModel, Field
Expand Down Expand Up @@ -74,6 +75,10 @@ class DeviceServiceProperties(BraketSchemaBase):
executionWindows: List of the executionWindows, it tells us which days the device can
execute a task.
shotsRange: range of the shots for a given device.
deviceCost: cost of the device to run the quantum circuits
deviceDocumentation: provides device specific details like image, summary etc.
deviceLocation: location fo the device
updatedAt: time when the device properties are last updated.
Examples:
>>> import json
Expand All @@ -85,8 +90,8 @@ class DeviceServiceProperties(BraketSchemaBase):
... "executionWindows": [
... {
... "executionDay": "Everyday",
... "windowStartHour": "1966280412345.6789",
... "windowEndHour": "1966280414345.6789",
... "windowStartHour": "09:00",
... "windowEndHour": "09:55",
... }
... ],
... "shotsRange": [1,10],
Expand All @@ -99,7 +104,8 @@ class DeviceServiceProperties(BraketSchemaBase):
... "summary": "Summary on the device",
... "externalDocumentationUrl": "exter doc link",
... },
... "deviceLocation": "us-east-1"
... "deviceLocation": "us-east-1",
... "updatedAt": "2020-06-16T19:28:02.869136"
... }
>>> DeviceServiceProperties.parse_raw_schema(json.dumps(input_json))
Expand All @@ -114,3 +120,4 @@ class DeviceServiceProperties(BraketSchemaBase):
deviceCost: Optional[DeviceCost]
deviceDocumentation: Optional[DeviceDocumentation]
deviceLocation: Optional[str]
updatedAt: datetime
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class DwaveDeviceCapabilities(DeviceCapabilities, BraketSchemaBase):
... "executionWindows": [
... {
... "executionDay": "Everyday",
... "windowStartHour": "1966280412345.6789",
... "windowEndHour": "1966280414345.6789",
... "windowStartHour": "09:00",
... "windowEndHour": "19:00",
... }
... ],
... "shotsRange": [1, 10],
Expand All @@ -83,7 +83,8 @@ class DwaveDeviceCapabilities(DeviceCapabilities, BraketSchemaBase):
... "summary": "Summary on the device",
... "externalDocumentationUrl": "exter doc link",
... },
... "deviceLocation": "us-east-1"
... "deviceLocation": "us-east-1",
... "updatedAt": "2020-06-16T19:28:02.869136"
... },
... "action": {
... "braket.ir.jaqcd.program": {
Expand Down
7 changes: 4 additions & 3 deletions src/braket/device_schema/ionq/ionq_device_capabilities_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class IonqDeviceCapabilities(BraketSchemaBase, DeviceCapabilities):
... "executionWindows": [
... {
... "executionDay": "Everyday",
... "windowStartHour": "1966280412345.6789",
... "windowEndHour": "1966280414345.6789",
... "windowStartHour": "09:00",
... "windowEndHour": "09:05",
... }
... ],
... "shotsRange": [1, 10],
Expand All @@ -62,7 +62,8 @@ class IonqDeviceCapabilities(BraketSchemaBase, DeviceCapabilities):
... "summary": "Summary on the device",
... "externalDocumentationUrl": "external doc link",
... },
... "deviceLocation": "us-east-1"
... "deviceLocation": "us-east-1",
... "updatedAt": "2020-06-16T19:28:02.869136"
... },
... "action": {
... "braket.ir.jaqcd.program": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class RigettiDeviceCapabilities(BraketSchemaBase, DeviceCapabilities):
... "executionWindows": [
... {
... "executionDay": "Everyday",
... "windowStartHour": "1966280412345.6789",
... "windowEndHour": "1966280414345.6789",
... "windowStartHour": "09:00",
... "windowEndHour": "10:00",
... }
... ],
... "shotsRange": [1, 10],
Expand All @@ -61,7 +61,8 @@ class RigettiDeviceCapabilities(BraketSchemaBase, DeviceCapabilities):
... "summary": "Summary on the device",
... "externalDocumentationUrl": "exter doc link",
... },
... "deviceLocation": "us-east-1"
... "deviceLocation": "us-east-1",
... "updatedAt": "2020-06-16T19:28:02.869136"
... },
... "action": {
... "braket.ir.jaqcd.program": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class GateModelSimulatorDeviceCapabilities(BraketSchemaBase, DeviceCapabilities)
... "executionWindows": [
... {
... "executionDay": "Everyday",
... "windowStartHour": "1966280412345.6789",
... "windowEndHour": "1966280414345.6789",
... "windowStartHour": "09:00",
... "windowEndHour": "11:00",
... }
... ],
... "shotsRange": [1, 10],
Expand All @@ -62,7 +62,8 @@ class GateModelSimulatorDeviceCapabilities(BraketSchemaBase, DeviceCapabilities)
... "summary": "Summary on the device",
... "externalDocumentationUrl": "exter doc link",
... },
... "deviceLocation": "us-east-1"
... "deviceLocation": "us-east-1",
... "updatedAt": "2020-06-16T19:28:02.869136",
... },
... "action": {
... "braket.ir.jaqcd.program": {
Expand Down
2 changes: 1 addition & 1 deletion src/braket/ir/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.2.5"
__version__ = "0.2.6"
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ def valid_input():
"version": "1",
},
"executionWindows": [
{
"executionDay": "Everyday",
"windowStartHour": "1966280412345.6789",
"windowEndHour": "1966280414345.6789",
}
{"executionDay": "Everyday", "windowStartHour": "11:00", "windowEndHour": "12:00"}
],
"shotsRange": [1, 10],
"deviceCost": {"price": 0.25, "unit": "minute"},
Expand All @@ -74,6 +70,7 @@ def valid_input():
"externalDocumentationUrl": "exter doc link",
},
"deviceLocation": "us-east-1",
"updatedAt": "2020-06-16T19:28:02.869136",
},
"action": {
"braket.ir.jaqcd.program": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ def valid_input():
"version": "1",
},
"executionWindows": [
{
"executionDay": "Everyday",
"windowStartHour": "1966280412345.6789",
"windowEndHour": "1966280414345.6789",
}
{"executionDay": "Everyday", "windowStartHour": "11:00", "windowEndHour": "12:00"}
],
"shotsRange": [1, 10],
"deviceCost": {"price": 0.25, "unit": "minute"},
Expand All @@ -46,6 +42,7 @@ def valid_input():
"externalDocumentationUrl": "exter doc link",
},
"deviceLocation": "us-east-1",
"updatedAt": "2020-06-16T19:28:02.869136",
},
"action": {
"braket.ir.jaqcd.program": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ def valid_input():
"version": "1",
},
"executionWindows": [
{
"executionDay": "Everyday",
"windowStartHour": "1966280412345.6789",
"windowEndHour": "1966280414345.6789",
}
{"executionDay": "Everyday", "windowStartHour": "11:00", "windowEndHour": "12:00"}
],
"shotsRange": [1, 10],
"deviceCost": {"price": 0.25, "unit": "minute"},
Expand All @@ -46,6 +42,7 @@ def valid_input():
"externalDocumentationUrl": "exter doc link",
},
"deviceLocation": "us-east-1",
"updatedAt": "2020-06-16T19:28:02.869136",
},
"action": {
"braket.ir.jaqcd.program": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ def valid_input():
"version": "1",
},
"executionWindows": [
{
"executionDay": "Everyday",
"windowStartHour": "1966280412345.6789",
"windowEndHour": "1966280414345.6789",
}
{"executionDay": "Everyday", "windowStartHour": "11:00", "windowEndHour": "12:00"}
],
"shotsRange": [1, 10],
"deviceCost": {"price": 0.25, "unit": "minute"},
Expand All @@ -48,6 +44,7 @@ def valid_input():
"externalDocumentationUrl": "exter doc link",
},
"deviceLocation": "us-east-1",
"updatedAt": "2020-06-16T19:28:02.869136",
},
"action": {
"braket.ir.jaqcd.program": {
Expand Down
7 changes: 2 additions & 5 deletions test/braket/device_schema/test_device_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ def valid_input():
"version": "1",
},
"executionWindows": [
{
"executionDay": "Everyday",
"windowStartHour": "1966280412345.6789",
"windowEndHour": "1966280414345.6789",
}
{"executionDay": "Everyday", "windowStartHour": "11:00", "windowEndHour": "12:00"}
],
"shotsRange": [1, 10],
"deviceCost": {"price": 0.25, "unit": "minute"},
Expand All @@ -42,6 +38,7 @@ def valid_input():
"externalDocumentationUrl": "exter doc link",
},
"deviceLocation": "us-east-1",
"updatedAt": "2020-06-16T19:28:02.869136",
},
"action": {
"braket.ir.jaqcd.program": {
Expand Down
4 changes: 2 additions & 2 deletions test/braket/device_schema/test_device_execution_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
def valid_input():
input = {
"executionDay": "Everyday",
"windowStartHour": "1966280412345.6789",
"windowEndHour": "1966280414345.6789",
"windowStartHour": "11:00",
"windowEndHour": "12:00",
}
return input

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ def valid_input():
"version": "1",
},
"executionWindows": [
{
"executionDay": "Everyday",
"windowStartHour": "1966280412345.6789",
"windowEndHour": "1966280414345.6789",
}
{"executionDay": "Everyday", "windowStartHour": "11:00", "windowEndHour": "12:00"}
],
"shotsRange": [1, 10],
"deviceCost": {"price": 0.25, "unit": "minute"},
Expand All @@ -41,6 +37,7 @@ def valid_input():
"externalDocumentationUrl": "exter doc link",
},
"deviceLocation": "us-east-1",
"updatedAt": "2020-06-16T19:28:02.869136",
}
return input

Expand Down

0 comments on commit 427b488

Please sign in to comment.