Skip to content

Commit e2bba55

Browse files
abrichrclaude
andauthored
fix(cli): write correct dict format for --task in run command (#24)
WAA's run.py expects test config as {domain: [task_ids...]} dict, but --task wrote a bare JSON array [task_id] causing TypeError when run.py indexes by domain string key. Now looks up the task's domain from test_all.json inside the container and writes the correct {domain: [task_id]} format. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0f5820a commit e2bba55

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

openadapt_ml/benchmarks/cli.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,12 +2136,22 @@ def cmd_run(args):
21362136
log("RUN", f"Parallel mode: worker {worker_id}/{num_workers}")
21372137

21382138
# If specific task requested, create custom test config
2139+
# test_all.json is a dict {domain: [task_ids...]} — run.py indexes by domain key,
2140+
# so we must look up which domain contains this task and write that format
21392141
if task:
2140-
create_custom_test_cmd = f'''
2141-
cat > /client/evaluation_examples_windows/test_custom.json << 'CUSTOMEOF'
2142-
["{task}"]
2143-
CUSTOMEOF
2144-
'''
2142+
create_custom_test_cmd = f"""cat > /tmp/find_task.py << 'FINDEOF'
2143+
import json, sys
2144+
d = json.load(open("/client/evaluation_examples_windows/test_all.json"))
2145+
task_id = "{task}"
2146+
for domain, tasks in d.items():
2147+
if task_id in tasks:
2148+
json.dump({{domain: [task_id]}}, open("/client/evaluation_examples_windows/test_custom.json", "w"))
2149+
print(f"Task {{task_id}} found in domain {{domain}}")
2150+
sys.exit(0)
2151+
print(f"ERROR: Task {{task_id}} not found in test_all.json")
2152+
sys.exit(1)
2153+
FINDEOF
2154+
python3 /tmp/find_task.py"""
21452155
run_args.append(
21462156
"--test_all_meta_path evaluation_examples_windows/test_custom.json"
21472157
)

0 commit comments

Comments
 (0)