Skip to content

Commit

Permalink
move System.exit(exitCode) out of try block so that finally block can…
Browse files Browse the repository at this point in the history
… be executed. (#472)

* in progress

* in progress

Co-authored-by: Cheng Ren <[email protected]>
  • Loading branch information
burgerkingeater and burgerkingeater authored Sep 23, 2020
1 parent 23b148a commit e5dffef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ext.deps = [

allprojects {
group = "com.linkedin.tony"
project.version = "0.3.32"
project.version = "0.3.33"
}

task sourcesJar(type: Jar) {
Expand Down
14 changes: 8 additions & 6 deletions tony-core/src/main/java/com/linkedin/tony/TaskExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,28 +226,30 @@ public static void main(String[] unused) throws Exception {
// details.
if (executor != null) {
if (executor.isReusingPort()) {
LOG.info("Releasing reserved TB port before launching tensorflow process.");
LOG.info("Releasing reserved TB port before launching TensorFlow process.");
executor.releasePort(executor.tbPort);
} else {
LOG.info("Releasing reserved port(s) before launching tensorflow process.");
LOG.info("Releasing reserved port(s) before launching TensorFlow process.");
executor.releasePorts();
}
}

int exitCode;
try {
int exitCode = Utils.executeShell(executor.taskCommand, executor.timeOut, executor.shellEnv);
exitCode = Utils.executeShell(executor.taskCommand, executor.timeOut, executor.shellEnv);
// START - worker skew testing:
executor.skewAndHangIfTesting();
// END - worker skew testing:
executor.registerExecutionResult(exitCode, executor.jobName, String.valueOf(executor.taskIndex));
LOG.info("Child process exited with exit code " + exitCode);
System.exit(exitCode);
} finally {
if (executor.isReusingPort()) {
LOG.info("Tensorflow process exited, releasing reserved RPC port.");
LOG.info("TensorFlow process exited, releasing reserved RPC port.");
executor.releasePort(executor.rpcPort);
}
}

LOG.info("Child process exited with exit code " + exitCode);
System.exit(exitCode);
}

protected void initConfigs() {
Expand Down

0 comments on commit e5dffef

Please sign in to comment.