Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/bash
0002 
0003 #
0004 # Licensed to the Apache Software Foundation (ASF) under one or more
0005 # contributor license agreements.  See the NOTICE file distributed with
0006 # this work for additional information regarding copyright ownership.
0007 # The ASF licenses this file to You under the Apache License, Version 2.0
0008 # (the "License"); you may not use this file except in compliance with
0009 # the License.  You may obtain a copy of the License at
0010 #
0011 #    http://www.apache.org/licenses/LICENSE-2.0
0012 #
0013 # Unless required by applicable law or agreed to in writing, software
0014 # distributed under the License is distributed on an "AS IS" BASIS,
0015 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016 # See the License for the specific language governing permissions and
0017 # limitations under the License.
0018 #
0019 
0020 # This scripts packages the SparkR source files (R and C files) and
0021 # creates a package that can be loaded in R. The package is by default installed to
0022 # $FWDIR/lib and the package can be loaded by using the following command in R:
0023 #
0024 #   library(SparkR, lib.loc="$FWDIR/lib")
0025 #
0026 # NOTE(shivaram): Right now we use $SPARK_HOME/R/lib to be the installation directory
0027 # to load the SparkR package on the worker nodes.
0028 
0029 set -o pipefail
0030 set -e
0031 set -x
0032 
0033 FWDIR="$(cd "`dirname "${BASH_SOURCE[0]}"`"; pwd)"
0034 LIB_DIR="$FWDIR/lib"
0035 
0036 mkdir -p "$LIB_DIR"
0037 
0038 pushd "$FWDIR" > /dev/null
0039 . "$FWDIR/find-r.sh"
0040 
0041 . "$FWDIR/create-rd.sh"
0042 
0043 # Install SparkR to $LIB_DIR
0044 "$R_SCRIPT_PATH/R" CMD INSTALL --library="$LIB_DIR" "$FWDIR/pkg/"
0045 
0046 # Zip the SparkR package so that it can be distributed to worker nodes on YARN
0047 cd "$LIB_DIR"
0048 jar cfM "$LIB_DIR/sparkr.zip" SparkR
0049 
0050 popd > /dev/null