| [Unit] |
| Description=Elizabeth Model Promotion Service %I |
| After=elizabeth-eval@%i.service |
| Requires=elizabeth-eval@%i.service |
| ConditionPathExists=/data/adaptai/eval_results/elizabeth-${%I}.json |
|
|
| [Service] |
| Type=oneshot |
| User=root |
| WorkingDirectory=/data/adaptai |
| Environment=PYTHONPATH=/data/adaptai/aiml/datascience |
| ExecStart=/usr/bin/python3 -c " |
| import json |
| import shutil |
| from pathlib import Path |
|
|
| # Load evaluation results |
| eval_file = Path('/data/adaptai/eval_results/elizabeth-${%I}.json') |
| if eval_file.exists(): |
| with open(eval_file, 'r') as f: |
| results = json.load(f) |
| |
| # Check if all gates passed |
| if results.get('all_gates_pass', False): |
| print('β
All evaluation gates passed - promoting model') |
| # Promote checkpoint to production |
| src = Path('/data/adaptai/checkpoints/elizabeth-${%I}') |
| dest = Path('/workspace/models/elizabeth-production') |
| if src.exists(): |
| if dest.exists(): |
| shutil.rmtree(dest) |
| shutil.copytree(src, dest) |
| print(f'π Model promoted to {dest}') |
| else: |
| print('β Checkpoint not found') |
| else: |
| print('β Evaluation gates failed - not promoting') |
| print(f'Failed metrics: {results.get(\"failed_metrics\", [])}') |
| else: |
| print('β Evaluation results not found') |
| " |
|
|
| |
| NoNewPrivileges=yes |
| ProtectSystem=strict |
| ProtectHome=yes |
| PrivateTmp=yes |
|
|
| [Install] |
| WantedBy=multi-user.target |