spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pwendell <...@git.apache.org>
Subject [GitHub] spark pull request: SPARK-1195: set map_input_file environment var...
Date Fri, 07 Mar 2014 06:45:07 GMT
Github user pwendell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/94#discussion_r10374683
  
    --- Diff: core/src/test/scala/org/apache/spark/PipedRDDSuite.scala ---
    @@ -89,4 +97,37 @@ class PipedRDDSuite extends FunSuite with SharedSparkContext {
         }
       }
     
    +  test("test pipe exports map_input_file") {
    +    testExportInputFile("map_input_file")
    +  }
    +
    +  test("test pipe exports mapreduce_map_input_file") {
    +    testExportInputFile("mapreduce_map_input_file")
    +  }
    +
    +  def testExportInputFile(varName:String) {
    +    val nums = new HadoopRDD(sc, new JobConf(), classOf[TextInputFormat], classOf[LongWritable],
    +        classOf[Text], 2) {
    +      override def getPartitions: Array[Partition] = Array(generateFakeHadoopPartition())
    +      override val getDependencies = List[Dependency[_]]()
    +      override def compute(theSplit: Partition, context: TaskContext) = {
    +        new InterruptibleIterator[(LongWritable, Text)](context, Iterator((new LongWritable(1),
    +          new Text("b"))))
    +      }
    +    }
    +    val hadoopPart1 = generateFakeHadoopPartition()
    +    val pipedRdd = new PipedRDD(nums, "printenv " + varName)
    --- End diff --
    
    Ah I see - well then since your'e just doing what's there already I guess it's fine. But
if you want to be a true hero, I think something like this would work:
    ```
    import scala.util.Try
    import scala.sys.process._
    val hasPrintEnv = Try(Process("printenv")!!).isSuccess
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message