Skip to content

Fix Temporary File Cleanup #10

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

Merged
merged 2 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/pr-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ jobs:
poetry run coverage xml
working-directory: ./python

- name: Get Cover
uses: orgoro/coverage@v3.2
with:
coverageFile: python/coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
# orgoro does not work in workflow runs due to fork permissions issues:
# See PR https://github.com/orgoro/coverage/pull/281
# So commenting it out for now.
#
# - name: Get Cover
# uses: orgoro/coverage@v3.2
# with:
# coverageFile: python/coverage.xml
# token: ${{ secrets.GITHUB_TOKEN }}
19 changes: 8 additions & 11 deletions python/ouroboros/pipeline/backproject_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,17 +328,14 @@ def _process(self, input_data: any) -> tuple[any, None] | tuple[None, any]:
# Update the progress bar
self.update_progress(0.5 + i / len(chunks_and_boxes) / 2)

# Close all the memmaps
for volume_memmap in volume_memmaps:
del volume_memmap
# Close all the memmaps - All 3 needed to allow deletion of temporary files.
del volume # Delete volume view created during .tif file writing.
del intersection_volume # Delete volume view created during .tif file writing.
del volume_memmaps[:] # Delete all the memmaps.

# Delete the temporary volume files
shutil.rmtree(
join_path(
config.output_file_folder,
format_backproject_tempvolumes(config.output_file_name),
)
)
# Delete the temporary volume files.
# Errors ignored because leaving a temporary file around is better than failing. Could add logging.
shutil.rmtree(temp_folder_path, ignore_errors=True)

self.add_timing("export", time.perf_counter() - start)

Expand All @@ -365,7 +362,7 @@ def _process(self, input_data: any) -> tuple[any, None] | tuple[None, any]:
delete_intermediate=False,
compression=config.backprojection_compression,
metadata=metadata,
resolution=resolution, # XY Resolution
resolution=resolution, # XY Resolution
resolutionunit=resolutionunit,
)
except BaseException as e:
Expand Down