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.
|Runs on:||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
|Built on:||R 3.3.x (included when you install a product that provides this package).|
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 mrsdpeloy 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.
|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-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.
|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.|
4-Remote command line functions
|pause||When executed from the remote R session, returns the user to the
|resume||When executed from the local R session, returns the user to the
5-File management functions
|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.|
|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.|
|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.|
8-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.
|publishService||Publishes an R code block as a new web service running on Machine Learning Server.|
|updateService||Updates an existing web service on an 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 an 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