Skip to content

Commit 4f2c2cb

Browse files
hddongyaooqinn
authored andcommitted
[KYUUBI #1764] Reuse the workingDir in ProcBuilder
<!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html 2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'. 3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'. --> ### _Why are the changes needed?_ <!-- Please clarify why the changes are needed. For instance, 1. If you add a feature, you can talk about the use case of it. 2. If you fix a bug, you can clarify why it is a bug. --> Reuse the workingDir in ProcBuilder for Trino ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [X] [Run test](https://kyuubi.readthedocs.io/en/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #1765 from hddong/reuse-workDir. Closes #1764 41152da [hongdongdong] fix c687d4f [hongdongdong] [KYUUBI #1764] Reuse the workingDir in ProcBuilder Authored-by: hongdongdong <hongdongdong@cmss.chinamobile.com> Signed-off-by: Kent Yao <yao@apache.org>
1 parent 7ef612c commit 4f2c2cb

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

kyuubi-server/src/main/scala/org/apache/kyuubi/engine/trino/TrinoProcessBuilder.scala

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ package org.apache.kyuubi.engine.trino
1919

2020
import java.net.URI
2121
import java.nio.file.Files
22-
import java.nio.file.Path
2322
import java.nio.file.Paths
2423

2524
import org.apache.kyuubi.KYUUBI_VERSION
2625
import org.apache.kyuubi.KyuubiSQLException
2726
import org.apache.kyuubi.Logging
2827
import org.apache.kyuubi.SCALA_COMPILE_VERSION
29-
import org.apache.kyuubi.Utils
3028
import org.apache.kyuubi.config.KyuubiConf
3129
import org.apache.kyuubi.config.KyuubiConf.ENGINE_TRINO_CONNECTION_CATALOG
3230
import org.apache.kyuubi.config.KyuubiConf.ENGINE_TRINO_CONNECTION_URL
@@ -114,32 +112,6 @@ class TrinoProcessBuilder(
114112

115113
override protected def commands: Array[String] = Array(executable)
116114

117-
override protected val workingDir: Path = {
118-
env.get("KYUUBI_WORK_DIR_ROOT").map { root =>
119-
val workingRoot = Paths.get(root).toAbsolutePath
120-
if (!Files.exists(workingRoot)) {
121-
debug(s"Creating KYUUBI_WORK_DIR_ROOT at $workingRoot")
122-
Files.createDirectories(workingRoot)
123-
}
124-
if (Files.isDirectory(workingRoot)) {
125-
workingRoot.toString
126-
} else null
127-
}.map { rootAbs =>
128-
val working = Paths.get(rootAbs, proxyUser)
129-
if (!Files.exists(working)) {
130-
debug(s"Creating $proxyUser's working directory at $working")
131-
Files.createDirectories(working)
132-
}
133-
if (Files.isDirectory(working)) {
134-
working
135-
} else {
136-
Utils.createTempDir(rootAbs, proxyUser)
137-
}
138-
}.getOrElse {
139-
Utils.createTempDir(namePrefix = proxyUser)
140-
}
141-
}
142-
143115
override def toString: String = commands.map {
144116
case arg if arg.startsWith("--") => s"\\\n\t$arg"
145117
case arg => arg

0 commit comments

Comments
 (0)