Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 93 lines (73 sloc) 2.137 kB
64c1c4f PyCascading initial commit.
Gabor Szabo authored
1 #!/usr/bin/env bash
2
3 #
4 # Copyright 2011 Twitter, Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17
18 #
19 # Runs the PyCascading locally without Hadoop
20 #
21
22
b4bd3df Additional options for local_run.sh to extend the classpath for running
Gabor Szabo authored
23 usage()
24 {
25 cat <<EOF
26 Usage:
27
28 $(basename "$0") <main_script.py> [parameters]
29
30 Runs the PyCascading script locally, without a Hadoop cluster.
31
32 Options:
33 -h Show this message
34 -j <cp> Additional jar files and Python import folders to be added
35 to the classpath. cp is a list of file and folder locations
36 separated by ":"s
64c1c4f PyCascading initial commit.
Gabor Szabo authored
37
38 EOF
b4bd3df Additional options for local_run.sh to extend the classpath for running
Gabor Szabo authored
39 }
40
41
42 while getopts ":hj:" OPTION; do
43 case $OPTION in
44 h) usage
45 exit 1
46 ;;
47 j) additional_jars="$OPTARG"
48 ;;
49 esac
50 done
51 shift $((OPTIND-1))
52
53 main_file="$1"
54 if [ "$main_file" == "" ]; then
55 usage
56 exit 1
64c1c4f PyCascading initial commit.
Gabor Szabo authored
57 fi
58
59 home_dir=$(dirname "$0")
60 source "$home_dir/java/dependencies.properties"
61
62 classpath="$home_dir/build/classes"
63
b4bd3df Additional options for local_run.sh to extend the classpath for running
Gabor Szabo authored
64 function add2classpath
65 {
64c1c4f PyCascading initial commit.
Gabor Szabo authored
66 for lib in $1; do
67 for file in $(ls $2/$lib); do
68 classpath="$classpath:$file"
69 done
70 done
71 }
72
73 # Jython jars
74 jython_libs='jython.jar'
75 add2classpath "$jython_libs" "$jython"
76
77 # Cascading jars
78 cascading_libs='cascading-[0-9].*.jar lib/jgrapht-*.jar'
79 add2classpath "$cascading_libs" "$cascading"
80
81 # Hadoop jars
82 hadoop_libs='hadoop-*core*.jar lib/*.jar'
83 add2classpath "$hadoop_libs" "$hadoop"
84
b4bd3df Additional options for local_run.sh to extend the classpath for running
Gabor Szabo authored
85 if [ "$additional_jars" != "" ]; then
86 classpath="$classpath:$additional_jars"
87 fi
88
89 # sys.path will be initialized from JYTHONPATH
64c1c4f PyCascading initial commit.
Gabor Szabo authored
90 JYTHONPATH="$home_dir/python" java -classpath "$classpath" \
e08c7c5 Changed main class in local_run.sh to Main
Gabor Szabo authored
91 com.twitter.pycascading.Main "$home_dir/python/pycascading/bootstrap.py" \
b10c20f Changed deploy method from single jar to Hadoop distributed cache
Gabor Szabo authored
92 local "$home_dir" "$@"
Something went wrong with that request. Please try again.