cloud-fan commented on code in PR #57754:
URL: https://github.com/apache/spark/pull/57754#discussion_r3748463747
##########
sql/connect/server/src/main/scala/org/apache/spark/sql/connect/ml/MLCache.scala:
##########
@@ -280,4 +313,40 @@ private[connect] class MLCache(sessionHolder:
SessionHolder) extends Logging {
}
info.result()
}
+
+ /** Returns a cache snapshot without loading or touching any cached model. */
+ def getStatus: MLCacheStatus = this.synchronized {
+ val models = mutable.ArrayBuilder.make[MLCacheModelInfo]
+ cachedModelMetadata.asScala.foreach { case (id, metadata) =>
+ models += MLCacheModelInfo(
+ id = id,
+ className = metadata.className,
+ modelString = metadata.modelString,
+ estimatedSizeBytes = metadata.estimatedSizeBytes,
+ inMemory = inMemoryModelIds.contains(id))
+ }
+ MLCacheStatus(
+ memoryControlEnabled = getMemoryControlEnabled,
+ inMemorySizeBytes = totalMLCacheInMemorySizeBytes.get(),
+ maxInMemorySizeBytes = sessionHolder.session.conf.get(
+
Connect.CONNECT_SESSION_CONNECT_ML_CACHE_MEMORY_CONTROL_MAX_IN_MEMORY_SIZE),
+ totalSizeBytes = totalMLCacheSizeBytes.get(),
+ maxTotalSizeBytes = getMLCacheMaxSize,
+ models = models.result().toIndexedSeq.sortBy(_.id))
Review Comment:
This per-session sort is discarded by the UI: `generateMLCacheStatsTable`
concatenates all session snapshots, and `MLCacheModelTableDataSource` sorts the
complete row set again using the requested column. Please return the snapshot
without `sortBy` so each refresh performs only the display ordering.
--
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]