Condividi tramite


mrsdeploy package for R

The mrsdeploy library provides functions for establishing a remote session in a console application and for publishing and managing a web service that is backed by the R code block or script you provided. Each capability can be used independently but the greatest value is achieved when you can leverage both.

Package details Description
Current version: 1.1.3
Built on: R 3.4.3
Package distribution: Machine Learning Server 9.2.1
Microsoft R Server 9.1 and earlier
SQL Server 2016 and later (Windows only)
Azure HDInsight
Azure Data Science Virtual Machines

How to use mrsdeploy

First, configure the server before using this library. For more information, see Configuring Machine Learning Server to operationalize analytics.

After configuration, you can call mrsdeploy functions from the command line or from script.

  • On R Client, the mrsdeploy package is installed and loaded automatically. You can start a remote session on an operationalized R Server instance once the remote login succeeds.

  • On Machine Learning Server or R Server, the mrsdeploy package is installed, but not loaded. Therefore, you'll have to load it before using any mrsdeploy functions. At the R prompt in the Machine Learning Server / R Server session, type library(mrsdeploy) to load the package.

Supported configurations

For remote execution, participating nodes can be either of the following configurations:

  • Two machines running the same version of Machine Learning Server or R Server (v9+), even if on different supported platforms, such as one Linux and one Windows.
  • One machine running R Client 3.x and one machine running Machine Learning Server v9+, where the R Client user issues a remote login sequence to the Machine Learning Server instance. Execution is always on the Machine Learning Server side. It's not possible to set up a remote session that runs on R Client.

The requirements for remote execution include:

Functions by category

This section lists the functions by category to give you an idea of how each one is used. You can also use the table of contents to find functions in alphabetical order.

1-Authentication & remote session functions

To use the functions in the mrsdeploy package, you must log into Machine Learning Server as an authenticated user. And if using the remote execution functionality, you can also create a remote R session upon login.

Learn more about these functions and their arguments in the article Connecting to Machine Learning Server to use mrsdeploy.

Function Description
remoteLogin Authenticates the user via Active Directory and creates a remote R session and puts you at the remote command line unless you specify otherwise.
remoteLoginAAD Authenticates the user via Azure Active Directory and creates a remote R session and puts you at the remote command line unless you specify otherwise.
remoteLogout Logout of the remote session on the Machine Learning Server.

2-Service pool functions

Function Description
configureServicePool Create or update a dedicated pool of connections for a published web service running on Machine Learning Server. The service pool provides an initial and maximum number sessions allowed for a given service.
getPoolStatus Get the status of the dedicated pool for a published web service running on Machine Learning Server.
deleteServicePool Deletes the service pool.

3-Remote execution functions

The following functions are used to initialize and interact with a session on a remote Machine Learning Server. Remote sessions are created when you authenticate and closed when you log out.

Learn more about executing remotely from your local machine in this Remote Execution article.

4-Execution functions

Use these functions to indicate whether the payload is a code block or script.

Function Description
remoteExecute Base function for executing a block of R code or an R script in the remote R session.
remoteScript A simple wrapper function for executing a remote R script.
diffLocalRemote Generate a 'diff' report between local and remote.

5-Remote command-line functions

Function Description
remoteCommandLine Displays the REMOTE> command prompt and provides a remote execution context. All R commands entered at the R console will be executed in the remote R session.
pause When executed from the remote R session, returns the user to the > command prompt, and sets a local execution context.
resume When executed from the local R session, returns the user to the REMOTE> command prompt, and sets a remote execution context.

6-File management functions

Function Description
listRemoteFiles Gets a list of all the files that are in the working directory of the remote session.
putLocalFile Uploads a file from the local machine and writes it to the working directory of the remote R session. This function is often used if a data file needs to be accessed by a script running on the remote R session.
getRemoteFile Downloads the file from the working directory of the remote R session into the working directory of the local R session.
deleteRemoteFile Deletes the file from the working directory of the remote R session.

7-Object functions

Function Description
putLocalObject Puts an object from the workspace of the local R session and loads it into the workspace of the remote R session.
getRemoteObject Gets an object from the workspace of the remote R session and loads it into the workspace of the local R session.
putLocalWorkspace Takes all objects from the local R session and loads them into the remote R session.
getRemoteWorkspace Takes all objects from the remote R session and loads them into the local R session.

8-Snapshot functions

Function Description
listSnapshots Get a list of all the snapshots on the Machine Learning Server that are available to the current user.
createSnapshot Creates a snapshot of the remote session and saves it on the server. Both the workspace and the files in the working directory are saved.
loadSnapshot Loads the specified snapshot from the server into the remote session. The workspace is updated with the objects saved in the snapshot, and saved files are restored to the working directory.
deleteSnapshot Deletes the specified snapshot from the repository on the Machine Learning Server.
downloadSnapshot Downloads a snapshot from Machine Learning Server.

9-Web service functions

The following functions are used to bundle R code or script as a web service. The web service deployment can be published to the local server or remotely if you set up a remote session.

Function Description
publishService Publishes an R code block as a new web service running on Machine Learning Server.
updateService Updates an existing web service on a Machine Learning Server instance.
listServices Lists the different published web services on the Machine Learning Server instance.
getService Gets a web service for consumption.
deleteService Deletes a web service on a Machine Learning Server instance.

Next steps

Add R packages to your computer by running setup for Machine Learning Server or R Client:

After you are logged in to a remote server, you can publish a web service or issue interactive commands against the remote Machine Learning Server. For more information, see these links:

See also

R Package Reference