@@ -54,24 +54,26 @@ class HailSuite extends TestNGSuite with TestUtils {
5454 def setupHailContext (): Unit = {
5555 Logging .configureLogging(" /tmp/hail.log" , quiet = false , append = false )
5656 RVD .CheckRvdKeyOrderingForTesting = true
57- val backend = SparkBackend (
58- sc = new SparkContext (
59- SparkBackend .createSparkConf(
60- appName = " Hail.TestNG" ,
61- master = System .getProperty(" hail.master" ),
62- local = " local[2]" ,
63- blockSize = 0 ,
64- )
65- .set(" spark.unsafe.exceptionOnMemoryLeak" , " true" )
66- ),
67- skipLoggingConfiguration = true ,
57+ Backend .set(
58+ SparkBackend (
59+ sc = new SparkContext (
60+ SparkBackend .createSparkConf(
61+ appName = " Hail.TestNG" ,
62+ master = System .getProperty(" hail.master" ),
63+ local = " local[2]" ,
64+ blockSize = 0 ,
65+ )
66+ .set(" spark.unsafe.exceptionOnMemoryLeak" , " true" )
67+ ),
68+ skipLoggingConfiguration = true ,
69+ )
6870 )
69- HailSuite .hc_ = HailContext (backend)
71+ HailSuite .hc_ = HailContext .getOrCreate
7072 }
7173
7274 @ BeforeClass
7375 def setupExecuteContext (): Unit = {
74- val backend = HailSuite .hc_.backend .asSpark
76+ val backend = Backend .get .asSpark
7577 val conf = new Configuration (backend.sc.hadoopConfiguration)
7678 val fs = new HadoopFS (new SerializableHadoopConfiguration (conf))
7779 val pool = RegionPool ()
@@ -103,7 +105,7 @@ class HailSuite extends TestNGSuite with TestUtils {
103105
104106 hadoop.fs.FileSystem .closeAll()
105107
106- if (HailSuite .hc_.backend.asSpark.sc .isStopped)
108+ if (SparkBackend .sparkContext .isStopped)
107109 throw new RuntimeException (s " ' ${context.getName}' stopped spark context! " )
108110 }
109111
0 commit comments