Skip to content

Commit 09ba720

Browse files
committed
add option -s to pass streaming jar path
1 parent 6b3b1a6 commit 09ba720

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

bin/compile.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@
9393

9494
file_put_contents($jobsh, sprintf('#!/bin/sh
9595
confswitch=""
96-
while getopts ":c:" opt; do
96+
streaming=""
97+
while getopts ":c:s:" opt; do
9798
case $opt in
9899
c) confswitch="--config $OPTARG";;
100+
s) streaming="$OPTARG";;
99101
\?) echo "Invalid option: -$OPTARG"; exit 1;;
100102
:) echo "Option -$OPTARG requires an argument."; exit 1;;
101103
esac
@@ -104,12 +106,13 @@
104106
105107
if [ $# -lt 2 ]
106108
then
107-
echo "Usage: $0 [-c HADOOPCONFDIR] HDFSINPUTPATH... HDFSOUTPUTPATH"
109+
echo "Usage: $0 [OPTION...] HDFSINPUTPATH... HDFSOUTPUTPATH"
108110
echo ""
109111
echo "HDFSINPUTPATH can be repeated to use multiple paths as input for the job."
110112
echo ""
111113
echo "Options:"
112114
echo " -c HADOOPCONFDIR Gets passed to hadoop via "--config" (see hadoop help)."
115+
echo " -s STREAMINGJAR Path to hadoop-streaming-*.jar"
113116
echo ""
114117
exit 1
115118
fi
@@ -131,10 +134,16 @@
131134
if [ $HADOOP_HOME ]
132135
then
133136
hadoop=$HADOOP_HOME/bin/hadoop
134-
streaming=$HADOOP_HOME"/contrib/streaming/hadoop-streaming-*.jar"
137+
if [ -z $streaming ]
138+
then
139+
streaming=$HADOOP_HOME"/contrib/streaming/hadoop-streaming-*.jar"
140+
fi
135141
else
136142
hadoop="hadoop"
137-
streaming="/usr/lib/hadoop/contrib/streaming/hadoop-streaming-*.jar"
143+
if [ -z $streaming ]
144+
then
145+
streaming="/usr/lib/hadoop/contrib/streaming/hadoop-streaming-*.jar"
146+
fi
138147
fi
139148
dir=`dirname $0`
140149

0 commit comments

Comments
 (0)