forked from Hanabi/hanabi-league
expand cli for endgames
This commit is contained in:
parent
816bf0d940
commit
60aa757ba0
2 changed files with 8 additions and 4 deletions
|
@ -16,10 +16,15 @@ import fetch_games
|
||||||
import ratings
|
import ratings
|
||||||
import stats
|
import stats
|
||||||
import render_site
|
import render_site
|
||||||
|
import endgames
|
||||||
|
|
||||||
from log_setup import logger
|
from log_setup import logger
|
||||||
|
|
||||||
|
|
||||||
|
def subcommand_analyze_endgames():
|
||||||
|
endgames.work_thread()
|
||||||
|
|
||||||
|
|
||||||
def subcommand_init(force: bool, no_fetch_variants: bool):
|
def subcommand_init(force: bool, no_fetch_variants: bool):
|
||||||
tables = database.get_existing_tables()
|
tables = database.get_existing_tables()
|
||||||
if len(tables) > 0 and not force:
|
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-ratings', help="Process ratings of all games.")
|
||||||
subparsers.add_parser('process-stats', help="Process statistics for all players.")
|
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('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.")
|
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.')
|
fetch_parser = subparsers.add_parser('fetch', help='Fetch new data.')
|
||||||
|
@ -122,6 +128,7 @@ def main():
|
||||||
'generate-site': subcommand_generate_site,
|
'generate-site': subcommand_generate_site,
|
||||||
'fetch': subcommand_fetch,
|
'fetch': subcommand_fetch,
|
||||||
'run': subcommand_run,
|
'run': subcommand_run,
|
||||||
|
'analyze-endgames': subcommand_analyze_endgames
|
||||||
}[args.command]
|
}[args.command]
|
||||||
|
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
|
|
|
@ -231,9 +231,6 @@ def work_thread():
|
||||||
time.sleep(60 * constants.ENDGAME_ANALYSIS_QUERY_INTERVAL_MINUTES)
|
time.sleep(60 * constants.ENDGAME_ANALYSIS_QUERY_INTERVAL_MINUTES)
|
||||||
else:
|
else:
|
||||||
(game_id, ) = res
|
(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)
|
return_code = analyze_and_store_game(game_id)
|
||||||
print("Finished endgame analysis of {}: Returncode {}".format(game_id, return_code))
|
print("Finished endgame analysis of {}: Returncode {}".format(game_id, return_code))
|
||||||
|
|
||||||
|
|
||||||
work_thread()
|
|
||||||
|
|
Loading…
Reference in a new issue