ConstantInputDStream.print() does nothing

103 views Asked by At

I'm trying to get a simple DStream to print but with no success. See code below. I'm using a Databricks notebook in Azure.

import org.apache.spark.streaming.{ StreamingContext, Seconds }
val ssc = new StreamingContext(sc, batchDuration = Seconds(5))

ssc.checkpoint(".")

val rdd = sc.parallelize(0 to 3)
import org.apache.spark.streaming.dstream.ConstantInputDStream
val stream = new ConstantInputDStream(ssc, rdd)

println("start")

stream.print()

ssc.start()

The output is:

start

warning: there was one feature warning; re-run with -feature for details
import org.apache.spark.streaming.{StreamingContext, Seconds}
ssc: org.apache.spark.streaming.StreamingContext = org.apache.spark.streaming.StreamingContext@4d01c7b1
rdd: org.apache.spark.rdd.RDD[Int] = MapPartitionsRDD[1] at map at command-3696830887613521:7
import org.apache.spark.streaming.dstream.ConstantInputDStream
stream: org.apache.spark.streaming.dstream.ConstantInputDStream[Int] = org.apache.spark.streaming.dstream.ConstantInputDStream@12b9db22

I'm expecting to see 0,1,2 in one way or another.

I've also tried adding

ssc.awaitTermination()

but it never finishes. See screenshot: enter image description here

0

There are 0 answers