spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vanzin <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-7161][History Server] Provide REST api ...
Date Tue, 02 Jun 2015 18:33:36 GMT
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5792#discussion_r31555227
  
    --- Diff: core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala
---
    @@ -335,6 +337,53 @@ class FsHistoryProviderSuite extends FunSuite with BeforeAndAfter
with Matchers
         assert(!log2.exists())
       }
     
    +  test("Event log copy") {
    +    val provider = new FsHistoryProvider(createTestConf())
    +    val logs = (1 to 2).map { i =>
    +      val log = newLogFile("downloadApp1", Some(s"attempt$i"), inProgress = false)
    +      writeFile(log, true, None,
    +        SparkListenerApplicationStart(
    +          "downloadApp1", Some("downloadApp1"), 5000 * i, "test", Some(s"attempt$i")),
    +        SparkListenerApplicationEnd(5001 * i)
    +      )
    +      log
    +    }
    +    provider.checkForLogs()
    +
    +    (1 to 2).foreach { i =>
    +      val outDir = Utils.createTempDir()
    +      val unzipDir = Utils.createTempDir()
    +      try {
    +        Utils.chmod700(outDir)
    +        Utils.chmod700(unzipDir)
    +        val outFile = new File(outDir, s"file$i.zip")
    +        val outputStream = new ZipOutputStream(new FileOutputStream(outFile))
    +        provider.writeEventLogs("downloadApp1", Some(s"attempt$i"), outputStream)
    +        HistoryTestUtils.unzipToDir(new FileInputStream(outFile), unzipDir)
    +        val actualFiles = unzipDir.listFiles()
    +        assert(actualFiles.length == 1)
    +        actualFiles.foreach { actualFile =>
    +          val expFile = logs.find(_.getName == actualFile.getName).get
    +          val expStream = new FileInputStream(expFile)
    +          val resultStream = new FileInputStream(actualFile)
    +          try {
    +            val input = IOUtils.toString(expStream)
    --- End diff --
    
    You can simplify this by using guava's `Files.toString()` (which also allows you to set
the encoding).


---
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.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message