Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically schedule temporary resource files for delete on exit. #4616

Merged
merged 2 commits into from
Jun 5, 2018

Conversation

cmnbroad
Copy link
Collaborator

Fixes #4577.

@droazen droazen self-requested a review March 30, 2018 15:18
@droazen droazen self-assigned this Mar 30, 2018
try {
File tempLibSourceDir = IOUtils.tempDir("RlibSources.", "");
File tempLibInstallationDir = IOUtils.tempDir("Rlib.", "");
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency with BaseTest.createTempDir(), I think that IOUtils.tempDir() should register the temp dir for recursive deletion on exit via IOUtils.deleteRecursivelyOnExit()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

* @param targetDir target directory where the File should be written
* @return the newly created File containing the library
*/
public File writeLibrary(final File targetDir) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you have this method register its libraryFile for deletion on exit using createTempFile(), rename the method and adjust the javadoc appropriately? You'll need to add an overload of createTempFile() that takes a directory argument.

try {
return executeScript(tempResourceFile.getAbsolutePath(), pythonProcessArgs, scriptArgs);
} finally {
FileUtils.deleteQuietly(tempResourceFile);
Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to consider keeping this -- it doesn't hurt to delete early when possible, despite the delete on exits.

Copy link
Contributor

@droazen droazen left a comment

Choose a reason for hiding this comment

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

Review complete, back to @cmnbroad

@cmnbroad cmnbroad force-pushed the cn_delete_temp_resources branch from 5da784d to 1a33c3f Compare May 22, 2018 14:20
@cmnbroad cmnbroad force-pushed the cn_delete_temp_resources branch from 1a33c3f to 99d93e8 Compare May 23, 2018 16:20
@codecov-io
Copy link

Codecov Report

Merging #4616 into master will increase coverage by 0.202%.
The diff coverage is 96.154%.

@@               Coverage Diff               @@
##              master     #4616       +/-   ##
===============================================
+ Coverage     80.131%   80.333%   +0.202%     
- Complexity     17488     17762      +274     
===============================================
  Files           1085      1087        +2     
  Lines          63245     64310     +1065     
  Branches       10200     10533      +333     
===============================================
+ Hits           50679     51662      +983     
- Misses          8579      8603       +24     
- Partials        3987      4045       +58
Impacted Files Coverage Δ Complexity Δ
.../hellbender/utils/python/PythonScriptExecutor.java 63.636% <ø> (ø) 10 <0> (ø) ⬇️
...adinstitute/hellbender/utils/R/RScriptLibrary.java 100% <100%> (ø) 6 <2> (ø) ⬇️
...ellbender/tools/walkers/vqsr/CNNScoreVariants.java 74.537% <100%> (-0.349%) 41 <0> (ø)
...rg/broadinstitute/hellbender/utils/io/IOUtils.java 69.892% <100%> (+1.075%) 50 <2> (+1) ⬆️
...dinstitute/hellbender/utils/R/RScriptExecutor.java 80.282% <87.5%> (-0.274%) 17 <7> (ø)
...forms/markduplicates/MarkDuplicatesSparkUtils.java 87.64% <0%> (-1.857%) 72% <0%> (+10%)
...der/tools/walkers/mutect/M2ArgumentCollection.java 93.939% <0%> (-0.505%) 5% <0%> (+2%)
...hellbender/utils/haplotype/SAMFileDestination.java 100% <0%> (ø) 4% <0%> (+1%) ⬆️
...ecaller/AssemblyBasedCallerArgumentCollection.java 100% <0%> (ø) 1% <0%> (ø) ⬇️
...otypecaller/HaplotypeCallerArgumentCollection.java 100% <0%> (ø) 2% <0%> (ø) ⬇️
... and 16 more

Copy link
Contributor

@droazen droazen left a comment

Choose a reason for hiding this comment

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

👍 latest version looks good -- merging

@droazen droazen merged commit ed55f61 into master Jun 5, 2018
@droazen droazen deleted the cn_delete_temp_resources branch June 5, 2018 18:00
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.

3 participants