Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix race condition
  • Loading branch information
grundprinzip committed Feb 18, 2024
commit 962dfd4036f297554db5347d20e71b2b97e6c48b
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ private[connect] class ConnectProgressExecutionListener extends SparkListener wi
})
}

def tryGetTracker(tag: String): Option[ExecutionTracker] = {
trackedTags.get(tag)
}

def registerJobTag(tag: String): Unit = {
trackedTags += tag -> new ExecutionTracker(tag)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ private[connect] class ExecuteGrpcResponseSender[T <: Message](
*/
private def enqueueProgressMessage(): Unit = {
SparkConnectService.executionListener.foreach { listener =>
if (listener.trackedTags.contains(executeHolder.jobTag)) {
val tracker = listener.trackedTags(executeHolder.jobTag)
// It is possible, that the tracker is no longer available and in this
// case we simply ignore it and do not send any progress message. This avoids
// having to synchronize on the listener.
listener.tryGetTracker(executeHolder.jobTag).foreach { tracker =>
// Only send progress message if there is something new to report.
tracker.yieldWhenDirty {
(tasks, tasksCompleted, stages, stagesCompleted, inputBytesRead) =>
Expand Down