R Scripts

R Scripts System Requirements

License Requirements

This feature is available with the core APM application; no specific license is required.

Additional Components Required

In addition to the basic APM system architecture, your system must also contain the following additional components:
  • R Server: A machine on which the R Server software is installed. The software requirements of this server are determined by the third-party distributor of the software.
The APM testing environment uses the following:
  • DeployR Open 8.0.0 with Microsoft DeployR Enterprise 8.0.0 or Microsoft Machine Learning Server 9.2.1 running on Windows servers
  • Rserve 1.8-8 with R V4.1.3 running in Docker containers on Linux servers

Install R Server or Machine Learning Server

You can find more information about Microsoft R Server and Machine Learning Server, including required software dependencies and installation instructions, on https://msdn.microsoft.com/en-us/microsoft-r/rserver-install-windows.
Note: The World Wide Web Publishing service must be enabled on the R Server or Machine Learning Server in order to use R scripts in APM. If this setting is disabled during the installation of R Server, you must enable it.
Note: Microsoft DeployR 8.0.0 and Microsoft Machine Learning Server are out of support from Microsoft. You may continue to use these R servers with APM V4.6.0.0.0 however, we recommend migrating to open source Rserve and R. R Scripts will no longer support DeployR 8.0.0 or Machine Learning Server in APM future releases from V5.1.0.0.0 onwards.
Important: To ensure that the date and time values are handled as expected, the time zone of the Windows server where R Server or Machine Learning Server is installed must be set to UTC.

Install Rserve and R

About Rserve

Rserve is an open-source package that enables TCP/IP connections to R. Details about the Rserve package can be found at http://rforge.net/Rserve/.
Note: APM supports only two forms of Rserve authentication (refer to https://github.com/s-u/Rserve/wiki/Security):
  • No authentication
  • Plaintext password authentication

Install Rserve and R

Rserve and R can be installed on either Windows or Linux platforms; however, Linux is recommended.

Important: To ensure that the date and time values are handled as expected, the time zone of the Docker container running Rserve must be set to UTC.

GE Vernova has tested Rserve with R V4.1.3 running in a Docker container, using the images provided by the Rocker project (https://www.rocker-project.org/) as base images. The following sample Docker files can be used to build suitable containers:

SAMPLE MINIMAL DOCKERFILE:
FROM rocker/r-ver:4.1.3 
# install Rserve 
RUN install2.r --error \ 
    -r https://cran.rstudio.com \ 
    Rserve && \ 
    rm -rf /tmp/downloaded_packages/ /tmp/*.rds 

ENTRYPOINT R -e "Rserve::run.Rserve()" 
SAMPLE DOCKERFILE WITH SOME PACKAGES PRE-INSTALLED:
FROM rocker/r-ver:4.1.3 
# install tidyverse 
RUN /rocker_scripts/install_tidyverse.sh 

# install tidymodels 
RUN install2.r --error --skipinstalled tidymodels && \ 
    rm -rf /tmp/downloaded_packages 

# install RcppArmadillo 
RUN install2.r --error \ 
    -r https://cran.rstudio.com \ 
    RcppArmadillo && \ 
    rm -rf /tmp/downloaded_packages/ /tmp/*.rds 

# install WeibullR 
RUN install2.r --error \ 
    -r http://R-Forge.R-project.org \ 
    WeibullR && \ 
    rm -rf /tmp/downloaded_packages/ /tmp/*.rds 

# install survival 
RUN install2.r --error \ 
    -r https://cran.rstudio.com \ 
    survival && \ 
    rm -rf /tmp/downloaded_packages/ /tmp/*.rds 

# install Rserve 
RUN install2.r --error \ 
    -r https://cran.rstudio.com \ 
    Rserve && \ 
    rm -rf /tmp/downloaded_packages/ /tmp/*.rds 

ENTRYPOINT R -e "Rserve::run.Rserve()" 

Deploy R Scripts for the First Time

Before You Begin

After you have installed and configured the basic APM system architecture, including the R server of your choice, you will need to perform some configuration steps specifically for R Scripts.

The following table outlines the steps that you must complete to deploy and configure this module for the first time. These instructions assume that you have completed the steps for deploying the basic system architecture.

These tasks may be completed by multiple people in your organization. GE Vernova recommends, however, that the tasks be completed in the order in which they are listed.

Results

StepTaskNotes
1Ensure that your R Server is configured according to the R Scripts system requirements. For more information, refer to the APM System Requirements documentation.This step is required.
2In APM, specify the R Server credentials.This step is required.

Upgrade or Update R Scripts to V4.6.10.0.0

Before You Begin

The following tables outline the steps that you must complete to upgrade this module to V4.6.10.0.0. These instructions assume that you have completed the steps for upgrading the basic APM system architecture.

These tasks may be completed by multiple people in your organization. We recommend, however, that the tasks be completed in the order in which they are listed.

Procedure

  • Upgrade from any version V4.6.0.0.0 through V4.6.9.0.0

    This module will be updated to V4.6.10.0.0 automatically when you update the components in the basic APM system architecture. No additional steps are required.

  • Upgrade from any version V4.5.0.0.0 through V4.5.0.0.21

    This module will be updated to V4.6.10.0.0 automatically when you update the components in the basic APM system architecture. No additional steps are required.

  • Upgrade from any version V4.4.0.0.0 through V4.4.0.0.16

    This module will be updated to V4.6.10.0.0 automatically when you update the components in the basic APM system architecture. No additional steps are required.

  • Upgrade from any version V4.3.0.0.0 through V4.3.1.0.11

    This module will be updated to V4.6.10.0.0 automatically when you update the components in the basic APM system architecture. No additional steps are required.

  • Upgrade from any version V4.2.0.0 through V4.2.0.9.5
    StepTaskNotes
    1.

    Ensure that your R Server is configured according to the R Scripts system requirements. For more information, refer to the APM System Requirements documentation.

    This step is required.
    2.In APM, specify the R Server credentials.This step is required.
  • Upgrade from any version V4.1.0.0 through V4.1.7.4.0
    StepTaskNotes
    1.

    Ensure that your R Server is configured according to the R scripts system requirements.

    This step is required.
    2.In APM, specify the R Server credentials.This step is required.
  • Upgrade from any version V4.0.0.0 through V4.0.1.0
    StepTaskNotes
    1.

    Ensure that your R Server is configured according to the R scripts system requirements.

    This step is required.
    2.In APM, specify the R Server credentials.This step is required.
  • Upgrade from any version V3.6.1.0.0 through V3.6.1.7.5
    StepTaskNotes
    1.

    Ensure that your R Server is configured according to the R scripts system requirements.

    This step is required.
    2.In APM, specify the R Server credentials.This step is required.
  • Upgrade from any version V3.6.0.0.0 through V3.6.0.12.9
    StepTaskNotes
    1.If you are upgrading directly from V3.6.0.8.0, run a script in order to upgrade R script metadata.This step is required only if you are upgrading from V3.6.0.8.0. This step is not required if you are upgrading from any V3.x version that is covered by this section.
    2.

    Ensure that your R Server is configured according to the R scripts system requirements.

    This step is required.
    3.In APM, specify the R Server credentials.This step is required.

Upgrade R Script Metadata

About This Task

If you are upgrading directly from V3.6.0.8.0, after upgrading your database to V4.6.10.0.0, you must run a script in order to upgrade existing R script metadata. This step is not required if you are upgrading from any V3.x version other than V3.6.0.8.0.

Note: If you are unsure whether you need to complete this step, or if you would like assistance, please contact https://digitalsupport.ge.com/.

Procedure

  1. Copy the script corresponding to your type of database.

    Oracle

    
                        -- select * from dbo.[MI_CTIT_RSCRIPTS]
                        UPDATE MI_CTIT_RSCRIPTS
                        SET CTIT_RSCR_DEFN_MEM = REPLACE(CTIT_RSCR_DEFN_MEM, '"DataType":"n"', '"DataType":"N"');
                        UPDATE MI_CTIT_RSCRIPTS
                        SET CTIT_RSCR_DEFN_MEM = REPLACE(CTIT_RSCR_DEFN_MEM, '"DataType":"c"', '"DataType":"C"');
                        UPDATE MI_CTIT_RSCRIPTS
                        SET CTIT_RSCR_DEFN_MEM = REPLACE(CTIT_RSCR_DEFN_MEM, '"DataType":"d"', '"DataType":"D"');
                        UPDATE MI_CTIT_RSCRIPTS
                        SET CTIT_RSCR_DEFN_MEM = REPLACE(CTIT_RSCR_DEFN_MEM, '"DataType":"l"', '"DataType":"L"');
                    

    SQL

    
                        -- select * from dbo.[MI_CTIT_RSCRIPTS]
                        UPDATE dbo.[MI_CTIT_RSCRIPTS]
                        SET CTIT_RSCR_DEFN_MEM = CAST(REPLACE(CAST(CTIT_RSCR_DEFN_MEM as NVarchar(MAX)),'"DataType":"n"', '"DataType":"N"') AS NText)
                        UPDATE dbo.[MI_CTIT_RSCRIPTS]
                        SET CTIT_RSCR_DEFN_MEM = CAST(REPLACE(CAST(CTIT_RSCR_DEFN_MEM as NVarchar(MAX)),'"DataType":"c"', '"DataType":"C"') AS NText)
                        UPDATE dbo.[MI_CTIT_RSCRIPTS]
                        SET CTIT_RSCR_DEFN_MEM = CAST(REPLACE(CAST(CTIT_RSCR_DEFN_MEM as NVarchar(MAX)),'"DataType":"d"', '"DataType":"D"') AS NText)
                        UPDATE dbo.[MI_CTIT_RSCRIPTS]
                        SET CTIT_RSCR_DEFN_MEM = CAST(REPLACE(CAST(CTIT_RSCR_DEFN_MEM as NVarchar(MAX)),'"DataType":"l"', '"DataType":"L"') AS NText)
                    
  2. Using SQL Server Management Studio (for SQL) or SQL Developer (for Oracle), run the script.

    The R script metadata is upgraded.

Specify R Server Credentials

Before You Begin

You must be a Super User or member of the MI Configuration Role security group to modify the R Server credentials.

Procedure

  1. In the module navigation menu, select Admin > Operations Manager > Connections.
    The Connections page appears.
  2. Select R Server.
    The R Server workspace appears.

  3. In the R Server Version box, specify the version of R Server.
  4. In the Server Address box, enter the URL of the R Server (for example, http://MyRServer:7400/deployr).
  5. In the User Name and Password boxes, enter the user name and password that you want to use for the connection.
  6. Select Save.
    The R Server credentials are saved.
  7. Select Perform Connection Test to confirm that the connection is valid.