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 Any, Dict, Optional 

15 

16from pydantic import Field, conint, constr 

17 

18from braket.schema_common import BraketSchemaBase, BraketSchemaHeader 

19 

20 

21class TaskMetadata(BraketSchemaBase): 

22 """ 

23 The task metadata schema. 

24 

25 Attributes: 

26 braketSchemaHeader (BraketSchemaHeader): Schema header. Users do not need 

27 to set this value. Only default is allowed. 

28 id (str): The ID of the task. For AWS tasks, this is the task ARN. 

29 shots (str): The number of shots for the task 

30 deviceId (str): The ID of the device on which the task ran. 

31 For AWS devices, this is the device ARN. 

32 deviceParameters (Dict[str, Any]): The device parameters of the task. Default is None. 

33 # TODO: replace with device schema 

34 createdAt (str): The timestamp of creation; 

35 the format must be in ISO-8601/RFC3339 string format YYYY-MM-DDTHH:mm:ss.sssZ. 

36 Default is None. 

37 endedAt (str): The timestamp of when the task ended; 

38 the format must be in ISO-8601/RFC3339 string format YYYY-MM-DDTHH:mm:ss.sssZ. 

39 Default is None. 

40 status (str): The status of the task. Default is None. 

41 failureReason (str): The failure reason of the task. Default is None. 

42 

43 Examples: 

44 >>> TaskMetadata(id="task_id", shots=100, deviceId="device_id") 

45 

46 """ 

47 

48 _TASK_METADATA_HEADER = BraketSchemaHeader(name="braket.task_result.task_metadata", version="1") 

49 

50 braketSchemaHeader: BraketSchemaHeader = Field( 

51 default=_TASK_METADATA_HEADER, const=_TASK_METADATA_HEADER 

52 ) 

53 id: constr(min_length=1) 

54 shots: conint(ge=0) 

55 deviceId: constr(min_length=1) 

56 deviceParameters: Optional[Dict[str, Any]] # TODO: replace with device schema 

57 createdAt: Optional[constr(min_length=1, max_length=24)] 

58 endedAt: Optional[constr(min_length=1, max_length=24)] 

59 status: Optional[constr(min_length=1, max_length=20)] 

60 failureReason: Optional[constr(min_length=1)]