Example #1
0
def winners(ctx, name, log, recursive, metric):
    if len(name) == 0:
        if not recursive:
            name = ctx.obj.get("tournament_name", "")
        else:
            name = None

    if (name is None or len(name) == 0) and not recursive:
        print(
            "Name is not given to run command and was not stored during a create command call"
        )
        exit(1)
    saved_log_folder = ctx.obj.get("tournament_log_folder", None)

    if saved_log_folder is not None:
        log = saved_log_folder

    if name is not None and len(name) > 0:
        tpath = str(pathlib.Path(log) / name)
    else:
        tpath = str(pathlib.Path(log))
    results = evaluate_tournament(tournament_path=tpath,
                                  verbose=True,
                                  recursive=recursive,
                                  metric=metric)
    display_results(results, metric)
Example #2
0
def run(ctx, name, verbosity, parallel, distributed, ip, port, compact, path,
        log, metric):
    if len(name) == 0:
        name = ctx.obj.get("tournament_name", "")
    if len(name) == 0:
        print(
            "Name is not given to run command and was not stored during a create command call"
        )
        exit(1)
    if len(path) > 0:
        sys.path.append(path)
    saved_log_folder = ctx.obj.get("tournament_log_folder", None)
    if saved_log_folder is not None:
        log = saved_log_folder
    parallelism = "distributed" if distributed else "parallel" if parallel else "serial"
    prog_callback = print_world_progress if verbosity > 1 and not distributed else None
    tpath = str(pathlib.Path(log) / name)
    start = perf_counter()
    run_tournament(
        tournament_path=tpath,
        verbose=verbosity > 0,
        compact=compact,
        world_progress_callback=prog_callback,
        parallelism=parallelism,
        scheduler_ip=ip,
        scheduler_port=port,
        print_exceptions=verbosity > 1,
    )
    end_time = humanize_time(perf_counter() - start)
    results = evaluate_tournament(tournament_path=tpath,
                                  verbose=verbosity > 0,
                                  metric=metric)
    display_results(results, metric)
    print(f"Finished in {end_time}")
Example #3
0
def combine(path, dest, metric):
    tpath = [_path(_) for _ in path]
    if len(tpath) < 1:
        print("No paths are given to combine")
    scores = combine_tournaments(sources=tpath, dest=None, verbose=True)
    stats = combine_tournament_stats(sources=tpath, dest=None, verbose=True)
    results = evaluate_tournament(dest,
                                  scores,
                                  stats,
                                  verbose=True,
                                  metric=metric)
    display_results(results, metric)
Example #4
0
def combine_results(path, dest, metric, significance, compile, verbose):
    tpath = [_path(_) for _ in path]

    if len(tpath) < 1:
        print("No paths are given to combine")
    scores = combine_tournament_results(sources=tpath,
                                        dest=None,
                                        verbose=verbose)
    stats = combine_tournament_stats(sources=tpath, dest=None, verbose=verbose)
    results = evaluate_tournament(dest,
                                  scores,
                                  stats,
                                  verbose=verbose,
                                  metric=metric,
                                  compile=compile)
    display_results(results, metric, significance)
Example #5
0
def eval(ctx, path, metric, significance, compile, verbose):
    results = evaluate_tournament(tournament_path=path,
                                  metric=metric,
                                  compile=compile,
                                  verbose=verbose)
    display_results(results, metric, significance)