pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xu...@apache.org
Subject svn commit: r1735539 - /pig/branches/spark/src/org/apache/pig/backend/hadoop/executionengine/spark/SparkLauncher.java
Date Fri, 18 Mar 2016 04:22:23 GMT
Author: xuefu
Date: Fri Mar 18 04:22:23 2016
New Revision: 1735539

URL: http://svn.apache.org/viewvc?rev=1735539&view=rev
Log:
PIG-4837: TestNativeMapReduce test fix, dignosis code only (Liyun via Xuefu)

Modified:
    pig/branches/spark/src/org/apache/pig/backend/hadoop/executionengine/spark/SparkLauncher.java

Modified: pig/branches/spark/src/org/apache/pig/backend/hadoop/executionengine/spark/SparkLauncher.java
URL: http://svn.apache.org/viewvc/pig/branches/spark/src/org/apache/pig/backend/hadoop/executionengine/spark/SparkLauncher.java?rev=1735539&r1=1735538&r2=1735539&view=diff
==============================================================================
--- pig/branches/spark/src/org/apache/pig/backend/hadoop/executionengine/spark/SparkLauncher.java
(original)
+++ pig/branches/spark/src/org/apache/pig/backend/hadoop/executionengine/spark/SparkLauncher.java
Fri Mar 18 04:22:23 2016
@@ -17,8 +17,10 @@
  */
 package org.apache.pig.backend.hadoop.executionengine.spark;
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.io.PrintStream;
 import java.nio.file.Files;
 import java.nio.file.Paths;
@@ -454,11 +456,38 @@ public class SparkLauncher extends Launc
         return sparkPlan;
     }
 
+    private static String executeCommand(String command) {
+
+        StringBuffer output = new StringBuffer();
+
+        Process p;
+        try {
+            p = Runtime.getRuntime().exec(command);
+            p.waitFor();
+            BufferedReader reader =
+                    new BufferedReader(new InputStreamReader(p.getInputStream()));
+
+            String line = "";
+            while ((line = reader.readLine())!= null) {
+                output.append(line + "\n");
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return output.toString();
+
+    }
+
+
     /**
      * Only one SparkContext may be active per JVM (SPARK-2243). When multiple threads start
SparkLaucher,
      * the static member sparkContext should be initialized only once
      */
     private static synchronized void startSparkIfNeeded(PigContext pc) throws PigException
{
+        String ARG_MAX= executeCommand("getconf ARG_MAX");
+        LOG.info("ARG_MAX:"+ARG_MAX);
         if (sparkContext == null) {
             String master = null;
             if (pc.getExecType().isLocal()) {



Mime
View raw message