Skip to content

[Java] Automatically clean up temp files.#5507

Merged
jovany-wang merged 8 commits intoray-project:masterfrom
antgroup:java_rm_temp_file
Aug 24, 2019
Merged

[Java] Automatically clean up temp files.#5507
jovany-wang merged 8 commits intoray-project:masterfrom
antgroup:java_rm_temp_file

Conversation

@raulchen
Copy link
Copy Markdown
Contributor

Why are these changes needed?

Previously, we depends on File::deleteOnExit to delete temp files. This way sometimes cannot work if the JVM doesn't exit gracefully. This issue may lead to eating up disk space.

What do these changes do?

  • This PR removes the temp files right after using it.
  • Also remove some unused Java code.

Related issue number

Linter

  • I've run scripts/format.sh to lint the changes in this PR.

Copy link
Copy Markdown
Member

@kfstorm kfstorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job!

return false;
@Override
public void close() {
Preconditions.checkState(file.delete(), "Couldn't delete file {}", file.getAbsolutePath());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer a warning message instead of a check here.

startProcess(command, null, "raylet");
try (FileUtil.TempFile rayletFile = FileUtil.getTempFileFromResource("raylet")) {
rayletFile.getFile().setExecutable(true);
List<String> command = ImmutableList.of(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised that CI isn't able to catch this!

@AmplabJenkins
Copy link
Copy Markdown

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/16457/
Test PASSed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/16459/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/16490/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/16495/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/16500/
Test FAILed.

@jovany-wang jovany-wang merged commit fab5ae6 into ray-project:master Aug 24, 2019
@jovany-wang jovany-wang deleted the java_rm_temp_file branch August 24, 2019 09:20
kfstorm added a commit to antgroup/ant-ray that referenced this pull request Aug 27, 2019
kfstorm added a commit to antgroup/ant-ray that referenced this pull request Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants