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.
|Machine Learning Server 9.2.1
Microsoft R Server 9.1 and earlier
SQL Server 2016 and later (Windows only)
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.
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:
- An R Integrated Development Environment (IDE) configured to work with Microsoft R Client.
- Authenticated access to an instance of Machine Learning Server configured to operationalize analytics.
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.
|Authenticates the user via Active Directory and creates a remote R session and puts you at the remote command line unless you specify otherwise.
|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.
|Logout of the remote session on the Machine Learning Server.
2-Service pool functions
|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.
|Get the status of the dedicated pool for a published web service running on Machine Learning Server.
|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.
Use these functions to indicate whether the payload is a code block or script.
|Base function for executing a block of R code or an R script in the remote R session.
|A simple wrapper function for executing a remote R script.
|Generate a 'diff' report between local and remote.
5-Remote command-line functions
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.
|When executed from the remote R session, returns the user to the
> command prompt, and sets a local execution context.
|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
|Gets a list of all the files that are in the working directory of the remote session.
|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.
|Downloads the file from the working directory of the remote R session into the working directory of the local R session.
|Deletes the file from the working directory of the remote R session.
|Puts an object from the workspace of the local R session and loads it into the workspace of the remote R session.
|Gets an object from the workspace of the remote R session and loads it into the workspace of the local R session.
|Takes all objects from the local R session and loads them into the remote R session.
|Takes all objects from the remote R session and loads them into the local R session.
|Get a list of all the snapshots on the Machine Learning Server that are available to the current user.
|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.
|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.
|Deletes the specified snapshot from the repository on the Machine Learning Server.
|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.
|Publishes an R code block as a new web service running on Machine Learning Server.
|Updates an existing web service on a Machine Learning Server instance.
|Lists the different published web services on the Machine Learning Server instance.
|Gets a web service for consumption.
|Deletes a web service on a Machine Learning Server instance.
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:
- Remote Execution
- How to publish and manage web services in R
- How to interact with and consume web services in R
- Asynchronous batch execution of web services in R