File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,11 @@ def run_search(self):
7474 wu = WorkUnit .from_sharded_fits (wu_filename , directory_containing_shards , lazy = False )
7575 self .logger .debug ("Loaded work unit" )
7676
77+ # We may filter out images for the in-memory WorkUnit later on in search, but we would
78+ # still like to cleanup shards for any filtered out images, hence we need to store the
79+ # original WorkUnit size.
80+ orig_wu_size = len (wu )
81+
7782 #! Seems odd that we extract, modify, and reset the config in the workunit.
7883 #! Can we just modify the config in the workunit directly?
7984 if self .search_config_filepath is not None :
@@ -114,7 +119,7 @@ def run_search(self):
114119 self .logger .warning (f"Failed to remove { self .input_wu_filepath } : { e } " )
115120
116121 # Delete the individual shards for this WorkUnit, one existing for each image.
117- for i in range (len ( wu ) ):
122+ for i in range (orig_wu_size ):
118123 shard_path = os .path .join (directory_containing_shards , f"{ i } _{ wu_filename } " )
119124 try :
120125 os .remove (shard_path )
You can’t perform that action at this time.
0 commit comments