-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-18828][SPARKR] Refactor scripts for R #16249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
096711a
9254367
07c784a
3718d4c
49b3d05
0cdf73a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #!/bin/bash | ||
|
|
||
| # | ||
| # 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. | ||
| # | ||
|
|
||
| # This scripts packages the SparkR source files (R and C files) and | ||
| # creates a package that can be loaded in R. The package is by default installed to | ||
| # $FWDIR/lib and the package can be loaded by using the following command in R: | ||
| # | ||
| # library(SparkR, lib.loc="$FWDIR/lib") | ||
| # | ||
| # NOTE(shivaram): Right now we use $SPARK_HOME/R/lib to be the installation directory | ||
| # to load the SparkR package on the worker nodes. | ||
|
|
||
| set -o pipefail | ||
| set -e | ||
|
|
||
| FWDIR="$(cd `dirname "${BASH_SOURCE[0]}"`; pwd)" | ||
| pushd $FWDIR > /dev/null | ||
| . $FWDIR/find-r.sh | ||
|
|
||
| # Generate Rd files if devtools is installed | ||
| "$R_SCRIPT_PATH/"Rscript -e ' if("devtools" %in% rownames(installed.packages())) { library(devtools); devtools::document(pkg="./pkg", roclets=c("rd")) }' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #!/bin/bash | ||
|
|
||
| # | ||
| # 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. | ||
| # | ||
|
|
||
| if [ -z "$R_SCRIPT_PATH" ] | ||
| then | ||
| if [ ! -z "$R_HOME" ] | ||
| then | ||
| R_SCRIPT_PATH="$R_HOME/bin" | ||
| else | ||
| # if system wide R_HOME is not found, then exit | ||
| if [ ! `command -v R` ]; then | ||
| echo "Cannot find 'R_HOME'. Please specify 'R_HOME' or make sure R is properly installed." | ||
| exit 1 | ||
| fi | ||
| R_SCRIPT_PATH="$(dirname $(which R))" | ||
| fi | ||
| echo "Using R_SCRIPT_PATH = ${R_SCRIPT_PATH}" | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| #!/bin/bash | ||
|
|
||
| # | ||
| # 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. | ||
| # | ||
|
|
||
| # This scripts packages the SparkR source files (R and C files) and | ||
| # creates a package that can be loaded in R. The package is by default installed to | ||
| # $FWDIR/lib and the package can be loaded by using the following command in R: | ||
| # | ||
| # library(SparkR, lib.loc="$FWDIR/lib") | ||
| # | ||
| # NOTE(shivaram): Right now we use $SPARK_HOME/R/lib to be the installation directory | ||
| # to load the SparkR package on the worker nodes. | ||
|
|
||
| set -o pipefail | ||
| set -e | ||
|
|
||
| FWDIR="$(cd `dirname "${BASH_SOURCE[0]}"`; pwd)" | ||
| pushd $FWDIR > /dev/null | ||
| . $FWDIR/find-r.sh | ||
|
|
||
| if [ -z "$VERSION" ]; then | ||
| VERSION=`grep Version $FWDIR/pkg/DESCRIPTION | awk '{print $NF}'` | ||
| fi | ||
|
|
||
| if [ ! -f "$FWDIR"/SparkR_"$VERSION".tar.gz ]; then | ||
| echo -e "R source package file $FWDIR/SparkR_$VERSION.tar.gz is not found." | ||
| echo -e "Please build R source package with check-cran.sh" | ||
| exit -1; | ||
| fi | ||
|
|
||
| echo "Removing lib path and installing from source package" | ||
| LIB_DIR="$FWDIR/lib" | ||
| rm -rf $LIB_DIR | ||
| mkdir -p $LIB_DIR | ||
| "$R_SCRIPT_PATH/"R CMD INSTALL SparkR_"$VERSION".tar.gz --library=$LIB_DIR | ||
|
|
||
| # Zip the SparkR package so that it can be distributed to worker nodes on YARN | ||
| pushd $LIB_DIR > /dev/null | ||
| jar cfM "$LIB_DIR/sparkr.zip" SparkR | ||
| popd > /dev/null | ||
|
|
||
| popd | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -232,14 +232,17 @@ if [ "$MAKE_R" == "true" ]; then | |
| R_PACKAGE_VERSION=`grep Version $SPARK_HOME/R/pkg/DESCRIPTION | awk '{print $NF}'` | ||
| pushd "$SPARK_HOME/R" > /dev/null | ||
| # Build source package and run full checks | ||
| # Install source package to get it to generate vignettes, etc. | ||
| # Do not source the check-cran.sh - it should be run from where it is for it to set SPARK_HOME | ||
| NO_TESTS=1 CLEAN_INSTALL=1 "$SPARK_HOME/"R/check-cran.sh | ||
| NO_TESTS=1 "$SPARK_HOME/"R/check-cran.sh | ||
|
|
||
| # Move R source package to match the Spark release version if the versions are not the same. | ||
| # NOTE(shivaram): `mv` throws an error on Linux if source and destination are same file | ||
| if [ "$R_PACKAGE_VERSION" != "$VERSION" ]; then | ||
| mv $SPARK_HOME/R/SparkR_"$R_PACKAGE_VERSION".tar.gz $SPARK_HOME/R/SparkR_"$VERSION".tar.gz | ||
| fi | ||
|
|
||
| # Install source package to get it to generate vignettes rds files, etc. | ||
| VERSION=$VERSION "$SPARK_HOME/"R/install-source-package.sh | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One more thing I ran into while testing this locally - the file
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually ignore this - If I use
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah good. |
||
| popd > /dev/null | ||
| else | ||
| echo "Skipping building R source package" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so I understand correctly this script assumes that
SparkR_$VERSION.tar.gzexists ? If so can we check that in the preceding lines ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great point - added.