spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spr <>
Subject Streaming: which code is (not) executed at every batch interval?
Date Tue, 04 Nov 2014 17:43:39 GMT
The use case I'm working on has a main data stream in which a human needs to
modify what to look for.  I'm thinking to implement the main data stream
with Spark Streaming and the things to look for with Spark.
(Better approaches welcome.)

To do this, I have intermixed Spark and Spark Streaming code, and it appears
that the Spark code is not being executed every batch interval.  With
details elided, it looks like

    val sc = new SparkContext(conf)
    val ssc = new StreamingContext(conf, Seconds(10))

    var lines = ssc.textFileStream(dirArg)                         //  
====Spark Streaming code
    var linesArray = line => (line.split("\t")))

    val whiteFd = (new                  //  
====non-Spark-Streaming code
    if (whiteFd.lastModified > System.currentTimeMillis-(timeSliceArg*1000))
      // read the file into a var

//   ====Spark Streaming code
    var SvrCum = newState.updateStateByKey[(Int, Time, Time)](updateMyState)

It appears the non-Spark-Streaming code gets executed once at program
initiation but not repeatedly. So, two questions:

1)  Is it correct that Spark code does not get executed per batch interval?

2)  Is there a definition somewhere of what code will and will not get
executed per batch interval?  (I didn't find it in either the Spark or Spark
Streaming programming guides.)

View this message in context:
Sent from the Apache Spark User List mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message