Release B7 B6 dependency under Claude ruling preserving science pins
This commit is contained in:
1 parent
ae40cd486e
commit
ecf279fa93
10 files changed
+237
No files matched your search
@@ -0,0 +1,35 @@
|
||||
"""Claude1794895409 dependency release only; original science workers unchanged."""
|
||||
from phase2_b6_gate import *
|
||||
|
||||
def run(root):
|
||||
c=config(root);os.sched_setaffinity(0,[c['cpu']]);lock=(root/'run.lock').open('a');fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB)
|
||||
if (root/'started.json').exists():raise FileExistsError('B6 zero retries')
|
||||
start=time.process_time();u0=resource.getrusage(resource.RUSAGE_CHILDREN);charged=0.;records=[];entries=[]
|
||||
def total():
|
||||
u=resource.getrusage(resource.RUSAGE_CHILDREN);return 60+max(charged,u.ru_utime+u.ru_stime-u0.ru_utime-u0.ru_stime)+time.process_time()-start
|
||||
save(root/'started.json',dict(pid=os.getpid(),unix=time.time(),contract_sha256=sha(root/'contract.json')))
|
||||
try:
|
||||
for i,row in enumerate(c['parts']):
|
||||
if total()+c['part_cpu_seconds']+1050>7200:raise RuntimeError('B6 remaining CPU cannot reserve next part and postfit')
|
||||
dest=root/'parts'/f'{i:02d}';dest.mkdir(parents=True,exist_ok=False)
|
||||
remaining=c['disk_bytes']-disk_usage(root)
|
||||
if remaining<=0:raise RuntimeError('B6 disk cap')
|
||||
save(root/'live-progress.json',dict(stage='GEOMETRY_ONLY',index=i,parts=len(records),unix=time.time(),cumulative_cpu_seconds=total()))
|
||||
g=supervise([sys.executable,'tools/phase2_b6_gate.py','field',str(root),str(i)],dest,dict(cpu_seconds=c['part_cpu_seconds'],wall_seconds=c['part_wall_seconds'],rss_bytes=c['rss_bytes'],disk_bytes=remaining))
|
||||
charged+=g['cpu_seconds'];record=dict(index=i,case=row['case'],guard=g);records.append(record)
|
||||
if g['monitor_errors']:raise RuntimeError('B6 monitor failure')
|
||||
if g['status']!='PASS' and not (dest/'failure.json').exists() and not g['stop_reason']:raise RuntimeError('B6 input/configuration failure before field diagnostics')
|
||||
if g['status']=='PASS':entries.append(dict(index=i,case=row['case'],result_sha256=sha(dest/'result.json')))
|
||||
save(root/'phase-ledger.json',dict(records=records,cumulative_cpu_seconds=total()))
|
||||
save(root/'fields-manifest.json',dict(entries=entries,records=records,all50_terminal=True,labels_read=False))
|
||||
freeze(root,'fields',[root/'contract.json',root/'fields-manifest.json',*[BASE/p for p in c['code_sha256']]])
|
||||
dest=root/'score';dest.mkdir(exist_ok=False)
|
||||
g=supervise([sys.executable,'tools/phase2_b6_gate.py','score',str(root)],dest,dict(cpu_seconds=min(900,7200-total()-120),wall_seconds=1200,rss_bytes=c['rss_bytes'],disk_bytes=c['disk_bytes']-disk_usage(root)))
|
||||
charged+=g['cpu_seconds'];records.append(dict(phase='score',guard=g))
|
||||
if g['status']!='PASS' or total()>7200 or disk_usage(root)>c['disk_bytes']:raise RuntimeError('B6 scoring/resource failure')
|
||||
save(root/'complete.json',dict(status='COMPLETE',cumulative_cpu_seconds=total(),records=records,scientific_gate=read(dest/'result.json')['decision'],retry=False))
|
||||
except BaseException as exc:
|
||||
save(root/'complete.json',dict(status='STOPPED',reason=type(exc).__name__+': '+str(exc),cumulative_cpu_seconds=total(),records=records,retry=False));raise
|
||||
|
||||
|
||||
if __name__=='__main__':run(Path(sys.argv[1]))
|
||||
@@ -0,0 +1,46 @@
|
||||
"""Claude1794895409: B7 then B6 once, independent of B1 recovery."""
|
||||
import fcntl
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import psutil
|
||||
from phase2_h1_worker_v2 import save,sha,checked
|
||||
|
||||
BASE=Path('/home/frank14f/optane/MeltMind')
|
||||
ROOT=BASE/'artifacts/phase2-b76-released-2026-11-17'
|
||||
DEPENDENCY=BASE/'artifacts/phase2-h1-labelled-recovery-2026-11-17'
|
||||
def read(p):return json.loads(Path(p).read_text())
|
||||
|
||||
|
||||
def live(root):
|
||||
return [p.pid for p in psutil.process_iter(['pid','cmdline']) if p.pid!=os.getpid() and str(root) in (p.info['cmdline'] or [])]
|
||||
|
||||
|
||||
def run():
|
||||
c=read(ROOT/'contract.json')
|
||||
for p,h in c['source_sha256'].items():checked(BASE/p,h)
|
||||
os.sched_setaffinity(0,[24]);start=time.process_time()
|
||||
with (ROOT/'run.lock').open('a') as lock:
|
||||
fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB)
|
||||
if (ROOT/'started.json').exists():raise FileExistsError('Unique existing chain; no restart')
|
||||
save(ROOT/'started.json',dict(pid=os.getpid(),unix=time.time(),contract_sha256=sha(ROOT/'contract.json')))
|
||||
results=[]
|
||||
try:
|
||||
for name,module in [('phase2-b7-gate-2026-11-17','phase2_b7_released'),('phase2-b6-gate-2026-11-17','phase2_b6_released')]:
|
||||
root=BASE/'artifacts'/name
|
||||
for p,h in c['source_sha256'].items():checked(BASE/p,h)
|
||||
if live(root) or (root/'started.json').exists():raise RuntimeError('Dependent gate already attempted; do not duplicate')
|
||||
save(ROOT/'live-progress.json',dict(stage='RUN_'+module,unix=time.time(),coordinator_cpu_seconds=time.process_time()-start))
|
||||
with (ROOT/(module+'.log')).open('x') as log:
|
||||
child=subprocess.run([sys.executable,'tools/'+module+'.py',str(root)],stdout=log,stderr=subprocess.STDOUT)
|
||||
if not (root/'complete.json').exists() or live(root):raise RuntimeError('Missing terminal or live children')
|
||||
result=read(root/'complete.json');results.append(dict(gate=name,returncode=child.returncode,complete_sha256=sha(root/'complete.json'),status=result['status']))
|
||||
save(ROOT/'gate-terminals.json',results)
|
||||
save(ROOT/'complete.json',dict(status='BOTH_GATES_TERMINAL',results=results,coordinator_cpu_seconds=time.process_time()-start,retry=False))
|
||||
except BaseException as exc:
|
||||
save(ROOT/'complete.json',dict(status='STOPPED',reason=type(exc).__name__+': '+str(exc),results=results,coordinator_cpu_seconds=time.process_time()-start,retry=False));raise
|
||||
|
||||
if __name__=='__main__':run()
|
||||
@@ -0,0 +1,28 @@
|
||||
"""Claude1794895409 dependency release only; original science workers unchanged."""
|
||||
from phase2_b7_gate import *
|
||||
|
||||
def run(root):
|
||||
c=config(root);os.sched_setaffinity(0,[24]);start=time.process_time();u0=resource.getrusage(resource.RUSAGE_CHILDREN);charged=0.;records=[]
|
||||
lock=(root/'run.lock').open('a');fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB)
|
||||
if (root/'started.json').exists():raise FileExistsError('B7 no retry')
|
||||
save(root/'started.json',dict(pid=os.getpid(),unix=time.time(),contract_sha256=sha(root/'contract.json')))
|
||||
def total():
|
||||
u=resource.getrusage(resource.RUSAGE_CHILDREN);return 60+max(charged,u.ru_utime+u.ru_stime-u0.ru_utime-u0.ru_stime)+time.process_time()-start
|
||||
try:
|
||||
for mode in ['train','predict','score']:
|
||||
if mode=='predict':freeze(root,'model',[root/'contract.json',root/'phases/train/model.ubj',root/'phases/train/result.json',*[BASE/p for p in c['code_sha256']]])
|
||||
if mode=='score':freeze(root,'predictions',[root/'contract.json',root/'phases/predict/manifest.json',*[BASE/p for p in c['code_sha256']]])
|
||||
dest=root/'phases'/mode;dest.mkdir(parents=True,exist_ok=False);cap=min(c['phase_limits'][mode],7200-total()-120)
|
||||
disk_remaining=c['disk_bytes']-disk_usage(root)
|
||||
if disk_remaining<=0:raise RuntimeError('B7 cumulative disk cap')
|
||||
if cap<=0:raise RuntimeError('B7 cumulative CPU cap')
|
||||
save(root/'live-progress.json',dict(stage=mode,unix=time.time(),cumulative_cpu_seconds=total()))
|
||||
g=supervise([sys.executable,'tools/phase2_b7_gate.py',mode,str(root)],dest,dict(cpu_seconds=cap,wall_seconds=c['phase_limits'][mode],rss_bytes=c['rss_bytes'],disk_bytes=disk_remaining))
|
||||
charged+=g['cpu_seconds'];records.append(dict(phase=mode,guard=g));save(root/'phase-ledger.json',dict(records=records,cumulative_cpu_seconds=total()))
|
||||
if g['status']!='PASS' or total()>7200 or disk_usage(root)>c['disk_bytes']:raise RuntimeError('B7 phase/resource stop')
|
||||
save(root/'complete.json',dict(status='COMPLETE',cumulative_cpu_seconds=total(),records=records,scientific_gate=read(root/'phases/score/result.json')['decision'],retry=False))
|
||||
except BaseException as exc:
|
||||
save(root/'complete.json',dict(status='STOPPED',reason=type(exc).__name__+': '+str(exc),cumulative_cpu_seconds=total(),records=records,retry=False));raise
|
||||
|
||||
|
||||
if __name__=='__main__':run(Path(sys.argv[1]))
|
||||
Reference in new issue
Block a user