Skip to content

Commit fc751a0

Browse files
authored
Merge pull request #10 from den-sq/main
Fix Temporary File Cleanup. (also removes orgoro check, as it doesn't work when running PRs from forks; see orgoro/coverage#281)
2 parents ddd5ea1 + 539ad26 commit fc751a0

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

.github/workflows/pr-coverage.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ jobs:
4141
poetry run coverage xml
4242
working-directory: ./python
4343

44-
- name: Get Cover
45-
uses: orgoro/coverage@v3.2
46-
with:
47-
coverageFile: python/coverage.xml
48-
token: ${{ secrets.GITHUB_TOKEN }}
44+
# orgoro does not work in workflow runs due to fork permissions issues:
45+
# See PR https://github.com/orgoro/coverage/pull/281
46+
# So commenting it out for now.
47+
#
48+
# - name: Get Cover
49+
# uses: orgoro/coverage@v3.2
50+
# with:
51+
# coverageFile: python/coverage.xml
52+
# token: ${{ secrets.GITHUB_TOKEN }}

python/ouroboros/pipeline/backproject_pipeline.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -328,17 +328,14 @@ def _process(self, input_data: any) -> tuple[any, None] | tuple[None, any]:
328328
# Update the progress bar
329329
self.update_progress(0.5 + i / len(chunks_and_boxes) / 2)
330330

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

335-
# Delete the temporary volume files
336-
shutil.rmtree(
337-
join_path(
338-
config.output_file_folder,
339-
format_backproject_tempvolumes(config.output_file_name),
340-
)
341-
)
336+
# Delete the temporary volume files.
337+
# Errors ignored because leaving a temporary file around is better than failing. Could add logging.
338+
shutil.rmtree(temp_folder_path, ignore_errors=True)
342339

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

@@ -365,7 +362,7 @@ def _process(self, input_data: any) -> tuple[any, None] | tuple[None, any]:
365362
delete_intermediate=False,
366363
compression=config.backprojection_compression,
367364
metadata=metadata,
368-
resolution=resolution, # XY Resolution
365+
resolution=resolution, # XY Resolution
369366
resolutionunit=resolutionunit,
370367
)
371368
except BaseException as e:

0 commit comments

Comments
 (0)