MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / prepare

Function prepare

eval_heldout/webarena/run.py:358–380  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

356
357
358def prepare(args: argparse.Namespace) -> None:
359 # convert prompt python files to json
360 from agent.prompts import to_json
361
362 to_json.run()
363
364 # prepare result dir
365 result_dir = args.result_dir
366 if not result_dir:
367 result_dir = (
368 f"cache/results_{time.strftime('%Y%m%d%H%M%S', time.localtime())}"
369 )
370 if not Path(result_dir).exists():
371 Path(result_dir).mkdir(parents=True, exist_ok=True)
372 args.result_dir = result_dir
373 logger.info(f"Create result dir: {result_dir}")
374
375 if not (Path(result_dir) / "traces").exists():
376 (Path(result_dir) / "traces").mkdir(parents=True)
377
378 # log the log file
379 with open(os.path.join(result_dir, "log_files.txt"), "a+") as f:
380 f.write(f"{LOG_FILE_NAME}\n")
381
382
383def get_unfinished(config_files: list[str], result_dir: str) -> list[str]:

Callers 1

run.pyFile · 0.85

Calls 4

joinMethod · 0.80
PathClass · 0.50
runMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected