the-algorithm/graph-feature-service/src/main/scala/com/twitter/graph_feature_service/worker/util/GraphContainer.scala
twitter-team ef4c5eb65e Twitter Recommendation Algorithm
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
2023-03-31 17:36:31 -05:00

20 lines
565 B
Scala

package com.twitter.graph_feature_service.worker.util
import com.twitter.graph_feature_service.thriftscala.EdgeType
import com.twitter.util.Future
case class GraphContainer(
graphs: Map[GraphKey, AutoUpdatingGraph]) {
final val toPartialMap: Map[EdgeType, AutoUpdatingGraph] =
graphs.collect {
case (partialValueGraph: PartialValueGraph, graph) =>
partialValueGraph.edgeType -> graph
}
// load all the graphs from constantDB format to memory
def warmup: Future[Unit] = {
Future.collect(graphs.mapValues(_.warmup())).unit
}
}