Skip to content

Commit 83351b8

Browse files
committed
show missed input info in streaming info page
1 parent 95f4fba commit 83351b8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

streaming/src/main/scala/org/apache/spark/streaming/scheduler/JobScheduler.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import java.util.Properties
2121
import java.util.concurrent.{ConcurrentHashMap, TimeUnit}
2222

2323
import scala.collection.JavaConverters._
24+
import scala.collection.mutable.HashSet
2425
import scala.util.Failure
2526

2627
import org.apache.commons.lang.SerializationUtils
@@ -64,6 +65,8 @@ class JobScheduler(val ssc: StreamingContext) extends Logging {
6465

6566
private var eventLoop: EventLoop[JobSchedulerEvent] = null
6667

68+
private val inputInfoMissedTimes = HashSet[Time]()
69+
6770
def start(): Unit = synchronized {
6871
if (eventLoop != null) return // scheduler has already been started
6972

@@ -139,6 +142,7 @@ class JobScheduler(val ssc: StreamingContext) extends Logging {
139142
def submitJobSet(jobSet: JobSet) {
140143
if (jobSet.jobs.isEmpty) {
141144
logInfo("No jobs added for time " + jobSet.time)
145+
inputInfoMissedTimes.add(jobSet.time)
142146
} else {
143147
listenerBus.post(StreamingListenerBatchSubmitted(jobSet.toBatchInfo))
144148
jobSets.put(jobSet.time, jobSet)
@@ -193,6 +197,14 @@ class JobScheduler(val ssc: StreamingContext) extends Logging {
193197
listenerBus.post(StreamingListenerOutputOperationCompleted(job.toOutputOperationInfo))
194198
logInfo("Finished job " + job.id + " from job set of time " + jobSet.time)
195199
if (jobSet.hasCompleted) {
200+
// submit fake BatchCompleted event to show missing inputInfo on Streaming UI
201+
inputInfoMissedTimes.foreach (time => {
202+
val streamIdToInputInfos = inputInfoTracker.getInfo(time)
203+
val fakeJobSet = JobSet(time, Seq(), streamIdToInputInfos)
204+
listenerBus.post(StreamingListenerBatchCompleted(fakeJobSet.toBatchInfo))
205+
})
206+
inputInfoMissedTimes.clear()
207+
196208
jobSets.remove(jobSet.time)
197209
jobGenerator.onBatchCompletion(jobSet.time)
198210
logInfo("Total delay: %.3f s for time %s (execution: %.3f s)".format(

streaming/src/main/scala/org/apache/spark/streaming/scheduler/JobSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ case class JobSet(
5050

5151
def hasStarted: Boolean = processingStartTime > 0
5252

53-
def hasCompleted: Boolean = incompleteJobs.isEmpty
53+
def hasCompleted: Boolean = incompleteJobs.isEmpty && processingStartTime >= 0
5454

5555
// Time taken to process all the jobs from the time they started processing
5656
// (i.e. not including the time they wait in the streaming scheduler queue)

0 commit comments

Comments
 (0)