enhanced-script-support.md 4.5 KB

Enhanced Script Support

Elyra provides Enhanced Script Support where Python and R scripts can be developed and executed. It also leverages the Hybrid Runtime Support to enable running these scripts in remote environments.

Enhanced Python Support

The execution of these scripts leverages the available Python and R based Kernels. This enables users to run their scripts in different configurations and environments.

Elyra also allows submitting a Python and R scripts as a single node pipeline for execution in a Kubeflow Pipelines or Apache Airflow environment in the cloud. This feature is accessible when the Elyra AI Pipelines extension is also enabled.

Python script execution support

In the JupyterLab Launcher, click the Python Editor icon to create a new Python script and open the Python Editor.

Open Python Editor

When used in conjunction with Jupyter Enterprise Gateway, the dropdown in the editor's toolbar will be populated with more kernel options, allowing users to run their scripts with remote kernels with more specialized resources.

To run your script locally, select the Python 3 option in the dropdown menu, and click the Run icon.

R script execution support

In the JupyterLab Launcher, click the R Editor icon to create a new R script and open the R Editor.

Open R Editor

To run your R script locally you will need to install an R kernel.

If you are using a conda environment:

$ conda install -y r-irkernel

Alternatively, you can install it via CRAN on an R console:
NOTE: You will need to have R installed and available prior to using this method of installing the R kernel.

In an R interactive console,

> install.packages('IRkernel')

then enable it on Jupyter:

> IRkernel::installspec()

You can check that the R kernel was successfully installed with:

jupyter kernelspec list

To run the script, from the Script editor toolbar, select the R option in the kernel selection drop-down, and click the Run icon.

Similar to the extended support for Python kernels when using the Jupyter Enterprise Gateway, the Script editor dropdown in the toolbar will display all available remote kernel options for R scripts.

R-Editor Language Server Protocol

You can enable R language server features for the R Editor in a conda environment with the following command:

$ conda install -c conda-forge r-languageserver

You can find more documentation about conda-forge here.

Another option is to install the R language server through the CRAN. Once R is installed, use the following command:

$ R -e install.packages("languageserver")

Ability to execute a Python and R script as a pipeline

Elyra allows the execution of Python and R scripts as a pipeline or batch job in remote cloud environments. This feature leverages the AI pipelines feature and requires access to either a Kubeflow Pipelines or Apache Airflow deployment via a runtime configuration.

To run a Python or R script as a pipeline, open the script file and select Run as Pipeline button from the editor toolbar.

Run Python Script as pipeline

To learn more about runtime configurations and runtime images, follow those sections provided in the Elyra user guide documentation.

Script Editors components

The Elyra Python Editor and R Editor are based on the JupyterLab editor which is currently based on CodeMirror.

Python Editor and R Editor Components