import os
import subprocess

root = '/home/dev/arbi-serve-vision-reserve-overlap-20261105'
image = 'registry.arbi.work/arbi-serve@sha256:3fdfc10328c69718ce869b17c7a1c0c61ebadfde4ac1280147748321c6ae6202'
for name, source, sha, cache in [
    ('control', '/tmp/vision-latest-parity-candidate-b7ace12be', 'b7ace12be', 'control-speed-fresh'),
    ('fixed', '/tmp/vision-envelope-fixed-bff830249', 'bff830249', 'fixed-fresh-envelope'),
]:
    prefix = f'/tmp/vision-envelope-{name}-warm-20261105'
    argv = ['bash', 'scripts/ci/gpu_lock.sh', '0', '--', 'python3', '/tmp/vision_accounting_boot_20261105.py',
        '--source', source, '--sha', sha, '--prefix', prefix, '--image', image,
        '--budget-cache', '/home/dev/vision-envelope-parity-20261105/' + cache,
        '--extra-qualification', '/tmp/vision_memory_extra_qualification_20261105.py']
    print('START', name, flush=True)
    with open(prefix + '-progress.log', 'w') as log:
        subprocess.run(argv, cwd=root, env=dict(os.environ, GPU_LOCK_WAIT_S='3600'), stdout=log, stderr=subprocess.STDOUT, check=True)
    print('COMPLETED', name, flush=True)
