Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
178 changes: 173 additions & 5 deletions sample/sagemaker-metrics/2022-09-30/service-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,26 @@
"apiVersion":"2022-09-30",
"endpointPrefix":"metrics.sagemaker",
"protocol":"rest-json",
"protocols":["rest-json"],
"serviceAbbreviation":"SageMaker Metrics",
"serviceFullName":"Amazon SageMaker Metrics Service",
"serviceId":"SageMaker Metrics",
"signatureVersion":"v4",
"signingName":"sagemaker",
"uid":"sagemaker-metrics-2022-09-30"
"uid":"sagemaker-metrics-2022-09-30",
"auth":["aws.auth#sigv4"]
},
"operations":{
"BatchGetMetrics":{
"name":"BatchGetMetrics",
"http":{
"method":"POST",
"requestUri":"/BatchGetMetrics"
},
"input":{"shape":"BatchGetMetricsRequest"},
"output":{"shape":"BatchGetMetricsResponse"},
"documentation":"<p>Used to retrieve training metrics from SageMaker.</p>"
},
"BatchPutMetrics":{
"name":"BatchPutMetrics",
"http":{
Expand All @@ -20,10 +32,29 @@
},
"input":{"shape":"BatchPutMetricsRequest"},
"output":{"shape":"BatchPutMetricsResponse"},
"documentation":"<p>Used to ingest training metrics into SageMaker. These metrics can be visualized in SageMaker Studio and retrieved with the <code>GetMetrics</code> API. </p>"
"documentation":"<p>Used to ingest training metrics into SageMaker. These metrics can be visualized in SageMaker Studio. </p>"
}
},
"shapes":{
"BatchGetMetricsRequest":{
"type":"structure",
"required":["MetricQueries"],
"members":{
"MetricQueries":{
"shape":"MetricQueryList",
"documentation":"<p>Queries made to retrieve training metrics from SageMaker.</p>"
}
}
},
"BatchGetMetricsResponse":{
"type":"structure",
"members":{
"MetricQueryResults":{
"shape":"MetricQueryResultList",
"documentation":"<p>The results of a query to retrieve training metrics from SageMaker.</p>"
}
}
},
"BatchPutMetricsError":{
"type":"structure",
"members":{
Expand Down Expand Up @@ -53,7 +84,7 @@
"members":{
"TrialComponentName":{
"shape":"ExperimentEntityName",
"documentation":"<p>The name of the Trial Component to associate with the metrics.</p>"
"documentation":"<p>The name of the Trial Component to associate with the metrics. The Trial Component name must be entirely lowercase.</p>"
},
"MetricData":{
"shape":"RawMetricDataList",
Expand All @@ -75,15 +106,136 @@
"type":"string",
"max":120,
"min":1,
"pattern":"^[a-zA-Z0-9](-*[a-zA-Z0-9]){0,119}"
"pattern":"^[a-z0-9](-*[a-z0-9]){0,119}"
},
"Integer":{"type":"integer"},
"Long":{"type":"long"},
"Message":{
"type":"string",
"max":2048,
"pattern":".*"
},
"MetricName":{
"type":"string",
"max":255,
"min":1,
"pattern":".+"
},
"MetricQuery":{
"type":"structure",
"required":[
"MetricName",
"ResourceArn",
"MetricStat",
"Period",
"XAxisType"
],
"members":{
"MetricName":{
"shape":"MetricName",
"documentation":"<p>The name of the metric to retrieve.</p>"
},
"ResourceArn":{
"shape":"SageMakerResourceArn",
"documentation":"<p>The ARN of the SageMaker resource to retrieve metrics for.</p>"
},
"MetricStat":{
"shape":"MetricStatistic",
"documentation":"<p>The metrics stat type of metrics to retrieve.</p>"
},
"Period":{
"shape":"Period",
"documentation":"<p>The time period of metrics to retrieve.</p>"
},
"XAxisType":{
"shape":"XAxisType",
"documentation":"<p>The x-axis type of metrics to retrieve.</p>"
},
"Start":{
"shape":"Long",
"documentation":"<p>The start time of metrics to retrieve.</p>",
"box":true
},
"End":{
"shape":"Long",
"documentation":"<p>The end time of metrics to retrieve.</p>",
"box":true
}
},
"documentation":"<p>Specifies a query to retrieve training metrics from SageMaker.</p>"
},
"MetricQueryList":{
"type":"list",
"member":{"shape":"MetricQuery"},
"max":100,
"min":1
},
"MetricQueryResult":{
"type":"structure",
"required":[
"Status",
"XAxisValues",
"MetricValues"
],
"members":{
"Status":{
"shape":"MetricQueryResultStatus",
"documentation":"<p>The status of the metric query.</p>"
},
"Message":{
"shape":"Message",
"documentation":"<p>A message describing the status of the metric query.</p>"
},
"XAxisValues":{
"shape":"XAxisValues",
"documentation":"<p>The values for the x-axis of the metrics.</p>"
},
"MetricValues":{
"shape":"MetricValues",
"documentation":"<p>The metric values retrieved by the query.</p>"
}
},
"documentation":"<p>The result of a query to retrieve training metrics from SageMaker.</p>"
},
"MetricQueryResultList":{
"type":"list",
"member":{"shape":"MetricQueryResult"},
"max":100,
"min":1
},
"MetricQueryResultStatus":{
"type":"string",
"enum":[
"Complete",
"Truncated",
"InternalError",
"ValidationError"
]
},
"MetricStatistic":{
"type":"string",
"enum":[
"Min",
"Max",
"Avg",
"Count",
"StdDev",
"Last"
]
},
"MetricValues":{
"type":"list",
"member":{"shape":"Double"}
},
"Period":{
"type":"string",
"enum":[
"OneMinute",
"FiveMinute",
"OneHour",
"IterationNumber"
]
},
"PutMetricsErrorCode":{
"type":"string",
"enum":[
Expand Down Expand Up @@ -126,11 +278,27 @@
"max":10,
"min":1
},
"SageMakerResourceArn":{
"type":"string",
"max":2048,
"pattern":"arn:aws[a-z\\-]*:sagemaker:[a-z0-9\\-]*:[0-9]{12}:[a-z\\-].*/.*"
},
"Step":{
"type":"integer",
"min":0
},
"Timestamp":{"type":"timestamp"}
"Timestamp":{"type":"timestamp"},
"XAxisType":{
"type":"string",
"enum":[
"IterationNumber",
"Timestamp"
]
},
"XAxisValues":{
"type":"list",
"member":{"shape":"Long"}
}
},
"documentation":"<p>Contains all data plane API operations and data types for Amazon SageMaker Metrics. Use these APIs to put and retrieve (get) features related to your training run.</p> <ul> <li> <p> <a href=\"https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_metrics_BatchPutMetrics.html\">BatchPutMetrics</a> </p> </li> </ul>"
}
4 changes: 4 additions & 0 deletions sample/sagemaker/2017-07-24/service-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -33952,6 +33952,10 @@
"HubAccessConfig":{
"shape":"InferenceHubAccessConfig",
"documentation":"<p>Configuration information for hub access.</p>"
},
"ManifestS3Uri":{
"shape":"S3ModelUri",
"documentation":"<p>The Amazon S3 URI of the manifest file. The manifest file is a CSV file that stores the artifact locations.</p>"
}
},
"documentation":"<p>Specifies the S3 location of ML model data to deploy.</p>"
Expand Down
40 changes: 40 additions & 0 deletions src/sagemaker_core/main/code_injection/shape_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,16 @@
],
"type": "structure",
},
"BatchGetMetricsRequest": {
"members": [{"name": "MetricQueries", "shape": "MetricQueryList", "type": "list"}],
"type": "structure",
},
"BatchGetMetricsResponse": {
"members": [
{"name": "MetricQueryResults", "shape": "MetricQueryResultList", "type": "list"}
],
"type": "structure",
},
"BatchGetRecordError": {
"members": [
{"name": "FeatureGroupName", "shape": "ValueAsString", "type": "string"},
Expand Down Expand Up @@ -9659,13 +9669,41 @@
"member_type": "structure",
"type": "list",
},
"MetricQuery": {
"members": [
{"name": "MetricName", "shape": "MetricName", "type": "string"},
{"name": "ResourceArn", "shape": "SageMakerResourceArn", "type": "string"},
{"name": "MetricStat", "shape": "MetricStatistic", "type": "string"},
{"name": "Period", "shape": "Period", "type": "string"},
{"name": "XAxisType", "shape": "XAxisType", "type": "string"},
{"name": "Start", "shape": "Long", "type": "long"},
{"name": "End", "shape": "Long", "type": "long"},
],
"type": "structure",
},
"MetricQueryList": {"member_shape": "MetricQuery", "member_type": "structure", "type": "list"},
"MetricQueryResult": {
"members": [
{"name": "Status", "shape": "MetricQueryResultStatus", "type": "string"},
{"name": "Message", "shape": "Message", "type": "string"},
{"name": "XAxisValues", "shape": "XAxisValues", "type": "list"},
{"name": "MetricValues", "shape": "MetricValues", "type": "list"},
],
"type": "structure",
},
"MetricQueryResultList": {
"member_shape": "MetricQueryResult",
"member_type": "structure",
"type": "list",
},
"MetricSpecification": {
"members": [
{"name": "Predefined", "shape": "PredefinedMetricSpecification", "type": "structure"},
{"name": "Customized", "shape": "CustomizedMetricSpecification", "type": "structure"},
],
"type": "structure",
},
"MetricValues": {"member_shape": "Double", "member_type": "double", "type": "list"},
"MetricsSource": {
"members": [
{"name": "ContentType", "shape": "ContentType", "type": "string"},
Expand Down Expand Up @@ -12459,6 +12497,7 @@
{"name": "CompressionType", "shape": "ModelCompressionType", "type": "string"},
{"name": "ModelAccessConfig", "shape": "ModelAccessConfig", "type": "structure"},
{"name": "HubAccessConfig", "shape": "InferenceHubAccessConfig", "type": "structure"},
{"name": "ManifestS3Uri", "shape": "S3ModelUri", "type": "string"},
],
"type": "structure",
},
Expand Down Expand Up @@ -14796,4 +14835,5 @@
"type": "structure",
},
"Workteams": {"member_shape": "Workteam", "member_type": "structure", "type": "list"},
"XAxisValues": {"member_shape": "Long", "member_type": "long", "type": "list"},
}
1 change: 1 addition & 0 deletions src/sagemaker_core/main/config_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@
"s3_data_source": {
"s3_uri": {"type": "string"},
"s3_data_type": {"type": "string"},
"manifest_s3_uri": {"type": "string"},
}
}
},
Expand Down
46 changes: 46 additions & 0 deletions src/sagemaker_core/main/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,50 @@ class ResourceNotFound(Base):
message: Optional[str] = Unassigned()


class MetricQuery(Base):
"""
MetricQuery
Specifies a query to retrieve training metrics from SageMaker.

Attributes
----------------------
metric_name: The name of the metric to retrieve.
resource_arn: The ARN of the SageMaker resource to retrieve metrics for.
metric_stat: The metrics stat type of metrics to retrieve.
period: The time period of metrics to retrieve.
x_axis_type: The x-axis type of metrics to retrieve.
start: The start time of metrics to retrieve.
end: The end time of metrics to retrieve.
"""

metric_name: str
resource_arn: str
metric_stat: str
period: str
x_axis_type: str
start: Optional[int] = Unassigned()
end: Optional[int] = Unassigned()


class MetricQueryResult(Base):
"""
MetricQueryResult
The result of a query to retrieve training metrics from SageMaker.

Attributes
----------------------
status: The status of the metric query.
message: A message describing the status of the metric query.
x_axis_values: The values for the x-axis of the metrics.
metric_values: The metric values retrieved by the query.
"""

status: str
x_axis_values: List[int]
metric_values: List[float]
message: Optional[str] = Unassigned()


class BatchPutMetricsError(Base):
"""
BatchPutMetricsError
Expand Down Expand Up @@ -491,13 +535,15 @@ class S3ModelDataSource(Base):
compression_type: Specifies how the ML model data is prepared. If you choose Gzip and choose S3Object as the value of S3DataType, S3Uri identifies an object that is a gzip-compressed TAR archive. SageMaker will attempt to decompress and untar the object during model deployment. If you choose None and chooose S3Object as the value of S3DataType, S3Uri identifies an object that represents an uncompressed ML model to deploy. If you choose None and choose S3Prefix as the value of S3DataType, S3Uri identifies a key name prefix, under which all objects represents the uncompressed ML model to deploy. If you choose None, then SageMaker will follow rules below when creating model data files under /opt/ml/model directory for use by your inference code: If you choose S3Object as the value of S3DataType, then SageMaker will split the key of the S3 object referenced by S3Uri by slash (/), and use the last part as the filename of the file holding the content of the S3 object. If you choose S3Prefix as the value of S3DataType, then for each S3 object under the key name pefix referenced by S3Uri, SageMaker will trim its key by the prefix, and use the remainder as the path (relative to /opt/ml/model) of the file holding the content of the S3 object. SageMaker will split the remainder by slash (/), using intermediate parts as directory names and the last part as filename of the file holding the content of the S3 object. Do not use any of the following as file names or directory names: An empty or blank string A string which contains null bytes A string longer than 255 bytes A single dot (.) A double dot (..) Ambiguous file names will result in model deployment failure. For example, if your uncompressed ML model consists of two S3 objects s3://mybucket/model/weights and s3://mybucket/model/weights/part1 and you specify s3://mybucket/model/ as the value of S3Uri and S3Prefix as the value of S3DataType, then it will result in name clash between /opt/ml/model/weights (a regular file) and /opt/ml/model/weights/ (a directory). Do not organize the model artifacts in S3 console using folders. When you create a folder in S3 console, S3 creates a 0-byte object with a key set to the folder name you provide. They key of the 0-byte object ends with a slash (/) which violates SageMaker restrictions on model artifact file names, leading to model deployment failure.
model_access_config: Specifies the access configuration file for the ML model. You can explicitly accept the model end-user license agreement (EULA) within the ModelAccessConfig. You are responsible for reviewing and complying with any applicable license terms and making sure they are acceptable for your use case before downloading or using a model.
hub_access_config: Configuration information for hub access.
manifest_s3_uri: The Amazon S3 URI of the manifest file. The manifest file is a CSV file that stores the artifact locations.
"""

s3_uri: str
s3_data_type: str
compression_type: str
model_access_config: Optional[ModelAccessConfig] = Unassigned()
hub_access_config: Optional[InferenceHubAccessConfig] = Unassigned()
manifest_s3_uri: Optional[str] = Unassigned()


class ModelDataSource(Base):
Expand Down
2 changes: 1 addition & 1 deletion src/sagemaker_core/tools/api_coverage.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"SupportedAPIs": 338, "UnsupportedAPIs": 5}
{"SupportedAPIs": 338, "UnsupportedAPIs": 6}