harbor run -t openthoughts/tasktrove-exp-rpt-issue-issue-4763harbor download openthoughts/tasktrove-exp-rpt-issue-issue-4763Problem / feature request
init_experiment.py: create a root directory and subdirectories named: models, figs, csv_files, tensorboard, hparams, json_files, txt_files, untyped_files.add_artifacts.py: populate a few artifacts (experiment.json, a CSV log, and a small JSON config) in the correct locations.verify.py: read the produced files and confirm the expected structure and content.python3 init_experiment.py /tmp/exp_root "DemoExp"python3 add_artifacts.py /tmp/exp_rootpython3 verify.py /tmp/exp_rootBefore state (pre-fix / buggy version) Below are the current, buggy versions of the relevant source files. They illustrate incomplete or incorrect behavior that a proper fix should address. Do not rely on these for production; implement the correct behavior as described above in /app/.
Code blocks show the exact before state of the code (pre-fix).
#!/usr/bin/env python3
import sys
from pathlib import Path
def main():
if len(sys.argv) != 3:
print("Usage: init_experiment.py <root_path> <experiment_name>")
sys.exit(1)
root = Path(sys.argv[1])
name = sys.argv[2]
# Bug: only creates a single nested directory and a subfolder,
# completely missing the required layout (models, figs, csv_files, etc.)
(root / "experiment").mkdir(parents=True, exist_ok=True)
(root / "experiment" / "logs").mkdir(parents=True, exist_ok=True)
print(f"Initialized incomplete structure for {name} at {root}")
if __name__ == "__main__":
main()
#!/usr/bin/env python3
import sys
import json
from pathlib import Path
def main():
if len(sys.argv) != 2:
print("Usage: add_artifacts.py <root_path>")
sys.exit(1)
root = Path(sys.argv[1])
root.mkdir(parents=True, exist_ok=True)
# Bug: writes an experiment.json with missing fields
exp = {"name": "Demo"} # should include root_path and experiment_name
(root / "experiment.json").write_text(json.dumps(exp, indent=2))
# Bug: artifacts placed in wrong locations and with incorrect headers
(root / "logs.csv").write_text("time,edge,decision\n1,A,yes")
# Bug: wrong directory for hparams
(root / "hparams").mkdir(parents=True, exist_ok=True)
(root / "hparams" / "config.txt").write_text("param=value")
print("Artifacts created (incomplete)")
if __name__ == "__main__":
main()
#!/usr/bin/env python3
import sys
from pathlib import Path
import json
def main():
if len(sys.argv) != 2:
print("Usage: verify.py <root_path>")
sys.exit(1)
root = Path(sys.argv[1])
ok = True
# Very naive verification: only checks for some files
if not (root / "experiment.json").exists():
ok = False
if not (root / "logs.csv").exists():
ok = False
if ok:
print("SUCCESS")
sys.exit(0)
else:
print("ERROR: missing required artifacts")
sys.exit(1)
if __name__ == "__main__":
main()
What to create/modify in /app/
Exact expected behavior to implement (not shown in the buggy before-state)
How to test (instructions you can rely on when validating)
Notes