Giter VIP home page Giter VIP logo

pelion-sagemaker-controller's Introduction

Sagemaker Edge Agent Controller client API for Pelion Edge

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. 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.