Coverage for src/braket/task_result/task_metadata.py : 100%

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
14from typing import Any, Dict, Optional
16from pydantic import conint, constr
18from braket.schema_common.schema_base import BraketSchemaBase
21class TaskMetadata(BraketSchemaBase):
22 """
23 The task metadata schema.
25 Attributes:
26 id (str): the ID of the task. For AWS tasks, this is the task ARN.
27 shots (str): the number of shots for the task
28 deviceId (str): the ID of the device on which the task ran.
29 For AWS devices, this is the device ARN.
30 deviceParameters (Dict[str, Any]): the device parameters of the task. Default is None.
31 # TODO: replace with device schema
32 createdAt (str): the timestamp of creation;
33 the format must be in ISO-8601/RFC3339 string format YYYY-MM-DDTHH:mm:ss.sssZ.
34 Default is None.
35 endedAt (str): the timestamp of when the task ended;
36 the format must be in ISO-8601/RFC3339 string format YYYY-MM-DDTHH:mm:ss.sssZ.
37 Default is None.
38 status (str): the status of the task. Default is None.
39 failureReason (str): the failure reason of the task. Default is None.
41 Examples:
42 >>> TaskMetadata(id="task_id", shots=100, deviceId="device_id")
44 """
46 id: constr(min_length=1)
47 shots: conint(ge=0)
48 deviceId: constr(min_length=1)
49 deviceParameters: Optional[Dict[str, Any]] # TODO: replace with device schema
50 createdAt: Optional[constr(min_length=1, max_length=24)]
51 endedAt: Optional[constr(min_length=1, max_length=24)]
52 status: Optional[constr(min_length=1, max_length=20)]
53 failureReason: Optional[constr(min_length=1)]