On-Boarding an R Model

Note

R Client v0.2-7 was tested with the Acumos Athena platform release

Prerequisites

Before you begin:

  1. You must have the following packages installed in your system : protobuf-compiler, protobuf-c-compiler, libprotobuf-c-dev, libprotobuf-dev,libprotoc-dev

  2. You must have an Acumos account

  3. You must have protobuf 3 installed on your system (version 2 will not work).

    git clone https://github.com/google/protobuf.git protobuf
    cd protobuf
    ./autogen.sh
    ./configure --prefix=`pwd`/../`uname -m`-linux-gnu
    make
    make install
    
  4. You must have R installed on you system. Please have a look at cran.r-project.org

Installing the Acumos R Client

Within R you need to install and load all dependent packages from CRAN first.

install.packages(c("Rcpp","RCurl","RUnit","rmarkdown","knitr","pinp","xml2"))
library(Rcpp,Rcurl,RUnit,rmarkdown,knitr,pinp)

Then Install the Acumos R Client package and RProtobuf package thanks to the following command:

install.packages("RProtoBuf")
install.packages("acumos",,c("http://r.research.att.com","http://rforge.net"))

Alternatively, to install from sources:

git clone git@github.com:s-u/acumos.git or git clone https://github.com/s-u/acumos.git
R CMD build acumos
R CMD INSTALL acumos_*.tar.gz

Using the Acumos R Client

Model bundle

To create the model bundle, use acumos::compose() with the functions to expose. If type specs are not defined, they default to c(x=”character”). The model bundle (named component.amc) is in fatc a zip file that contains three distinct files :

  1. meta.json defining the component and their metadata,
  2. component.bin the binary payload,
  3. and component.proto with the protobuf specs.

Please consult R documentation page for details, i.e., use ?compose in R or see the Compose page at RForge.

If you used R under windows you could meet an issue using the acumos::compose() function due to some problems between R under windows and zip. If RTools is not installed on your windows environment, the model bundle will not be created. So please follows the installation procedure of

Authentication and upload

Once the model bundle is created, you can use the push() API to upload it in Acumos.

acumos::push("https://url","file","username:token")

url can be found in the ON-BOARDING MODEL page of your Acumos portal and looks like : “hotsname:port/onboarding-app/v2/models”

file : component.zip

username : your Acumos username

token : Authentication token available in the Acumos portal in your profile section

You can also authenticate yourself by using the auth() API:

acumos::auth("url","username","password")

url can be found in the ON-BOARDING MODEL page of your Acumos portal and lokks like “hostname:port/onboarding-app/v2/auth”

username : your Acumos username

password : your Acumos password

In the Response, you will receive an authentication token to be used in the acumos::push() function :

acumos::push("url","file","token")