Skip to content

Commit 3ede219

Browse files
committed
[query] simplify DeployContext
1 parent 5339e98 commit 3ede219

File tree

4 files changed

+19
-25
lines changed

4 files changed

+19
-25
lines changed

hail/hail/src/is/hail/backend/driver/BatchQueryDriver.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ object BatchQueryDriver extends HttpLikeRpc with Logging {
135135

136136
log.info(f"${getClass.getName} $HAIL_PRETTY_VERSION")
137137

138-
val deployConfig = DeployConfig.fromConfigFile("/deploy-config/deploy-config.json")
139-
DeployConfig.set(deployConfig)
140138
sys.env.get("HAIL_SSL_CONFIG_DIR").foreach(tls.setSSLConfigFromDir)
141139

142140
val (rpcConfig, jobConfig, action, payload) = {
@@ -187,7 +185,10 @@ object BatchQueryDriver extends HttpLikeRpc with Logging {
187185
val backend =
188186
new ServiceBackend(
189187
name,
190-
BatchClient(deployConfig, Path.of(scratchDir, "secrets/gsa-key/key.json")),
188+
BatchClient(
189+
DeployConfig.fromConfigFile("/deploy-config/deploy-config.json"),
190+
Path.of(scratchDir, "secrets/gsa-key/key.json"),
191+
),
191192
JarUrl(jarLocation),
192193
BatchConfig.fromConfigFile(Path.of(scratchDir, "batch-config/batch-config.json")),
193194
jobConfig,

hail/hail/src/is/hail/backend/service/Worker.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ object Worker extends Logging {
175175
val index = argv(6).toInt
176176
val timer = new WorkerTimer()
177177

178-
val deployConfig = DeployConfig.fromConfigFile("/deploy-config/deploy-config.json")
179-
DeployConfig.set(deployConfig)
180178
sys.env.get("HAIL_SSL_CONFIG_DIR").foreach(tls.setSSLConfigFromDir)
181179

182180
log.info(s"${getClass.getName} $HAIL_REVISION")

hail/hail/src/is/hail/services/DeployConfig.scala

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,7 @@ import org.json4s._
88
import org.json4s.jackson.JsonMethods
99

1010
object DeployConfig {
11-
private[this] lazy val default: DeployConfig = fromConfigFile()
12-
private[this] var _get: DeployConfig = null
13-
14-
def set(x: DeployConfig) =
15-
_get = x
16-
17-
def get(): DeployConfig = {
18-
if (_get == null) {
19-
_get = default
20-
}
21-
_get
22-
}
11+
lazy val default: DeployConfig = fromConfigFile()
2312

2413
def fromConfigFile(file0: String = null): DeployConfig = {
2514
var file = file0

hail/hail/test/src/is/hail/services/BatchClientSuite.scala

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,21 @@ class BatchClientSuite extends TestNGSuite {
2525

2626
@BeforeClass
2727
def createClientAndBatch(): Unit = {
28-
client = BatchClient(DeployConfig.get(), Path.of("/test-gsa-key/key.json"))
29-
batchId = client.newBatch(
30-
BatchRequest(
31-
billing_project = "test",
32-
n_jobs = 0,
33-
token = tokenUrlSafe,
34-
attributes = Map("name" -> s"${getClass.getName}"),
28+
client =
29+
BatchClient(
30+
DeployConfig.default,
31+
Path.of("/test-gsa-key/key.json"),
32+
)
33+
34+
batchId =
35+
client.newBatch(
36+
BatchRequest(
37+
billing_project = "test",
38+
n_jobs = 0,
39+
token = tokenUrlSafe,
40+
attributes = Map("name" -> s"${getClass.getName}"),
41+
)
3542
)
36-
)
3743
}
3844

3945
@BeforeMethod

0 commit comments

Comments
 (0)