Files
Athena-Deck/docs/experiments/strata-context-2026-10-13/launch.py
T

17 lines
2.1 KiB
Python

"""Athena host launcher. Explicit --go, regularly unloaded Deck required."""
import argparse,json,pathlib,subprocess,urllib.request
p=argparse.ArgumentParser();p.add_argument('--go',action='store_true');p.add_argument('--context',type=int,choices=(1000000,524288),required=True);a=p.parse_args()
if not a.go:print('Prepared only. No services changed.');raise SystemExit(0)
stage=pathlib.Path('/opt/athena-deck-dev/context-prepared-20261013');output=pathlib.Path('/data/experiments/strata-context-20261013')
c=json.loads(subprocess.check_output(['docker','inspect','athena-voxcpm2-web']))[0]
f=next(pathlib.Path(m['Source']) for m in c['Mounts'] if m['Destination']=='/data');token=json.loads((f/'deck-connection.json').read_text())['token']
status=json.load(urllib.request.urlopen(urllib.request.Request('http://127.0.0.1:8108/api/v1/status',headers={'Authorization':'Bearer '+token}),timeout=15))
if status['endpoint']['active_requests'] or status['endpoint']['counts']['llm']['loaded']:raise SystemExit('Regularly unload the Deck LLM first; no test started.')
if not output.is_dir():raise SystemExit('Previously authorized result directory missing')
c=json.loads(subprocess.check_output(['docker','inspect','athena-deck-dev']))[0]
args=['docker','run','--rm','--name','athena-strata-context-test','--gpus','all','--user','65534:65534','--read-only','--cap-drop','ALL','--security-opt','no-new-privileges:true','--memory','43g','--memory-swap','43g','--cpus','6','--network','none','--tmpfs','/tmp:rw,nosuid,nodev,size=512m','--entrypoint','python3']
for m in c['Mounts']:
if m['Type']=='bind' and (m['Destination']=='/var/lib/deck' or 'strata' in m['Destination']):args+=['--mount',f"type=bind,src={m['Source']},dst={m['Destination']},readonly"]
args+=['--mount',f'type=bind,src={stage},dst=/test,readonly','--mount',f'type=bind,src={output},dst=/experiment',c['Config']['Image'],'/test/benchmark.py','--go','--base-config','/test/base-template.json','--contexts',str(a.context),'--output',f'/experiment/extended-{a.context}','--reuse-fixtures','/experiment']
raise SystemExit(subprocess.run(args).returncode)