SagemakerEdgeManager

Client

class SagemakerEdgeManager.Client

A low-level client representing Amazon Sagemaker Edge Manager

SageMaker Edge Manager dataplane service for communicating with active agents.

client = session.create_client('sagemaker-edge')

These are the available methods:

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)

Generate a presigned url given a client, its method, and arguments

Parameters
  • ClientMethod (string) -- The client method to presign for
  • Params (dict) -- The parameters normally passed to ClientMethod.
  • ExpiresIn (int) -- The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds)
  • HttpMethod (string) -- The http method to use on the generated url. By default, the http method is whatever is used in the method's model.
Returns

The presigned url

get_device_registration(**kwargs)

Use to check if a device is registered with SageMaker Edge Manager.

See also: AWS API Documentation

Request Syntax

response = client.get_device_registration(
    DeviceName='string',
    DeviceFleetName='string'
)
Parameters
  • DeviceName (string) --

    [REQUIRED]

    The unique name of the device you want to get the registration status from.

  • DeviceFleetName (string) --

    [REQUIRED]

    The name of the fleet that the device belongs to.

Return type

dict

Returns

Response Syntax

{
    'DeviceRegistration': 'string',
    'CacheTTL': 'string'
}

Response Structure

  • (dict) --

    • DeviceRegistration (string) --

      Describes if the device is currently registered with SageMaker Edge Manager.

    • CacheTTL (string) --

      The amount of time, in seconds, that the registration status is stored on the device’s cache before it is refreshed.

Exceptions

get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
send_heartbeat(**kwargs)

Use to get the current status of devices registered on SageMaker Edge Manager.

See also: AWS API Documentation

Request Syntax

response = client.send_heartbeat(
    AgentMetrics=[
        {
            'Dimension': 'string',
            'MetricName': 'string',
            'Value': 123.0,
            'Timestamp': datetime(2015, 1, 1)
        },
    ],
    Models=[
        {
            'ModelName': 'string',
            'ModelVersion': 'string',
            'LatestSampleTime': datetime(2015, 1, 1),
            'LatestInference': datetime(2015, 1, 1),
            'ModelMetrics': [
                {
                    'Dimension': 'string',
                    'MetricName': 'string',
                    'Value': 123.0,
                    'Timestamp': datetime(2015, 1, 1)
                },
            ]
        },
    ],
    AgentVersion='string',
    DeviceName='string',
    DeviceFleetName='string'
)
Parameters
  • AgentMetrics (list) --

    For internal use. Returns a list of SageMaker Edge Manager agent operating metrics.

    • (dict) --

      Information required for edge device metrics.

      • Dimension (string) --

        The dimension of metrics published.

      • MetricName (string) --

        Returns the name of the metric.

      • Value (float) --

        Returns the value of the metric.

      • Timestamp (datetime) --

        Timestamp of when the metric was requested.

  • Models (list) --

    Returns a list of models deployed on the the device.

    • (dict) --

      Information about a model deployed on an edge device that is registered with SageMaker Edge Manager.

      • ModelName (string) --

        The name of the model.

      • ModelVersion (string) --

        The version of the model.

      • LatestSampleTime (datetime) --

        The timestamp of the last data sample taken.

      • LatestInference (datetime) --

        The timestamp of the last inference that was made.

      • ModelMetrics (list) --

        Information required for model metrics.

        • (dict) --

          Information required for edge device metrics.

          • Dimension (string) --

            The dimension of metrics published.

          • MetricName (string) --

            Returns the name of the metric.

          • Value (float) --

            Returns the value of the metric.

          • Timestamp (datetime) --

            Timestamp of when the metric was requested.

  • AgentVersion (string) --

    [REQUIRED]

    Returns the version of the agent.

  • DeviceName (string) --

    [REQUIRED]

    The unique name of the device.

  • DeviceFleetName (string) --

    [REQUIRED]

    The name of the fleet that the device belongs to.

Returns

None

Exceptions

Client Exceptions

Client exceptions are available on a client instance via the exceptions property. For more detailed instructions and examples on the exact usage of client exceptions, see the error handling user guide.

The available client exceptions are:

class SagemakerEdgeManager.Client.exceptions.InternalServiceException

An internal failure occurred. Try your request again. If the problem persists, contact AWS customer support.

Example

try:
  ...
except client.exceptions.InternalServiceException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'Message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    An internal failure occurred. Try your request again. If the problem persists, contact AWS customer support.

    • Message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.

Paginators

The available paginators are: