@@ -2432,6 +2432,15 @@ def generate_manifest(
24322432 f"[yellow]Warning: Could not clear existing files: { e } [/yellow]"
24332433 )
24342434
2435+ # Place .uploading marker to prevent resolver race condition
2436+ # The test set resolver's auto-detection skips folders with this marker,
2437+ # preventing premature validation before all files are uploaded.
2438+ # See: https://github.com/aws-solutions-library-samples/accelerated-intelligent-document-processing-on-aws/issues/193
2439+ marker_key = f"{ test_set } /.uploading"
2440+ s3_client .put_object (
2441+ Bucket = test_set_bucket , Key = marker_key , Body = b"upload-in-progress"
2442+ )
2443+
24352444 # Upload input documents
24362445 for i , doc in enumerate (documents ):
24372446 doc_path = doc ["document_path" ]
@@ -2487,6 +2496,15 @@ def generate_manifest(
24872496 console .print ()
24882497
24892498 if test_set :
2499+ # Remove .uploading marker now that all files are uploaded
2500+ marker_key = f"{ test_set } /.uploading"
2501+ try :
2502+ s3_client .delete_object (Bucket = test_set_bucket , Key = marker_key )
2503+ except Exception as e :
2504+ console .print (
2505+ f"[yellow]Warning: Could not remove upload marker: { e } [/yellow]"
2506+ )
2507+
24902508 # Auto-register test set in tracking table
24912509 from idp_cli .stack_info import StackInfo
24922510
@@ -2929,6 +2947,12 @@ def _create_test_set_from_manifest(
29292947 except Exception as e :
29302948 console .print (f"[yellow]Warning: Could not clear existing files: { e } [/yellow]" )
29312949
2950+ # Place .uploading marker to prevent resolver race condition (issue #193)
2951+ marker_key = f"{ test_set_name } /.uploading"
2952+ s3_client .put_object (
2953+ Bucket = test_set_bucket , Key = marker_key , Body = b"upload-in-progress"
2954+ )
2955+
29322956 # Copy input files
29332957 for _ , row in df .iterrows ():
29342958 source_path = row ["document_path" ]
@@ -2966,6 +2990,12 @@ def _create_test_set_from_manifest(
29662990 s3_key = f"{ test_set_name } /baseline/{ filename } /{ rel_path } "
29672991 s3_client .upload_file (baseline_file , test_set_bucket , s3_key )
29682992
2993+ # Remove .uploading marker now that all files are uploaded (issue #193)
2994+ try :
2995+ s3_client .delete_object (Bucket = test_set_bucket , Key = marker_key )
2996+ except Exception as e :
2997+ console .print (f"[yellow]Warning: Could not remove upload marker: { e } [/yellow]" )
2998+
29692999 console .print (
29703000 f"[green]✓ Test set '{ test_set_name } ' created with { len (df )} files[/green]"
29713001 )
0 commit comments