import subprocess import sys # Common base arguments across all runs BASE_CMD = [ sys.executable, # Uses the currently active Python interpreter "batch_agent_orchestrator.py", "--input-dir", r"C:\Users\admin_mtds\OneDrive\Desktop\ChinKuan\TestingImage\03_xray_solder", "--output-dir", r"C:\Users\admin_mtds\OneDrive\Desktop\ChinKuan\ArtiAgent - DefectFill\agent_output\03_xray_solder", "--checkpoint-dir", r"C:\Users\admin_mtds\OneDrive\Desktop\ChinKuan\ArtiAgent - DefectFill\engine\DefectFill\checkpoints", "--product-desc", "X-ray PCB with solder joints and die components", "--max-defects-per-image", "3", "--guidance-scale", "8.0", "--device", "cuda" ] # Variations for each step in a single loop # TASKS = [ # ["--defect-type", "tiger-strip"], # ["--defect-type", "bubble"], # [] # Default/No defect-type specified # ] TOTAL_LOOPS = 20 if __name__ == "__main__": for loop_num in range(1, TOTAL_LOOPS + 1): print(f"\n" + "=" * 50) print(f"šŸš€ STARTING LOOP {loop_num} OF {TOTAL_LOOPS}") print("=" * 50) print(f"\n--> Running command for Loop {loop_num}...") # Run the base command and wait for it to finish result = subprocess.run(BASE_CMD) # Check if the command failed if result.returncode != 0: print(f"āŒ Error encountered on Loop {loop_num}. Execution stopped.") sys.exit(result.returncode) print(f"\nšŸŽ‰ Success! Completed all {TOTAL_LOOPS} loops.")