diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0a475fa0e09..849706ab659 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -100,17 +100,6 @@ updates: patterns: - "*" - - package-ecosystem: "maven" - directory: "/rlang" - schedule: - interval: "weekly" - open-pull-requests-limit: 0 - groups: - rlang-security-updates: - applies-to: security-updates - patterns: - - "*" - - package-ecosystem: "maven" directory: "/shell" schedule: diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index c7b8f11b9e4..28b8777261d 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -67,25 +67,24 @@ jobs: run: ./mvnw install -Pbuild-distr -DskipTests -pl zeppelin-server,zeppelin-web,spark-submit,spark/scala-2.12,spark/scala-2.13,markdown,angular,shell -am -Pweb-classic -Phelium-dev -Pexamples ${MAVEN_ARGS} - name: install and test plugins run: ./mvnw package -pl zeppelin-plugins -amd ${MAVEN_ARGS} - - name: Setup conda environment with python 3.9 and R + - name: Setup conda environment with python 3.9 uses: conda-incubator/setup-miniconda@v3 with: - activate-environment: python_3_with_R - environment-file: testing/env_python_3.9_with_R.yml + activate-environment: python_3 + environment-file: testing/env_python_3.9.yml python-version: 3.9 channels: conda-forge,defaults channel-priority: strict auto-activate: false use-mamba: true - - name: Make IRkernel available to Jupyter + - name: Show conda environment run: | - R -e "IRkernel::installspec()" conda list conda info - name: run tests # skip spark test because we would run them in other CI run: ./mvnw verify -Pusing-packaged-distr -pl zeppelin-server,zeppelin-web,spark-submit,spark/scala-2.12,spark/scala-2.13,markdown,angular,shell -am -Pweb-classic -Phelium-dev -Pexamples -Dtests.to.exclude=**/org/apache/zeppelin/spark/* -DfailIfNoTests=false - # test interpreter modules except spark, flink, python, rlang, jupyter + # test interpreter modules except spark, flink, python, jupyter interpreter-test-non-core: runs-on: ubuntu-24.04 strategy: @@ -117,11 +116,11 @@ jobs: ${{ runner.os }}-zeppelin- - name: install environment run: ./mvnw install -DskipTests -am -pl ${INTERPRETERS} ${MAVEN_ARGS} - - name: Setup conda environment with python 3.9 and R + - name: Setup conda environment with python 3.9 uses: conda-incubator/setup-miniconda@v3 with: - activate-environment: python_3_with_R_and_tensorflow - environment-file: testing/env_python_3_with_R_and_tensorflow.yml + activate-environment: python_3_with_tensorflow + environment-file: testing/env_python_3_with_tensorflow.yml python-version: 3.9 channels: conda-forge,defaults channel-priority: strict @@ -130,8 +129,8 @@ jobs: - name: verify interpreter run: ./mvnw verify -am -pl ${INTERPRETERS} ${MAVEN_ARGS} - # test interpreter modules for jupyter, python, rlang - interpreter-test-jupyter-python-rlang: + # test interpreter modules for jupyter, python + interpreter-test-jupyter-python: runs-on: ubuntu-24.04 strategy: fail-fast: false @@ -159,25 +158,22 @@ jobs: key: ${{ runner.os }}-zeppelin-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-zeppelin- - - name: Setup conda environment with python ${{ matrix.python }} and R + - name: Setup conda environment with python ${{ matrix.python }} uses: conda-incubator/setup-miniconda@v3 with: - activate-environment: python_3_with_R - environment-file: testing/env_python_${{ matrix.python }}_with_R.yml + activate-environment: python_3 + environment-file: testing/env_python_${{ matrix.python }}.yml python-version: ${{ matrix.python }} channels: conda-forge,defaults channel-priority: strict auto-activate: false use-mamba: true - - name: Make IRkernel available to Jupyter - run: | - R -e "IRkernel::installspec()" - name: install environment run: | - ./mvnw install -DskipTests -pl python,rlang,zeppelin-jupyter-interpreter -am ${MAVEN_ARGS} + ./mvnw install -DskipTests -pl python,zeppelin-jupyter-interpreter -am ${MAVEN_ARGS} - name: run tests with ${{ matrix.python }} run: | - ./mvnw test -pl python,rlang,zeppelin-jupyter-interpreter -DfailIfNoTests=false ${MAVEN_ARGS} + ./mvnw test -pl python,zeppelin-jupyter-interpreter -DfailIfNoTests=false ${MAVEN_ARGS} # zeppelin integration test except Spark & Flink zeppelin-integration-test: @@ -214,19 +210,16 @@ jobs: run: | ./mvnw install -DskipTests -Pintegration -pl zeppelin-interpreter-integration,zeppelin-web,spark-submit,spark/scala-2.12,spark/scala-2.13,markdown,flink-cmd,flink/flink-scala-2.12,jdbc,shell -am -Pweb-classic -Pflink-1.20 ${MAVEN_ARGS} ./mvnw package -pl zeppelin-plugins -amd -DskipTests ${MAVEN_ARGS} - - name: Setup conda environment with python 3.9 and R + - name: Setup conda environment with python 3.9 uses: conda-incubator/setup-miniconda@v3 with: - activate-environment: python_3_with_R - environment-file: testing/env_python_3_with_R.yml + activate-environment: python_3 + environment-file: testing/env_python_3.yml python-version: 3.9 channels: conda-forge,defaults channel-priority: strict auto-activate: false use-mamba: true - - name: Make IRkernel available to Jupyter - run: | - R -e "IRkernel::installspec()" - name: run tests run: ./mvnw test -pl zeppelin-interpreter-integration -Pintegration -DfailIfNoTests=false -Dtest=ZeppelinClientIntegrationTest,ZeppelinClientWithAuthIntegrationTest,ZSessionIntegrationTest,ShellIntegrationTest,JdbcIntegrationTest - name: Print zeppelin logs @@ -270,7 +263,7 @@ jobs: run: | ./mvnw install -DskipTests -am -pl flink/flink-scala-2.12,flink-cmd,zeppelin-interpreter-integration -Pflink-${{ matrix.flink-profile }} -Pintegration ${MAVEN_ARGS} ./mvnw clean package -pl zeppelin-plugins -amd -DskipTests ${MAVEN_ARGS} - - name: Setup conda environment with python ${{ matrix.python }} and R + - name: Setup conda environment with python ${{ matrix.python }} uses: conda-incubator/setup-miniconda@v3 with: activate-environment: python_3_with_flink @@ -318,19 +311,16 @@ jobs: run: | ./mvnw install -DskipTests -pl zeppelin-interpreter-integration,zeppelin-web,spark-submit,spark/scala-2.12,spark/scala-2.13,markdown -am -Pweb-classic -Pintegration ${MAVEN_ARGS} ./mvnw clean package -pl zeppelin-plugins -amd -DskipTests ${MAVEN_ARGS} - - name: Setup conda environment with python 3.9 and R + - name: Setup conda environment with python 3.9 uses: conda-incubator/setup-miniconda@v3 with: - activate-environment: python_3_with_R - environment-file: testing/env_python_3_with_R.yml + activate-environment: python_3 + environment-file: testing/env_python_3.yml python-version: 3.9 channels: conda-forge,defaults channel-priority: strict auto-activate: false use-mamba: true - - name: Make IRkernel available to Jupyter - run: | - R -e "IRkernel::installspec()" - name: run tests run: ./mvnw test -pl zeppelin-interpreter-integration -Pintegration -Dtest=SparkSubmitIntegrationTest,ZeppelinSparkClusterTest32,SparkIntegrationTest32,ZeppelinSparkClusterTest33,SparkIntegrationTest33 -DfailIfNoTests=false ${MAVEN_ARGS} @@ -365,19 +355,16 @@ jobs: ${{ runner.os }}-zeppelin- - name: install environment run: ./mvnw install -DskipTests -pl spark-submit,spark/scala-2.12,spark/scala-2.13 -am ${MAVEN_ARGS} - - name: Setup conda environment with python ${{ matrix.python }} and R + - name: Setup conda environment with python ${{ matrix.python }} uses: conda-incubator/setup-miniconda@v3 with: - activate-environment: python_3_with_R - environment-file: testing/env_python_${{ matrix.python }}_with_R.yml + activate-environment: python_3 + environment-file: testing/env_python_${{ matrix.python }}.yml python-version: ${{ matrix.python }} channels: conda-forge,defaults channel-priority: strict auto-activate: false use-mamba: true - - name: Make IRkernel available to Jupyter - run: | - R -e "IRkernel::installspec()" - name: run spark-3.3 tests with scala-2.12 and python-${{ matrix.python }} if: ${{ matrix.java == 11 }} run: | @@ -434,19 +421,16 @@ jobs: ./mvnw install -DskipTests -pl livy -am ${MAVEN_ARGS} ./testing/downloadSpark.sh "3.2.4" "3.2" ./testing/downloadLivy.sh "0.8.0-incubating" "2.12" - - name: Setup conda environment with python 3.9 and R + - name: Setup conda environment with python 3.9 uses: conda-incubator/setup-miniconda@v3 with: - activate-environment: python_39_with_R - environment-file: testing/env_python_3.9_with_R.yml + activate-environment: python_3 + environment-file: testing/env_python_3.9.yml python-version: 3.9 channels: conda-forge,defaults channel-priority: strict auto-activate: false use-mamba: true - - name: Make IRkernel available to Jupyter - run: | - R -e "IRkernel::installspec()" - name: run tests run: | export SPARK_HOME=$PWD/spark-3.2.4-bin-hadoop3.2 diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 8f6bc4880ed..68ce1c63a66 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -122,7 +122,7 @@ jobs: channels: conda-forge,defaults channel-priority: strict - name: Install application - run: ./mvnw clean install -DskipTests -am -pl python,rlang,zeppelin-jupyter-interpreter,zeppelin-web-angular ${MAVEN_ARGS} + run: ./mvnw clean install -DskipTests -am -pl python,zeppelin-jupyter-interpreter,zeppelin-web-angular ${MAVEN_ARGS} - name: Setup Zeppelin Server (Shiro.ini) run: | export ZEPPELIN_CONF_DIR=./conf @@ -184,19 +184,16 @@ jobs: key: ${{ runner.os }}-zeppelin-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-zeppelin- - - name: Setup conda environment with python 3.9 and R + - name: Setup conda environment with python 3.9 uses: conda-incubator/setup-miniconda@v3 with: - activate-environment: python_3_with_R - environment-file: testing/env_python_3_with_R.yml + activate-environment: python_3 + environment-file: testing/env_python_3.yml python-version: 3.9 channels: conda-forge,defaults channel-priority: strict auto-activate: false use-mamba: true - - name: Make IRkernel available to Jupyter - run: | - R -e "IRkernel::installspec()" - name: Install Environment run: | ./mvnw clean install -DskipTests -am -pl zeppelin-integration -Pweb-classic -Pintegration -Pspark-scala-2.12 -Pspark-3.5 -Pweb-dist ${MAVEN_ARGS} diff --git a/AGENTS.md b/AGENTS.md index a9a559817e8..6cced4fb2d4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -80,7 +80,7 @@ zeppelin-interpreter → zeppelin-interpreter-shaded → zeppelin-server All interpreter modules build after `zeppelin-interpreter-shaded`. A second shading chain exists for Jupyter: ``` -zeppelin-jupyter-interpreter → zeppelin-jupyter-interpreter-shaded → python, rlang +zeppelin-jupyter-interpreter → zeppelin-jupyter-interpreter-shaded → python ``` ## Module Architecture @@ -163,7 +163,6 @@ Each interpreter is an independent Maven module inheriting from `zeppelin-interp | `bigquery/` | Google BigQuery | | `cassandra/` | Apache Cassandra CQL | | `hbase/` | Apache HBase | -| `rlang/` | R language | | `livy/` | Apache Livy (remote Spark) | | `sparql/` | SPARQL queries | | `influxdb/` | InfluxDB | diff --git a/docs/_includes/themes/zeppelin/_navigation.html b/docs/_includes/themes/zeppelin/_navigation.html index a82c1c36824..cc2d63ebb5f 100644 --- a/docs/_includes/themes/zeppelin/_navigation.html +++ b/docs/_includes/themes/zeppelin/_navigation.html @@ -37,7 +37,6 @@
| Name | -Class | -Description | -
|---|---|---|
| %r.r | -RInterpreter | -Vanilla r interpreter, with least dependencies, only R environment and knitr are required.
- It is always recommended to use the fully qualified interpreter name %r.r, because %r is ambiguous,
- it could mean %spark.r when current note's default interpreter is %spark and %r.r when the default interpreter is %r |
-
| %r.ir | -IRInterpreter | -Provide more fancy R runtime via [IRKernel](https://github.com/IRkernel/IRkernel), almost the same experience like using R in Jupyter. It requires more things, but is the recommended interpreter for using R in Zeppelin. | -
| %r.shiny | -ShinyInterpreter | -Run Shiny app in Zeppelin | -
| Property | -Default | -Description | -
|---|---|---|
| zeppelin.R.cmd | -R | -Path of the installed R binary. You should set this property explicitly if R is not in your $PATH(example: /usr/bin/R).
- |
-
| zeppelin.R.knitr | -true | -Whether to use knitr or not. It is recommended to install [knitr](https://yihui.org/knitr/) | -
| zeppelin.R.image.width | -100% | -Image width of R plotting | -
| zeppelin.R.shiny.iframe_width | -100% | -IFrame width of Shiny App | -
| zeppelin.R.shiny.iframe_height | -500px | -IFrame height of Shiny App | -
| zeppelin.R.shiny.portRange | -: | -Shiny app would launch a web app at some port, this property is to specify the portRange via format 'start':'end', e.g. '5000:5001'. By default it is ':' which means any port. | -
| zeppelin.R.maxResult | -1000 | -Max number of dataframe rows to display when using z.show | -
-
-
-## Interpreter binding mode
-
-The default [interpreter binding mode](../usage/interpreter/interpreter_binding_mode.html) is `globally shared`. That means all notes share the same R interpreter.
-So we would recommend you to ues `isolated per note` which means each note has own R interpreter without affecting each other. But it may run out of your machine resource if too many R
-interpreters are created. You can [run R in yarn mode](../interpreter/r.html#run-r-in-yarn-cluster) to avoid this problem.
-
-## How to use R Interpreter
-
-There are two different implementations of R interpreters: `%r.r` and `%r.ir`.
-
-* Vanilla R Interpreter(`%r.r`) behaves like an ordinary REPL and use SparkR to communicate between R process and JVM process. It requires `knitr` to be installed.
-* IRKernel R Interpreter(`%r.ir`) behaves like using IRKernel in Jupyter notebook. It is based on [jupyter interpreter](jupyter.html). Besides jupyter interpreter's prerequisites, [IRkernel](https://github.com/IRkernel/IRkernel) needs to be installed as well.
-
-Take a look at the tutorial note `R Tutorial/1. R Basics` for how to write R code in Zeppelin.
-
-### R basic expressions
-
-R basic expressions are supported in both `%r.r` and `%r.ir`.
-
-
-
-### R base plotting
-
-R base plotting is supported in both `%r.r` and `%r.ir`.
-
-
-
-### Other plotting
-
-Besides R base plotting, you can use other visualization libraries in both `%r.r` and `%r.ir`, e.g. `ggplot` and `googleVis`
-
-
-
-
-
-### z.show
-
-`z.show()` is only available in `%r.ir` to visualize R dataframe, e.g.
-
-
-
-By default, `z.show` would only display 1000 rows, you can specify the maxRows via `z.show(df, maxRows=2000)`
-
-## Make Shiny App in Zeppelin
-
-[Shiny](https://shiny.rstudio.com/tutorial/) is an R package that makes it easy to build interactive web applications (apps) straight from R.
-`%r.shiny` is used for developing R shiny app in Zeppelin notebook. It only works when IRKernel Interpreter(`%r.ir`) is enabled.
-For developing one Shiny App in Zeppelin, you need to write at least 3 paragraphs (server type paragraph, ui type paragraph and run type paragraph)
-
-* Server type R shiny paragraph
-
-```r
-
-%r.shiny(type=server)
-
-# Define server logic to summarize and view selected dataset ----
-server <- function(input, output) {
-
- # Return the requested dataset ----
- datasetInput <- reactive({
- switch(input$dataset,
- "rock" = rock,
- "pressure" = pressure,
- "cars" = cars)
- })
-
- # Generate a summary of the dataset ----
- output$summary <- renderPrint({
- dataset <- datasetInput()
- summary(dataset)
- })
-
- # Show the first "n" observations ----
- output$view <- renderTable({
- head(datasetInput(), n = input$obs)
- })
-}
-```
-
-* UI type R shiny paragraph
-
-```r
-%r.shiny(type=ui)
-
-# Define UI for dataset viewer app ----
-ui <- fluidPage(
-
- # App title ----
- titlePanel("Shiny Text"),
-
- # Sidebar layout with a input and output definitions ----
- sidebarLayout(
-
- # Sidebar panel for inputs ----
- sidebarPanel(
-
- # Input: Selector for choosing dataset ----
- selectInput(inputId = "dataset",
- label = "Choose a dataset:",
- choices = c("rock", "pressure", "cars")),
-
- # Input: Numeric entry for number of obs to view ----
- numericInput(inputId = "obs",
- label = "Number of observations to view:",
- value = 10)
- ),
-
- # Main panel for displaying outputs ----
- mainPanel(
-
- # Output: Verbatim text for data summary ----
- verbatimTextOutput("summary"),
-
- # Output: HTML table with requested number of observations ----
- tableOutput("view")
-
- )
- )
-)
-```
-
-* Run type R shiny paragraph
-
-```r
-
-%r.shiny(type=run)
-
-```
-
-After executing the run type R shiny paragraph, the shiny app will be launched and embedded as iframe in paragraph.
-Take a look at the tutorial note `R Tutorial/2. Shiny App` for how to develop R shiny app.
-
-
-
-### Run multiple shiny apps
-
-If you want to run multiple shiny apps, you can specify `app` in paragraph local property to differentiate different shiny apps.
-
-e.g.
-
-```r
-%r.shiny(type=ui, app=app_1)
-```
-
-```r
-%r.shiny(type=server, app=app_1)
-```
-
-```r
-%r.shiny(type=run, app=app_1)
-```
-
-## Run R in yarn cluster
-
-Zeppelin support to [run interpreter in yarn cluster](../quickstart/yarn.html). But there's one critical problem to run R in yarn cluster: how to manage the R environment in yarn container.
-Because yarn cluster is a distributed cluster which is composed of many nodes, and your R interpreter can start in any node.
-It is not practical to manage R environment in each node.
-
-So in order to run R in yarn cluster, we would suggest you to use conda to manage your R environment, and Zeppelin can ship your
-R conda environment to yarn container, so that each R interpreter can have its own R environment without affecting each other.
-
-To be noticed, you can only run IRKernel interpreter(`%r.ir`) in yarn cluster. So make sure you include at least the following prerequisites in the below conda env:
-
-* python
-* jupyter
-* grpcio
-* protobuf
-* r-base
-* r-essentials
-* r-irkernel
-
-`python`, `jupyter`, `grpcio` and `protobuf` are required for [jupyter interpreter](../interpreter/jupyter.html), because IRKernel interpreter is based on [jupyter interpreter](../interpreter/jupyter.html). Others are for R runtime.
-
-Following are instructions of how to run R in yarn cluster. You can find all the code in the tutorial note `R Tutorial/3. R Conda Env in Yarn Mode`.
-
-
-### Step 1
-
-We would suggest you to use conda pack to create archive of conda environment.
-
-Here's one example of yaml file which is used to generate a conda environment with R and some useful R libraries.
-
-* Create a yaml file for conda environment, write the following content into file `r_env.yml`
-
-```text
-name: r_env
-channels:
- - conda-forge
- - defaults
-dependencies:
- - python=3.9
- - jupyter
- - grpcio
- - protobuf
- - r-base=3
- - r-essentials
- - r-evaluate
- - r-base64enc
- - r-knitr
- - r-ggplot2
- - r-irkernel
- - r-shiny
- - r-googlevis
-```
-
-* Create conda environment via this yaml file using either `conda` or `mamba`
-
-```bash
-
-conda env create -f r_env.yml
-```
-
-```bash
-
-mamba env create -f r_env.yml
-```
-
-
-* Pack the conda environment using `conda`
-
-```bash
-
-conda pack -n r_env
-```
-
-### Step 2
-
-Specify the following properties to enable yarn mode for R interpreter via [inline configuration](../usage/interpreter/overview.html#inline-generic-configuration)
-
-```
-%r.conf
-
-zeppelin.interpreter.launcher yarn
-zeppelin.yarn.dist.archives hdfs:///tmp/r_env.tar.gz#environment
-zeppelin.interpreter.conda.env.name environment
-```
-
-`zeppelin.yarn.dist.archives` is the R conda environment tar file which is created in step 1. This tar will be shipped to yarn container and untar in the working directory of yarn container.
-`hdfs:///tmp/r_env.tar.gz` is the R conda archive file you created in step 2. `environment` in `hdfs:///tmp/r_env.tar.gz#environment` is the folder name after untar.
-This folder name should be the same as `zeppelin.interpreter.conda.env.name`.
-
-### Step 3
-
-Now you can use run R interpreter in yarn container and also use any R libraries you specify in step 1.
diff --git a/docs/interpreter/spark.md b/docs/interpreter/spark.md
index 680ca054b3b..2b31a055cc5 100644
--- a/docs/interpreter/spark.md
+++ b/docs/interpreter/spark.md
@@ -49,21 +49,6 @@ Apache Spark is supported in Zeppelin with Spark interpreter group which consist
| Spark Property | -Default | -Description | -
|---|---|---|
| zeppelin.R.cmd | -R | -R binary executable path. | -
| zeppelin.R.knitr | -true | -Whether use knitr or not. (It is recommended to install knitr and use it in Zeppelin) | -
| zeppelin.R.image.width | -100% | -R plotting image width. | -
| zeppelin.R.render.options | -out.format = 'html', comment = NA, echo = FALSE, results = 'asis', message = F, warning = F, fig.retina = 2 | -R plotting options. | -
| zeppelin.R.shiny.iframe_width | -100% | -IFrame width of Shiny App | -
| zeppelin.R.shiny.iframe_height | -500px | -IFrame height of Shiny App | -
| zeppelin.R.shiny.portRange | -: | -Shiny app would launch a web app at some port, this property is to specify the portRange via format ' |
-
This tutorial is for how to use customize R runtime environment via conda in yarn mode.
\nIn this approach, the R interpreter runs in yarn container instead of in the zeppelin server host. And remmeber this only works for IRKernel(%r.ir) but not for vanilla R(%r.r), so make sure you include the following python packages in your conda env.
- *
- */
-public class ShinyInterpreter extends AbstractInterpreter {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ShinyInterpreter.class);
-
- private static final String DEFAULT_APP_NAME = "default";
- private Map= 20000) {
- assign(".sparkRsession", SparkR:::callJStatic("org.apache.zeppelin.spark.ZeppelinRContext", "getSparkSession"), envir = SparkR:::.sparkREnv)
- assign("spark", get(".sparkRsession", envir = SparkR:::.sparkREnv), envir = .GlobalEnv)
- assign(".sparkRjsc", SparkR:::callJStatic("org.apache.zeppelin.spark.ZeppelinRContext", "getJavaSparkContext"), envir = SparkR:::.sparkREnv)
- }
- assign(".sqlc", SparkR:::callJStatic("org.apache.zeppelin.spark.ZeppelinRContext", "getSqlContext"), envir = SparkR:::.sparkREnv)
- assign("sqlContext", get(".sqlc", envir = SparkR:::.sparkREnv), envir = .GlobalEnv)
- assign(".zeppelinContext", SparkR:::callJStatic("org.apache.zeppelin.spark.ZeppelinRContext", "getZeppelinContext"), envir = .GlobalEnv)
-} else {
- assign(".zeppelinContext", SparkR:::callJStatic("org.apache.zeppelin.r.IRInterpreter", "getRZeppelinContext"), envir = .GlobalEnv)
-}
-
-z.put <- function(name, object) {
- SparkR:::callJMethod(.zeppelinContext, "put", name, object)
-}
-
-z.get <- function(name) {
- SparkR:::callJMethod(.zeppelinContext, "get", name)
-}
-
-z.getAsDataFrame <- function(name) {
- stringValue <- z.get(name)
- read.table(text=stringValue, header=TRUE, sep="\t")
-}
-
-z.angular <- function(name, noteId=NULL, paragraphId=NULL) {
- SparkR:::callJMethod(.zeppelinContext, "angular", name, noteId, paragraphId)
-}
-
-z.angularBind <- function(name, value, noteId=NULL, paragraphId=NULL) {
- SparkR:::callJMethod(.zeppelinContext, "angularBind", name, value, noteId, paragraphId)
-}
-
-z.textbox <- function(name, value) {
- SparkR:::callJMethod(.zeppelinContext, "textbox", name, value)
-}
-
-z.noteTextbox <- function(name, value) {
- SparkR:::callJMethod(.zeppelinContext, "noteTextbox", name, value)
-}
-
-z.password <- function(name) {
- SparkR:::callJMethod(.zeppelinContext, "password", name)
-}
-
-z.notePassword <- function(name) {
- SparkR:::callJMethod(.zeppelinContext, "notePassword", name)
-}
-
-z.run <- function(paragraphId) {
- SparkR:::callJMethod(.zeppelinContext, "run", paragraphId)
-}
-
-z.runNote <- function(noteId) {
- SparkR:::callJMethod(.zeppelinContext, "runNote", noteId)
-}
-
-z.runAll <- function() {
- SparkR:::callJMethod(.zeppelinContext, "runAll")
-}
-
-z.angular <- function(name) {
- SparkR:::callJMethod(.zeppelinContext, "angular", name)
-}
-
-z.angularBind <- function(name, value) {
- SparkR:::callJMethod(.zeppelinContext, "angularBind", name, value)
-}
-
-z.angularUnbind <- function(name, value) {
- SparkR:::callJMethod(.zeppelinContext, "angularUnbind", name)
-}
-
-z.show <- function(data, maxRows=SparkR:::callJMethod(.zeppelinContext, "getMaxResult")) {
- if (is.data.frame(data)) {
- resultString = c(paste(colnames(data), collapse ="\t"))
- for (row in 1: min(nrow(data), maxRows)) {
- rowString <- paste(data[row,], collapse ="\t")
- resultString = c(resultString, rowString)
- }
- a=paste(resultString, collapse="\n")
- cat("\n%table ", a, "\n\n%text ", sep="")
- if (nrow(data) > maxRows) {
- cat("\n%html Results are limited by ", maxRows, " rows.", "\n%text ", sep="")
- }
- } else {
- cat(data)
- }
-}
\ No newline at end of file
diff --git a/rlang/src/main/resources/R/zeppelin_sparkr.R b/rlang/src/main/resources/R/zeppelin_sparkr.R
deleted file mode 100644
index 94fa6a7bb22..00000000000
--- a/rlang/src/main/resources/R/zeppelin_sparkr.R
+++ /dev/null
@@ -1,170 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-args <- commandArgs(trailingOnly = TRUE)
-
-hashCode <- as.integer(args[1])
-port <- as.integer(args[2])
-libPath <- args[3]
-version <- as.integer(args[4])
-timeout <- as.integer(args[5])
-isSparkSupported <- args[6]
-authSecret <- NULL
-if (length(args) >= 7) {
- authSecret <- args[7]
-}
-
-rm(args)
-
-print(paste("Port ", toString(port)))
-print(paste("LibPath ", libPath))
-
-.libPaths(c(file.path(libPath), .libPaths()))
-library(SparkR)
-
-if (is.null(authSecret)) {
- SparkR:::connectBackend("localhost", port, timeout)
-} else {
- SparkR:::connectBackend("localhost", port, timeout, authSecret)
-}
-
-# scStartTime is needed by R/pkg/R/sparkR.R
-assign(".scStartTime", as.integer(Sys.time()), envir = SparkR:::.sparkREnv)
-
-# getZeppelinR
-.zeppelinR = SparkR:::callJStatic("org.apache.zeppelin.r.ZeppelinR", "getZeppelinR", hashCode)
-
-if (isSparkSupported == "true") {
- # setup spark env
- assign(".sc", SparkR:::callJStatic("org.apache.zeppelin.spark.ZeppelinRContext", "getSparkContext"), envir = SparkR:::.sparkREnv)
- assign("sc", get(".sc", envir = SparkR:::.sparkREnv), envir=.GlobalEnv)
- if (version >= 20000) {
- assign(".sparkRsession", SparkR:::callJStatic("org.apache.zeppelin.spark.ZeppelinRContext", "getSparkSession"), envir = SparkR:::.sparkREnv)
- assign("spark", get(".sparkRsession", envir = SparkR:::.sparkREnv), envir = .GlobalEnv)
- assign(".sparkRjsc", SparkR:::callJStatic("org.apache.zeppelin.spark.ZeppelinRContext", "getJavaSparkContext"), envir = SparkR:::.sparkREnv)
- }
- assign(".sqlc", SparkR:::callJStatic("org.apache.zeppelin.spark.ZeppelinRContext", "getSqlContext"), envir = SparkR:::.sparkREnv)
- assign("sqlContext", get(".sqlc", envir = SparkR:::.sparkREnv), envir = .GlobalEnv)
- assign(".zeppelinContext", SparkR:::callJStatic("org.apache.zeppelin.spark.ZeppelinRContext", "getZeppelinContext"), envir = .GlobalEnv)
-} else {
- assign(".zeppelinContext", SparkR:::callJStatic("org.apache.zeppelin.r.RInterpreter", "getRZeppelinContext"), envir = .GlobalEnv)
-}
-
-z.put <- function(name, object) {
- SparkR:::callJMethod(.zeppelinContext, "put", name, object)
-}
-
-z.get <- function(name) {
- SparkR:::callJMethod(.zeppelinContext, "get", name)
-}
-
-z.getAsDataFrame <- function(name) {
- stringValue <- z.get(name)
- read.table(text=stringValue, header=TRUE, sep="\t")
-}
-
-z.angular <- function(name, noteId=NULL, paragraphId=NULL) {
- SparkR:::callJMethod(.zeppelinContext, "angular", name, noteId, paragraphId)
-}
-
-z.angularBind <- function(name, value, noteId=NULL, paragraphId=NULL) {
- SparkR:::callJMethod(.zeppelinContext, "angularBind", name, value, noteId, paragraphId)
-}
-
-z.textbox <- function(name, value) {
- SparkR:::callJMethod(.zeppelinContext, "textbox", name, value)
-}
-
-z.noteTextbox <- function(name, value) {
- SparkR:::callJMethod(.zeppelinContext, "noteTextbox", name, value)
-}
-
-z.password <- function(name) {
- SparkR:::callJMethod(.zeppelinContext, "password", name)
-}
-
-z.notePassword <- function(name) {
- SparkR:::callJMethod(.zeppelinContext, "notePassword", name)
-}
-
-z.run <- function(paragraphId) {
- SparkR:::callJMethod(.zeppelinContext, "run", paragraphId)
-}
-
-z.runNote <- function(noteId) {
- SparkR:::callJMethod(.zeppelinContext, "runNote", noteId)
-}
-
-z.runAll <- function() {
- SparkR:::callJMethod(.zeppelinContext, "runAll")
-}
-
-z.angular <- function(name) {
- SparkR:::callJMethod(.zeppelinContext, "angular", name)
-}
-
-z.angularBind <- function(name, value) {
- SparkR:::callJMethod(.zeppelinContext, "angularBind", name, value)
-}
-
-z.angularUnbind <- function(name, value) {
- SparkR:::callJMethod(.zeppelinContext, "angularUnbind", name)
-}
-
-# notify script is initialized
-SparkR:::callJMethod(.zeppelinR, "onScriptInitialized")
-
-while (TRUE) {
- req <- SparkR:::callJMethod(.zeppelinR, "getRequest")
- type <- SparkR:::callJMethod(req, "getType")
- stmt <- SparkR:::callJMethod(req, "getStmt")
- value <- SparkR:::callJMethod(req, "getValue")
-
- if (type == "eval") {
- tryCatch({
- ret <- eval(parse(text=stmt))
- SparkR:::callJMethod(.zeppelinR, "setResponse", "", FALSE)
- }, error = function(e) {
- SparkR:::callJMethod(.zeppelinR, "setResponse", toString(e), TRUE)
- })
- } else if (type == "set") {
- tryCatch({
- ret <- assign(stmt, value)
- SparkR:::callJMethod(.zeppelinR, "setResponse", "", FALSE)
- }, error = function(e) {
- SparkR:::callJMethod(.zeppelinR, "setResponse", toString(e), TRUE)
- })
- } else if (type == "get") {
- tryCatch({
- ret <- eval(parse(text=stmt))
- SparkR:::callJMethod(.zeppelinR, "setResponse", ret, FALSE)
- }, error = function(e) {
- SparkR:::callJMethod(.zeppelinR, "setResponse", toString(e), TRUE)
- })
- } else if (type == "getS") {
- tryCatch({
- ret <- eval(parse(text=stmt))
- SparkR:::callJMethod(.zeppelinR, "setResponse", toString(ret), FALSE)
- }, error = function(e) {
- SparkR:::callJMethod(.zeppelinR, "setResponse", toString(e), TRUE)
- })
- } else {
- # unsupported type
- SparkR:::callJMethod(.zeppelinR, "setResponse", paste("Unsupported type ", type), TRUE)
- }
-}
diff --git a/rlang/src/main/resources/interpreter-setting.json b/rlang/src/main/resources/interpreter-setting.json
deleted file mode 100644
index 654c1ee794f..00000000000
--- a/rlang/src/main/resources/interpreter-setting.json
+++ /dev/null
@@ -1,94 +0,0 @@
-[
- {
- "group": "r",
- "name": "r",
- "className": "org.apache.zeppelin.r.RInterpreter",
- "properties": {
- "zeppelin.R.knitr": {
- "envName": "ZEPPELIN_R_KNITR",
- "propertyName": "zeppelin.R.knitr",
- "defaultValue": true,
- "description": "Whether use knitr or not",
- "type": "checkbox"
- },
- "zeppelin.R.cmd": {
- "envName": "ZEPPELIN_R_CMD",
- "propertyName": "zeppelin.R.cmd",
- "defaultValue": "R",
- "description": "R binary executable path",
- "type": "string"
- },
- "zeppelin.R.maxResult": {
- "envName": null,
- "propertyName": "zeppelin.R.maxResult",
- "defaultValue": "1000",
- "description": "Max number of dataframe rows to display.",
- "type": "number"
- },
- "zeppelin.R.image.width": {
- "envName": "ZEPPELIN_R_IMAGE_WIDTH",
- "propertyName": "zeppelin.R.image.width",
- "defaultValue": "100%",
- "description": "Image width of R plotting",
- "type": "number"
- },
- "zeppelin.R.render.options": {
- "envName": "ZEPPELIN_R_RENDER_OPTIONS",
- "propertyName": "zeppelin.R.render.options",
- "defaultValue": "out.format = 'html', comment = NA, echo = FALSE, results = 'asis', message = F, warning = F, fig.retina = 2",
- "description": "",
- "type": "textarea"
- },
- "zeppelin.R.shiny.portRange": {
- "envName": "",
- "propertyName": "zeppelin.R.shiny.portRange",
- "defaultValue": ":",
- "description": "Shiny app would launch a web app at some port, this property is to specify the portRange via format '
())
- .build();
- return context;
- }
-}
diff --git a/rlang/src/test/java/org/apache/zeppelin/r/ShinyInterpreterTest.java b/rlang/src/test/java/org/apache/zeppelin/r/ShinyInterpreterTest.java
deleted file mode 100644
index 1afffa196e3..00000000000
--- a/rlang/src/test/java/org/apache/zeppelin/r/ShinyInterpreterTest.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.zeppelin.r;
-
-import com.mashape.unirest.http.HttpResponse;
-import com.mashape.unirest.http.Unirest;
-import com.mashape.unirest.http.exceptions.UnirestException;
-import org.apache.commons.io.IOUtils;
-import org.apache.zeppelin.interpreter.InterpreterContext;
-import org.apache.zeppelin.interpreter.InterpreterException;
-import org.apache.zeppelin.interpreter.InterpreterGroup;
-import org.apache.zeppelin.interpreter.InterpreterOutput;
-import org.apache.zeppelin.interpreter.InterpreterResult;
-import org.apache.zeppelin.interpreter.InterpreterResultMessage;
-import org.apache.zeppelin.interpreter.LazyOpenInterpreter;
-import org.apache.zeppelin.interpreter.remote.RemoteInterpreterEventClient;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
-import static org.mockito.Mockito.mock;
-
-public class ShinyInterpreterTest {
-
- protected ShinyInterpreter interpreter;
-
- @BeforeEach
- public void setUp() throws InterpreterException {
- Properties properties = new Properties();
-
- InterpreterContext context = getInterpreterContext();
- InterpreterContext.set(context);
- interpreter = new ShinyInterpreter(properties);
-
- InterpreterGroup interpreterGroup = new InterpreterGroup();
- interpreterGroup.addInterpreterToSession(new LazyOpenInterpreter(interpreter), "session_1");
- interpreter.setInterpreterGroup(interpreterGroup);
-
- interpreter.open();
- }
-
- @AfterEach
- public void tearDown() throws InterpreterException {
- if (interpreter != null) {
- interpreter.close();
- }
- }
-
- @Test
- void testShinyApp() throws
- IOException, InterpreterException, InterruptedException, UnirestException {
- /****************** Launch Shiny app with default app name *****************************/
- InterpreterContext context = getInterpreterContext();
- context.getLocalProperties().put("type", "ui");
- InterpreterResult result =
- interpreter.interpret(IOUtils.toString(getClass().getResource("/ui.R"), StandardCharsets.UTF_8), context);
- assertEquals(InterpreterResult.Code.SUCCESS, result.code());
-
- context = getInterpreterContext();
- context.getLocalProperties().put("type", "server");
- result = interpreter.interpret(IOUtils.toString(getClass().getResource("/server.R"), StandardCharsets.UTF_8), context);
- assertEquals(InterpreterResult.Code.SUCCESS, result.code());
-
- final InterpreterContext context2 = getInterpreterContext();
- context2.getLocalProperties().put("type", "run");
- Thread thread = new Thread(() -> {
- try {
- interpreter.interpret("", context2);
- } catch (Exception e) {
- e.printStackTrace();
- }
- });
- thread.start();
- // wait for the shiny app start
- Thread.sleep(5 * 1000);
- // extract shiny url
- List