File size: 1,524 Bytes
c8c00f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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.")