expand cli for endgames

This commit is contained in:
Maximilian Keßler 2024-01-13 15:38:57 +01:00
parent 816bf0d940
commit 60aa757ba0
Signed by: max
GPG Key ID: BCC5A619923C0BA5
2 changed files with 8 additions and 4 deletions

View File

@ -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:

View File

@ -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()