Github user ahmed-mahran commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13866#discussion_r68323120
  
    --- Diff: 
streaming/src/test/scala/org/apache/spark/streaming/StreamingContextSuite.scala 
---
    @@ -327,6 +329,50 @@ class StreamingContextSuite extends SparkFunSuite with 
BeforeAndAfter with Timeo
         }
       }
     
    +  test("stop gracefully - clear all metadata") {
    +    val conf = new SparkConf().setMaster(master).setAppName(appName)
    +    conf.set("spark.dummyTimeConfig", "3600s")
    +    conf.set("spark.streaming.gracefulStopTimeout", "15s")
    +    sc = new SparkContext(conf)
    +    for (i <- 1 to 4) {
    +      logInfo("==================================\n\n\n")
    +      ssc = new StreamingContext(sc, Milliseconds(100))
    +      val checkpointDirectory = Utils.createTempDir().getAbsolutePath()
    +      ssc.checkpoint(checkpointDirectory)
    +      val rddsArray = new CopyOnWriteArrayList[BlockRDD[_]]()
    +      TestReceiver.counter.set(1)
    +      val input = ssc.receiverStream(new TestReceiver)
    +      input.checkpoint(Seconds(1)).foreachRDD { rdd =>
    +        rdd match {
    +          case blockRDD: BlockRDD[_] =>
    +            rddsArray.add(blockRDD)
    +            blockRDD.count
    +        }
    +      }
    +      ssc.start()
    +      // wait for enough jobs to be generated
    +      Thread.sleep(5000)
    +      eventually(timeout(5.seconds), interval(10.millis)) {
    +        assert(rddsArray.size > 0)
    +      }
    +      ssc.stop(stopSparkContext = false, stopGracefully = true)
    +      Utils.deleteRecursively(new File(checkpointDirectory))
    +      val rdds = rddsArray.toArray.map(_.asInstanceOf[BlockRDD[_]]).toSeq
    --- End diff --
    
    Here, I just wanted a Scala friendly version of the collection, `toArray` 
returns an array of `Object` hence the cast ... will use 
`JavaConversions.collectionAsScalaIterable(generatedRDDs)`


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to