Datasets:
File size: 1,222 Bytes
870b85a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | """Why did a chain run end in generation_failed? Prints, per recovery attempt, the room whose layout search found no pose, the entities in
conflict and the native failure status, plus the first lines of the execute log's last error.
why_failed.py <experiment dir under hayfung/validation> [...]"""
import json
import sys
from pathlib import Path
for exp in map(Path, sys.argv[1:]):
meta = json.load(open(exp / 'experiment.json'))
case = Path(meta['runs'][0]['case'])
print('==', exp.name, '| case', case.name)
path = case / 'layout_recovery_execution.json'
if not path.is_file():
print(' no layout_recovery_execution.json (the failure is elsewhere):')
log = (exp / 'run_01' / 'execute.log').read_text(errors='replace').splitlines()
for line in log[-6:]:
print(' ', line[:300])
continue
data = json.load(open(path))
for i, attempt in enumerate(data['attempts']):
plan = attempt.get('recovery_plan', {})
print(' attempt %d: failed room %-10s status %-34s changed %-18s conflicts %s' % (
i, plan.get('failed_room_id'), plan.get('native_failure_status'), plan.get('changed_entity_id'), plan.get('conflict_counts')))
|