comphead commented on code in PR #6401:
URL: https://github.com/apache/datafusion-comet/pull/6401#discussion_r4139748883
##########
spark/src/main/scala/org/apache/comet/CometExecIterator.scala:
##########
@@ -527,6 +551,55 @@ object CometExecIterator extends Logging {
}
}
+ /**
+ * Sends a memory usage sample to the driver, which posts it to the listener
bus for the event
+ * log to record, and returns whether it did. It does when the application
writes an event log,
+ * which `spark.eventLog.enabled` shows on the executor as well as on the
driver, and the
+ * executor runs the Comet plugin, whose channel to the driver carries the
sample. Both are
+ * checked for every sample rather than once, because in local mode each
SparkContext starts its
+ * own executor plugin. A failure to send is not retried: those that surface
here, such as a
+ * driver endpoint that could not be found, persist, so the log falls back
to the executor's log
+ * for good.
+ */
+ private[apache] def sendToEventLog(usage: Array[Long], jvmArrow:
JvmArrowMemory): Boolean =
+ (Option(SparkEnv.get), CometExecutorPlugin.pluginContext) match {
+ case (Some(env), Some(pluginContext))
+ if !eventLogSendFailed && env.conf.getBoolean(EVENT_LOG_ENABLED,
false) =>
Review Comment:
Agreed on the cost. I moved the summary to the driver rather than the
executor, though. An executor that holds a summary loses it when the
application stops: `stopExecutors()` sends `StopExecutor` one-way and the
driver stops its listener bus milliseconds later, so a run shorter than the
window would keep only its first sample. Executors still send each sample. The
driver keeps, per executor, the peak and the last sample of each minute, and
writes what it holds when an executor is removed and when the application ends.
That is about two events per busy executor per minute whatever the interval.
The listener that writes at application end runs on a listener bus queue of its
own, because on 3.4 and 3.5 the bus stops before the plugins shut down, and a
slow listener on the shared queue could otherwise hold the application's end
back until the bus has stopped.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]