From 60aa757ba03eff38eb542004e51e1a8b16e147f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sat, 13 Jan 2024 15:38:57 +0100 Subject: [PATCH] expand cli for endgames --- hanabi-league | 7 +++++++ src/endgames.py | 5 +---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hanabi-league b/hanabi-league index 0784af4..8706593 100755 --- a/hanabi-league +++ b/hanabi-league @@ -16,10 +16,15 @@ import fetch_games import ratings import stats import render_site +import endgames from log_setup import logger +def subcommand_analyze_endgames(): + endgames.work_thread() + + def subcommand_init(force: bool, no_fetch_variants: bool): tables = database.get_existing_tables() if len(tables) > 0 and not force: @@ -101,6 +106,7 @@ def get_parser() -> argparse.ArgumentParser: subparsers.add_parser('process-ratings', help="Process ratings of all games.") subparsers.add_parser('process-stats', help="Process statistics for all players.") subparsers.add_parser('generate-site', help="Generate the website from the DB.") + subparsers.add_parser('analyze-endgames', help="Run endgame analysis on games in DB. Resource intensive!") subparsers.add_parser('run', help="Run the automatic suite: Fetch + process games and render site.") fetch_parser = subparsers.add_parser('fetch', help='Fetch new data.') @@ -122,6 +128,7 @@ def main(): 'generate-site': subcommand_generate_site, 'fetch': subcommand_fetch, 'run': subcommand_run, + 'analyze-endgames': subcommand_analyze_endgames }[args.command] if args.verbose: diff --git a/src/endgames.py b/src/endgames.py index 67a8d42..c775778 100644 --- a/src/endgames.py +++ b/src/endgames.py @@ -231,9 +231,6 @@ def work_thread(): time.sleep(60 * constants.ENDGAME_ANALYSIS_QUERY_INTERVAL_MINUTES) else: (game_id, ) = res - logger.info("Analyisng endgame of {}".format(game_id)) + logger.info("Analyzing endgame of game {}".format(game_id)) return_code = analyze_and_store_game(game_id) print("Finished endgame analysis of {}: Returncode {}".format(game_id, return_code)) - - -work_thread()