Fix --optimize-disk-space

pull/1225/head
Piero Toffanin 2021-01-15 15:39:29 -05:00
rodzic 8b6d636abf
commit 3ca4629f08
1 zmienionych plików z 11 dodań i 7 usunięć

Wyświetl plik

@ -35,18 +35,20 @@ class ODMOpenSfMStage(types.ODM_Stage):
octx.extract_cameras(tree.path("cameras.json"), self.rerun())
self.update_progress(70)
if args.optimize_disk_space:
for folder in ["features", "matches", "exif", "reports"]:
folder_path = octx.path(folder)
if os.path.islink(folder_path):
os.unlink(folder_path)
else:
shutil.rmtree(folder_path)
def cleanup_disk_space():
if args.optimize_disk_space:
for folder in ["features", "matches", "exif", "reports"]:
folder_path = octx.path(folder)
if os.path.islink(folder_path):
os.unlink(folder_path)
else:
shutil.rmtree(folder_path)
# If we find a special flag file for split/merge we stop right here
if os.path.exists(octx.path("split_merge_stop_at_reconstruction.txt")):
log.ODM_INFO("Stopping OpenSfM early because we found: %s" % octx.path("split_merge_stop_at_reconstruction.txt"))
self.next_stage = None
cleanup_disk_space()
return
updated_config_flag_file = octx.path('updated_config.txt')
@ -205,6 +207,8 @@ class ODMOpenSfMStage(types.ODM_Stage):
if not args.skip_report:
octx.export_stats(self.rerun())
cleanup_disk_space()
if args.optimize_disk_space:
os.remove(octx.path("tracks.csv"))
if io.file_exists(octx.recon_backup_file()):