Skip to content

Commit

Permalink
fix process IO
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdullinAM committed Apr 22, 2024
1 parent bb4d048 commit e41d05f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class ExecutorMaster(
"--option", "kex:log:${outputDir.resolve("kex-executor-worker$id.log").toAbsolutePath()}",
"--classpath", kfgClassPath.joinToString(getPathSeparator()),
"--port", "${connection.workerPort}"
)
).inheritIO()
log.debug("Starting worker process with command: '${pb.command().joinToString(" ")}'")
return pb.start()
}
Expand Down Expand Up @@ -139,6 +139,9 @@ class ExecutorMaster(
fun destroy() {
workerConnection.close()
process.destroy()
if (process.isAlive) {
process.destroyForcibly()
}
}
}

Expand Down Expand Up @@ -182,7 +185,9 @@ class ExecutorMaster(
}

fun destroy() {
log.debug("Master is destroying all the workers")
for (worker in workers) {
log.debug("Destroying worker ${worker.id}")
worker.destroy()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ internal object ExecutorMasterController : AutoCloseable {
"--kfgClassPath", kfgClassPath.joinToString(getPathSeparator()),
"--workerClassPath", workerClassPath.joinToString(getPathSeparator()),
"--numOfWorkers", "$numberOfWorkers"
)
).inheritIO()
log.debug("Starting executor master process with command: '${pb.command().joinToString(" ")}'")
process = pb.start()
runBlocking {
Expand All @@ -85,6 +85,9 @@ internal object ExecutorMasterController : AutoCloseable {

override fun close() {
process.destroy()
if (process.isAlive) {
process.destroyForcibly()
}
controllerSocket.close()
}
}
Expand Down

0 comments on commit e41d05f

Please sign in to comment.