Author: gates
Date: Thu Dec  6 16:53:28 2007
New Revision: 601939

URL: http://svn.apache.org/viewvc?rev=601939&view=rev
Log:
PIG-45: Fixed pig.pl to not assume hodrc file is named the same as
cluster name (gates).

Modified:
    incubator/pig/trunk/CHANGES.txt
    incubator/pig/trunk/scripts/pig.pl

Modified: incubator/pig/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/CHANGES.txt?rev=601939&r1=601938&r2=601939&view=diff
==============================================================================
--- incubator/pig/trunk/CHANGES.txt (original)
+++ incubator/pig/trunk/CHANGES.txt Thu Dec  6 16:53:28 2007
@@ -40,3 +40,6 @@
 
     PIG-43: fixed problem where using the combiner prevented a pig alias
     from being evaluated more than once. (gates)
+
+    PIG-45: Fixed pig.pl to not assume hodrc file is named the same as
+    cluster name (gates).

Modified: incubator/pig/trunk/scripts/pig.pl
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/scripts/pig.pl?rev=601939&r1=601938&r2=601939&view=diff
==============================================================================
--- incubator/pig/trunk/scripts/pig.pl (original)
+++ incubator/pig/trunk/scripts/pig.pl Thu Dec  6 16:53:28 2007
@@ -19,7 +19,7 @@
 # Read our configuration file.  This will fill in values for pigJarRoot
 # and hodRoot.
 our $ROOT = (defined($ENV{'ROOT'}) ? $ENV{'ROOT'} : "/home/y");
-my ($pigJarRoot, $hodRoot);
+my ($pigJarRoot, $hodRoot, $defaultCluster);
 
 open(CFG, "< $ROOT/conf/pigclient.conf") or
        die "Can't open $ROOT/conf/pigclient.conf, $ERRNO\n";
@@ -67,6 +67,16 @@
 
 if (defined $classpath)
 {
+    # Check to make sure that the jar file specified in the class path is
+    # available.
+    $classpath =~ /(^|:)([^:]*pig.jar)($|:)/;
+    my $jar = $2;
+    if (!(-e $jar)) {
+        die "I can't find the jar file $jar.  If you explicitly
+put this jar in your classpath, please check that you have the path name
+correct.  If you specified a cluster via -c[luster], then the pig jar for
+that cluster is not present on this machine.\n";
+    }
        push (@javaArgs, "-cp", $classpath);
 }
 
@@ -89,10 +99,10 @@
 
 # If we aren't attaching to kryptonite, set up the right hod config file.
 if ($cluster ne "kryptonite") {
-       my $hodCfg = "$hodRoot/conf/$cluster";
-       if (-e $hodCfg) {
-               $hodParam .= "--config=$hodCfg";
-       } else {
+    # With splitting of gateways, HOD file is always hodrc, no matter what
+    # cluster you're talking to.
+       my $hodCfg = "$hodRoot/conf/hodrc";
+       if (! (-e $hodCfg)) {
                push(@cmd, "-Dhod.server=");
                warn "I can't find HOD configuration for $cluster, hopefully 
you weren't planning on using HOD.\n";
        }
@@ -118,8 +128,9 @@
        # first, figure out if we are working with a deployed cluster 
        if (!(defined $cluster) && (!(defined $classpath) || !($classpath 
=~/pig.jar/)))
        {
-               # we are using default cluster
-               $cluster = 'kryptonite';
+               # we are using default cluster, the name of which is stored in 
the
+        # pigclient.conf file.
+               $cluster = $defaultCluster;
        }
 
        # we are running from a cluster


Reply via email to