eval_cmd.py
1 import os 2 from pathlib import Path 3 import click 4 from cli.utils import error_exit 5 6 7 @click.command(name="eval") 8 @click.argument( 9 "test_suite_config_path", 10 type=click.Path(exists=True, dir_okay=False, resolve_path=True), 11 required=True, 12 metavar="<PATH>", 13 ) 14 @click.option( 15 "-v", 16 "--verbose", 17 is_flag=True, 18 help="Enable verbose output.", 19 ) 20 def eval_cmd(test_suite_config_path, verbose): 21 """ 22 Run an evaluation suite using a specified configuration file. Such as path/to/file.yaml. 23 24 <PATH>: The path to the evaluation test suite config file. 25 """ 26 from evaluation.run import main as run_evaluation_main 27 28 click.echo( 29 click.style( 30 f"Starting evaluation with test_suite_config: {test_suite_config_path}", 31 fg="blue", 32 ) 33 ) 34 35 # Set logging config path for evaluation 36 project_root = Path.cwd() 37 logging_config_path = project_root / "configs" / "logging_config.yaml" 38 if logging_config_path.exists(): 39 os.environ["LOGGING_CONFIG_PATH"] = str(logging_config_path.resolve()) 40 41 try: 42 run_evaluation_main(test_suite_config_path, verbose=verbose) 43 click.echo(click.style("Evaluation completed successfully.", fg="green")) 44 except Exception as e: 45 error_exit(f"An error occurred during evaluation: {e}")