13 lines
1.2 KiB
Python
13 lines
1.2 KiB
Python
"""Activate only after an explicit separate --activate request in an idle window."""
|
|
import argparse,importlib.util,json,pathlib,subprocess,urllib.request
|
|
p=argparse.ArgumentParser();p.add_argument('--activate',action='store_true');a=p.parse_args()
|
|
if not a.activate:raise SystemExit('Prepared only. No services changed.')
|
|
root=pathlib.Path('/opt/athena-deck-dev/parakeet-prepared-20261013')
|
|
item=json.loads(subprocess.check_output(['docker','inspect','athena-voxcpm2-web']))[0]
|
|
f=next(pathlib.Path(m['Source']) for m in item['Mounts'] if m['Destination']=='/data');key=json.loads((f/'deck-connection.json').read_text())['token']
|
|
d=json.load(urllib.request.urlopen(urllib.request.Request('http://127.0.0.1:8108/api/v1/status',headers={'Authorization':'Bearer '+key})))
|
|
if d['endpoint']['active_requests']:raise SystemExit('Deck request active: no activation.')
|
|
spec=importlib.util.spec_from_file_location('installer',root/'app/deploy/install.py');m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m)
|
|
m.build=lambda runtime_image=None:'athena-deck-standalone:parakeet-prepared-20261013'
|
|
m.update(pathlib.Path('/opt/athena-deck-dev/runtime'),reuse_runtime=True,keep_snapshots=True)
|