Skip to content
Browse files

got rid of calls to register by preregistering jars, use the "varaha"…

… command under bin
  • Loading branch information...
1 parent 29760a5 commit 492b4f382df256fb13816b0c2b2653ffa80a609b @thedatachef committed
Showing with 60 additions and 5 deletions.
  1. +1 −0 .gitignore
  2. +59 −0 bin/varaha
  3. +0 −2 scripts/document_clustering/cluster_documents.pig
  4. +0 −3 scripts/document_clustering/tfidf.pig
View
1 .gitignore
@@ -43,3 +43,4 @@ pkg
target
*.RData
*.Rhistory
+.pig_registers
View
59 bin/varaha
@@ -0,0 +1,59 @@
+#!/usr/bin/env 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.
+
+cwd=`dirname $0`
+here=`readlink -f $cwd`
+varaha_home=$here/..
+
+# general jars.
+for jar in $varaha_home/lib/*.jar; do
+ CLASSPATH=$CLASSPATH:$jar
+done
+
+# varaha jar.
+VARAHA_JAR=`ls -1 $varaha_home/target/*.jar`
+if [ ! -e $VARAHA_JAR ]; then
+ echo "Unable to locate varaha jar: please run 'mvn package'." >&2
+ exit 1
+fi
+
+# write jars to file
+echo "register '$VARAHA_JAR';" > $here/.pig_registers
+for jar in $varaha_home/lib/*.jar; do
+ echo "register '$jar';" >> $here/.pig_registers
+done
+
+CLASSPATH=$CLASSPATH:$VARAHA_JAR
+
+if [ "x$PIG_HOME" = "x" ]; then
+ PIG_HOME=/usr/lib/pig
+ if [ ! -e $PIG_HOME ]; then
+ PIG_HOME=/usr/local/share/pig
+ fi
+fi
+
+# pig jar.
+PIG_JAR=$PIG_HOME/pig*core.jar
+if [ ! -e $PIG_JAR ]; then
+ echo "Unable to locate Pig jar" >&2
+ exit 1
+fi
+CLASSPATH=$CLASSPATH:$PIG_JAR
+
+export PIG_CLASSPATH=$PIG_CLASSPATH:$CLASSPATH
+cat "$cwd/.pig_registers" - | $PIG_HOME/bin/pig $*
View
2 scripts/document_clustering/cluster_documents.pig
@@ -16,8 +16,6 @@
-- limitations under the License.
--
-register '../../target/varaha-1.0-SNAPSHOT.jar'; -- yikes, just autoregister this in the runner
-
vectors = LOAD '$TFIDF' AS (doc_id:chararray, vector:bag {t:tuple (token:chararray, weight:double)});
k_centers = LOAD '$CURR_CENTERS' AS (doc_id:chararray, vector:bag {t:tuple (token:chararray, weight:double)});
View
3 scripts/document_clustering/tfidf.pig
@@ -15,9 +15,6 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-
-register '../../target/varaha-1.0-SNAPSHOT.jar'; -- yikes, just autoregister this in the runner
-register '../../lib/lucene-core-3.1.0.jar';
--
-- Load and tokenize the raw documents

0 comments on commit 492b4f3

Please sign in to comment.
Something went wrong with that request. Please try again.