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

Tempfile cleanup #3

Open
fyrdahl opened this issue Mar 20, 2022 · 0 comments
Open

Tempfile cleanup #3

fyrdahl opened this issue Mar 20, 2022 · 0 comments

Comments

@fyrdahl
Copy link

fyrdahl commented Mar 20, 2022

Problem: It appears that temp files are accumulating when repeatedly running scripts using bartpy. This behavior is different from the "old" Python wrapper found within BART.

Expected outcome: The wrapper should delete temp files

Observed outcome: Temp files are not deleted

Proposed solution: Either using context managers or keeping track of created files and deleting manually. I believe the latter is how the old wrapper does it. I would be happy to work on a patch for this, but I felt like it may involve some substantial changes, so I decided to open an issue for potential discussions first.

MWE:

import bartpy.tools as bart
phantom = bart.phantom()
du -sh /tmp
for i in {1..100}
do
    python3 test.py
done
du -sh /tmp

Output:

264K    /tmp
14M     /tmp

The same problem does not occur if using the "old" Python wrapper:

from bart import bart
phantom = bart(1,'phantom')

Output:

264K    /tmp
264K    /tmp
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

No branches or pull requests

1 participant