Skip to content

Commit e62ea82

Browse files
authored
do not push files to S3 when their path in the DB is already an S3 URL (#833)
1 parent 9c376bb commit e62ea82

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

python/lib/dcm2bids_imaging_pipeline_lib/push_imaging_files_to_s3_pipeline.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ def _get_list_of_files_from_files(self):
9595

9696
file_entries = self.imaging_obj.files_db_obj.get_files_inserted_for_tarchive_id(self.tarchive_id)
9797
for file in file_entries:
98+
if file['File'].startswith('s3://'):
99+
# skip since file already pushed to S3
100+
continue
98101
self.files_to_push_list.append({
99102
"table_name": "files",
100103
"id_field_name": "FileID",
@@ -146,6 +149,9 @@ def _get_list_of_files_from_mri_protocol_violated_scans(self):
146149
if not os.path.exists(entry['minc_location']):
147150
# violation has been rerun or moved
148151
continue
152+
if entry['minc_location'].startswith('s3://'):
153+
# skip since file already pushed to S3
154+
continue
149155
self.files_to_push_list.append({
150156
"table_name": "mri_protocol_violated_scans",
151157
"id_field_name": "ID",
@@ -174,6 +180,9 @@ def _get_list_of_files_from_mri_violations_log(self):
174180
if not os.path.exists(entry['MincFile']):
175181
# violation has been rerun or moved
176182
continue
183+
if entry['MincFile'].startswith('s3://'):
184+
# skip since file already pushed to S3
185+
continue
177186
self.files_to_push_list.append({
178187
"table_name": "mri_violations_log",
179188
"id_field_name": "LogID",

0 commit comments

Comments
 (0)