Main entry point for the visualization server.
()
| 12 | |
| 13 | |
| 14 | def main(): |
| 15 | """Main entry point for the visualization server.""" |
| 16 | parser = argparse.ArgumentParser(description='Run tracer visualization server') |
| 17 | parser.add_argument( |
| 18 | '--tracer_json', |
| 19 | default=os.path.join(root, 'workdir', 'offline_trading_agent', 'tracer.json'), |
| 20 | type=str, |
| 21 | help='Path to tracer.json file' |
| 22 | ) |
| 23 | parser.add_argument( |
| 24 | '--port', |
| 25 | type=int, |
| 26 | default=8088, |
| 27 | help='Port number for the web server (default: 8080)' |
| 28 | ) |
| 29 | parser.add_argument( |
| 30 | '--debug', |
| 31 | action='store_true', |
| 32 | help='Run in debug mode' |
| 33 | ) |
| 34 | |
| 35 | args = parser.parse_args() |
| 36 | |
| 37 | tracer_path = Path(args.tracer_json) |
| 38 | if not tracer_path.exists(): |
| 39 | print(f"Error: Tracer JSON file not found: {tracer_path}") |
| 40 | sys.exit(1) |
| 41 | |
| 42 | try: |
| 43 | visualizer = TracerVisualizer(str(tracer_path), port=args.port) |
| 44 | visualizer.run(debug=args.debug) |
| 45 | except Exception as e: |
| 46 | print(f"Error starting visualization server: {e}") |
| 47 | sys.exit(1) |
| 48 | |
| 49 | |
| 50 | if __name__ == '__main__': |
no test coverage detected