Files

15 lines
854 B
Python

import datetime,json,os,pathlib,subprocess,sys,time
r=pathlib.Path(__file__).resolve().parent;p=r.parent
start=time.monotonic()
(r/'start.txt').write_text(datetime.datetime.now(datetime.timezone.utc).isoformat()+'\n')
print((r/'HEADER.json').read_text(),flush=True)
for stage,command in [
('focused',[sys.executable,str(p/'window.py'),'--grant','sage-2768','--stage','focused','--out',str(r/'focused')]),
('changes',[sys.executable,str(p/'driver.py'),'--grant','sage-2768','--out',str(r/'changes')]),
('whole',[sys.executable,str(p/'window.py'),'--grant','sage-2768','--stage','whole','--out',str(r/'whole')])]:
print('START '+stage,flush=True)
code=subprocess.call(command)
(r/'progress.json').write_text(json.dumps(dict(stage=stage,code=code,wall_seconds=round(time.monotonic()-start,3))))
if code:sys.exit(code)
print('END '+stage,flush=True)