Skip to main content

AWS Sagemaker Controller notebook/client API for Pelion Edge Gateways

Project description

Sagemaker Edge Agent Controller client API for Pelion Edge

PyPi: https://pypi.org/project/pelion_sagemaker_controller/

This python package simplifies the Data Scientist's job of accessing, via a Sagemaker Jupyter Notebook, the Sagemaker Edge Agent running on their Pelion Edge enabled gateway.

Controller API Instance Creation

To create an instance of this API:

# Required import
from pelion_sagemaker_controller import pelion_sagemaker_controller

#
# Invoke constructor with Pelion API Key, Pelion GW Device ID
# You can also optionally specify the Pelion API endpoint you want to use
#
api = pelion_sagemaker_controller.ControllerAPI(
		api_key='<ak_xxxx>', 
		device_id='<pelion_gw_device_id>', 
		api_endpoint='api.us-east-1.mbedcloud.com'
		)

Supported Commands

The following commands are supported by this API:

Get Configuration

api.pelion_get_config()

This call returns a JSON with the current Edge Device representing the 
Sagemaker service's configuration

Set Configuration

api.pelion_set_config({'foo':'bar'})

This call updates or adds key/values to the current Edge Device's configuration

List Models

api.pelion_list_models()

This call returns a JSON outlining all of the loaded models

Load Model

api.pelion_load_model('model-name','compiled-model-x.y.tar.gz')

This call loads up the requested Sagemaker-compiled model whose compiled 
contents are located within the S3 bucket defined in the configuration
and utilized by the Sagemaker service

Unload Model

api.pelion_unload_model('model-name')

This call unloads the loaded model referenced by the name 'model-name'

Reload Model

api.pelion_reload_model('model-name','compiled-model-x.y.tar.gz')

This call is a convenience method for simply performing an "unload" followed by
a "load" of a given model using the methods above. 

Predict

api.pelion_predict(
          'model-name',
          's3:///input.data', 
          's3:///prediction_result.data'
          )

This call invokes the model prediction using the specified input.data file that is
configured to be pulled from the Sagemaker S3 bucket (per configuration). The output
result from the prediction will be stored in a file that will be saved to the same
directory in the S3 bucket. 

In addition to S3 bucket support, you can locally reference input/output requirements
using the "file:///" protocol - in this case the Sagemaker Edge Agent working directory
on the Pelion Edge Gateway will contain the specified files. 

Last Command Result

api.pelion_last_cmd_result()

This call returns the last invocation/call results. In cases where predictions take
a long time to complete, this call may be used in a polling situation to determine
when the prediction operation has completed. 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pelion_sagemaker_controller-0.0.29.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pelion_sagemaker_controller-0.0.29-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file pelion_sagemaker_controller-0.0.29.tar.gz.

File metadata

  • Download URL: pelion_sagemaker_controller-0.0.29.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for pelion_sagemaker_controller-0.0.29.tar.gz
Algorithm Hash digest
SHA256 e98a1054d33f0a883635a34bab0c664e7546265a1b7c452c1fc895aae0d78f1c
MD5 b5885db13b42ae816501a92d11a05967
BLAKE2b-256 1d5febd8c1f8d0e1abf6b28b131e2a056a408290c89f77222f6d38d0d19b35d8

See more details on using hashes here.

File details

Details for the file pelion_sagemaker_controller-0.0.29-py3-none-any.whl.

File metadata

  • Download URL: pelion_sagemaker_controller-0.0.29-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for pelion_sagemaker_controller-0.0.29-py3-none-any.whl
Algorithm Hash digest
SHA256 66c586f2fb183b5e40563e16ba1a6f720ddf61c7f74d01a839d4583be5469b33
MD5 01138252a48e87a634936eb7649d5b97
BLAKE2b-256 ed8d13d1c77e768d4d74ee2d41321f3f6e560b3ec039a6dfd00082658929a265

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page