Set tpie::tempname
before calling tpie_init()
#694
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This avoids an additional directory named
TPIE_<date>_<…>
at the default tmp path.About a year ago, when executing benchmarks in a scripted way, I ran into the problem that the BDDs produced by Adiar filled up the entire disk. Because of that, the benchmarking process crashed and left the files there, so my benchmark runner script was not even able to create new log files for the upcoming benchmarks. That was when I started to use the
-T
option in BDD benchmark to make Adiar write to a location I previously created using Python’stempfile.TemporaryDirectory()
, so I could be sure that would be cleaned even upon timeouts and crashes.However, that fix seemed to be ineffective, Adiar still created directories named
TPIE_<date>_<…>
in my/tmp
folder. So I added two additional lines to my benchmark running script to remove/tmp/TPIE_*
after every benchmark item. Recently, I’ve switched to parallel execution of benchmarks, and it just came to my mind that removing all/tmp/TPIE_*
might also remove the folders of another Adiar process, which could lead to crashes. Fortunately, there were no such crashes, but it made me think I should fix that issue in my script.Seeking for solutions, I noticed that Adiar sets the temporary directory of TPIE only after initializing TPIE. So the
/tmp/TPIE_*
directories were probably created during the initialization, and afterwards TPIE switched to the other location. I just moved the initialization after setting TPIE’s temporary directory, and it worked as expected.For sure, you know a lot more than me about TPIE, so please re-check that this change does not introduce any unwanted side-effects.
(EDIT: This is not urgent at all, it seems like the
/tmp/TPIE_*
directories stay below 1 MiB in size each, so I could just drop the removal of these directories from my script.)