YongGang commented on code in PR #14887:
URL: https://github.com/apache/druid/pull/14887#discussion_r1303568359
##########
extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesPeonLifecycle.java:
##########
@@ -145,6 +153,28 @@ protected synchronized TaskStatus run(Job job, long
launchTimeout, long timeout)
}
}
+ private void writeTaskPayload(Task task)
+ {
+ try {
+ Path file = Files.createTempFile(taskId.getOriginalTaskId(),
"task.json");
+ try {
Review Comment:
Don't think we need to handle the IOException explicitly as it is wrapped to
RuntimeException anyway.
So the code can be like:
```
Path file = null;
try {
file = Files.createTempFile(taskId.getOriginalTaskId(), "task.json");
FileUtils.writeStringToFile(file.toFile(),
mapper.writeValueAsString(task), Charset.defaultCharset());
taskLogs.pushTaskPayload(task.getId(), file.toFile());
}
catch (Exception e) {
log.error("Failed to write task payload for task: %s",
taskId.getOriginalTaskId());
throw new RuntimeException(e);
}
finally {
if (file ! = null) {
Files.deleteIfExists(file);
}
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]