44from load_config import load_env_config
55from gcs import list_gcs_files , sync_info_to_gcs_output
66from wells import compute_grid_dimensions , get_grid_coords
7- from gcs_local_io import load_file , check_and_upload_completed_chunks , check_any_remaining_chunks
7+ from gcs_local_io import (
8+ get_uploaded_files ,
9+ load_file ,
10+ check_and_upload_completed_chunks ,
11+ check_any_remaining_chunks ,
12+ )
813from chunking import compute_volume_and_chunk_size , process
914from volume import create_cloudvolume_info
1015
@@ -89,6 +94,9 @@ def main():
8994 # Process each well into chunks
9095 iter_coords = list (get_grid_coords (num_chunks_per_dim ))
9196
97+ # Find which files were already done and keep track of them
98+ uploaded_files = get_uploaded_files (output_path )
99+
92100 processed_chunks = []
93101 failed_chunks = []
94102 total_uploads = 0
@@ -110,18 +118,36 @@ def main():
110118 input_path = input_path ,
111119 all_files = all_files ,
112120 delete_input = delete_input ,
121+ gcs_project = gcs_project ,
122+ num_channels = num_channels ,
113123 )
114124 start , end = bounds
115125 processed_chunks .append ((start , end ))
116- total_uploads += check_and_upload_completed_chunks ()
126+ total_uploads += check_and_upload_completed_chunks (
127+ num_mips = num_mips ,
128+ output_path = output_path ,
129+ volume_size = volume_size ,
130+ processed_chunks_bounds = processed_chunks ,
131+ use_gcs_output = use_gcs_output ,
132+ gcs_project = gcs_project ,
133+ gcs_output_bucket_name = gcs_output_bucket_name ,
134+ gcs_output_path = gcs_output_path ,
135+ num_upload_workers = num_upload_workers ,
136+ delete_output = delete_output ,
137+ already_uploaded_path = output_path / "uploaded_to_gcs_chunks.txt" ,
138+ uploaded_files = uploaded_files ,
139+ failed_files = failed_chunks ,
140+ )
117141 print (f"Total chunks uploaded so far: { total_uploads } " )
118142
119143 if failed_chunks :
120144 print (f"Failed to process { len (failed_chunks )} chunks:" )
121145 for chunk in failed_chunks :
122146 print (f" { chunk } " )
123147
124- remaining_files = check_any_remaining_chunks ()
148+ remaining_files = check_any_remaining_chunks (
149+ num_mips = num_mips , output_path = output_path , uploaded_files = uploaded_files
150+ )
125151 if remaining_files :
126152 print (f"Remaining chunks: { remaining_files } " )
127153
0 commit comments