@@ -4,14 +4,14 @@ import is.hail.{HailContext, HailFeatureFlags}
44import is .hail .annotations ._
55import is .hail .asm4s ._
66import is .hail .backend ._
7+ import is .hail .backend .caching .BlockMatrixCache
78import is .hail .backend .py4j .Py4JBackendExtensions
89import is .hail .expr .Validate
910import is .hail .expr .ir ._
1011import is .hail .expr .ir .analyses .SemanticHash
1112import is .hail .expr .ir .lowering ._
1213import is .hail .io .{BufferSpec , TypedCodecSpec }
1314import is .hail .io .fs ._
14- import is .hail .linalg .BlockMatrix
1515import is .hail .rvd .RVD
1616import is .hail .types ._
1717import is .hail .types .physical .{PStruct , PTuple }
@@ -351,20 +351,8 @@ class SparkBackend(
351351 override val longLifeTempFileManager : TempFileManager =
352352 new OwningTempFileManager (fs)
353353
354- val bmCache : SparkBlockMatrixCache = SparkBlockMatrixCache ()
355-
356- def persist (backendContext : BackendContext , id : String , value : BlockMatrix , storageLevel : String )
357- : Unit = bmCache.persistBlockMatrix(id, value, storageLevel)
358-
359- def unpersist (backendContext : BackendContext , id : String ): Unit = unpersist(id)
360-
361- def getPersistedBlockMatrix (backendContext : BackendContext , id : String ): BlockMatrix =
362- bmCache.getPersistedBlockMatrix(id)
363-
364- def getPersistedBlockMatrixType (backendContext : BackendContext , id : String ): BlockMatrixType =
365- bmCache.getPersistedBlockMatrixType(id)
366-
367- def unpersist (id : String ): Unit = bmCache.unpersistBlockMatrix(id)
354+ private [this ] val bmCache : BlockMatrixCache =
355+ new BlockMatrixCache ()
368356
369357 def createExecuteContextForTests (
370358 timer : ExecutionTimer ,
@@ -387,6 +375,7 @@ class SparkBackend(
387375 ExecutionCache .forTesting
388376 },
389377 new IrMetadata (),
378+ ImmutableMap .empty,
390379 )
391380
392381 override def withExecuteContext [T ](f : ExecuteContext => T )(implicit E : Enclosing ): T =
@@ -406,6 +395,7 @@ class SparkBackend(
406395 ExecutionCache .fromFlags(flags, fs, tmpdir)
407396 },
408397 new IrMetadata (),
398+ bmCache,
409399 )(f)
410400 }
411401
@@ -470,6 +460,7 @@ class SparkBackend(
470460 override def asSpark (op : String ): SparkBackend = this
471461
472462 def close (): Unit = {
463+ bmCache.close()
473464 SparkBackend .stop()
474465 longLifeTempFileManager.close()
475466 }
0 commit comments