hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r529379 - in /lucene/hadoop/trunk: CHANGES.txt src/contrib/streaming/src/java/org/apache/hadoop/streaming/MustangFile.java src/contrib/streaming/src/java/org/apache/hadoop/streaming/PipeMapRed.java src/java/org/apache/hadoop/fs/FileUtil.java
Date Mon, 16 Apr 2007 19:37:03 GMT
Author: cutting
Date: Mon Apr 16 12:37:01 2007
New Revision: 529379

URL: http://svn.apache.org/viewvc?view=rev&rev=529379
Log:
HADOOP-1250.  Move a chmod utility from streaming to FileUtil.  Contributed by Owen.

Removed:
    lucene/hadoop/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/MustangFile.java
Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/PipeMapRed.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileUtil.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=529379&r1=529378&r2=529379
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Mon Apr 16 12:37:01 2007
@@ -204,6 +204,8 @@
 61. HADOOP-1214.  Replace streaming classes with new counterparts 
     from Hadoop core.  (Runping Qi via tomwhite)
 
+62. HADOOP-1250.  Move a chmod utility from streaming to FileUtil.
+    (omalley via cutting)
 
 Release 0.12.3 - 2007-04-06
 

Modified: lucene/hadoop/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/PipeMapRed.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/PipeMapRed.java?view=diff&rev=529379&r1=529378&r2=529379
==============================================================================
--- lucene/hadoop/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/PipeMapRed.java
(original)
+++ lucene/hadoop/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/PipeMapRed.java
Mon Apr 16 12:37:01 2007
@@ -21,7 +21,6 @@
 import java.io.*;
 import java.net.Socket;
 import java.net.URI;
-import java.nio.channels.*;
 import java.nio.charset.CharacterCodingException;
 import java.io.IOException;
 import java.util.Date;
@@ -34,6 +33,7 @@
 
 import org.apache.commons.logging.*;
 
+import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.mapred.FileSplit;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.PhasedFileSystem;
@@ -45,10 +45,8 @@
 import org.apache.hadoop.io.BytesWritable;
 import org.apache.hadoop.io.Writable;
 
-import org.apache.hadoop.fs.LocalFileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.FSDataOutputStream;
 
 /** Shared functionality for PipeMapper, PipeReducer.
  *  @author Michel Tourn
@@ -229,13 +227,12 @@
       }
       String[] argvSplit = splitArgs(argv);
       String prog = argvSplit[0];
-      String userdir = System.getProperty("user.dir");
       File currentDir = new File(".").getAbsoluteFile();
       File jobCacheDir = new File(currentDir.getParentFile().getParent(), "work");
       if (new File(prog).isAbsolute()) {
         // we don't own it. Hope it is executable
       } else {
-        new MustangFile(new File(jobCacheDir, prog).toString()).setExecutable(true, true);
+        FileUtil.chmod(new File(jobCacheDir, prog).toString(), "a+x");
       }
 
       if (job_.getInputValueClass().equals(BytesWritable.class)) {
@@ -628,7 +625,6 @@
 
   String numRecInfo() {
     long elapsed = (System.currentTimeMillis() - startTime_) / 1000;
-    long total = numRecRead_ + numRecWritten_ + numRecSkipped_;
     return "R/W/S=" + numRecRead_ + "/" + numRecWritten_ + "/" + numRecSkipped_ + " in:"
         + safeDiv(numRecRead_, elapsed) + " [rec/s]" + " out:" + safeDiv(numRecWritten_,
elapsed)
         + " [rec/s]";

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileUtil.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileUtil.java?view=diff&rev=529379&r1=529378&r2=529379
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileUtil.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileUtil.java Mon Apr 16 12:37:01 2007
@@ -396,4 +396,19 @@
    }
    return returnVal;
  }
+  
+  /**
+   * Change the permissions on a filename.
+   * @param filename the name of the file to change
+   * @param perm the permission string
+   * @return the exit code from the command
+   * @throws IOException
+   * @throws InterruptedException
+   */
+  public static int chmod(String filename, String perm
+                          ) throws IOException, InterruptedException {
+    String cmd = "chmod " + perm + " " + filename;
+    Process p = Runtime.getRuntime().exec( cmd, null );
+    return p.waitFor();
+  }
 }



Mime
View raw message