Exemplo n.º 1
0
    def __init__(self, cwd, guild_home=None, env=None):
        from guild import index as indexlib  # expensive

        self.cwd = cwd
        self.guild_home = guild_home or mkdtemp()
        self._env = env
        runs_cache_path = os.path.join(self.guild_home, "cache", "runs")
        self.index = indexlib.RunIndex(runs_cache_path)
Exemplo n.º 2
0
def _print_scalars(args):
    runs = runs_impl.runs_for_args(args)
    index = indexlib.RunIndex()
    index.refresh(runs, ["scalar"])
    for run in runs:
        cli.out("[%s] %s" % (run.short_id, run_util.format_operation(run, nowarn=True)))
        for s in index.run_scalars(run):
            key, step, val = (run_util.run_scalar_key(s), s["last_step"], s["last_val"])
            cli.out("  %s: %f (step %i)" % (key, val, step))
Exemplo n.º 3
0
def get_data(args, format_cells=True, skip_header_if_empty=False):
    index = indexlib.RunIndex()
    cb = _get_data_cb(
        args,
        index,
        format_cells=format_cells,
        skip_header_if_empty=skip_header_if_empty,
    )
    data, logs = cb()
    for record in logs:
        log.handle(record)
    return data
Exemplo n.º 4
0
def _sort_selected_runs(runs, scalar, reverse):
    from guild import index as indexlib  # expensive

    run_scalar_args = _run_scalar_args_for_select(scalar)
    index = indexlib.RunIndex()
    index.refresh(runs, ["scalar"])
    factor = -1 if reverse else 1
    inf = float('inf')

    def key(run):
        scalar = index.run_scalar(run, *run_scalar_args)
        if scalar is None:
            return inf
        return factor * scalar

    return sorted(runs, key=key)
Exemplo n.º 5
0
def _run_index_for_scalars(runs):
    from guild import index as indexlib  # expensive

    index = indexlib.RunIndex()
    index.refresh(runs, ["scalar"])
    return index
Exemplo n.º 6
0
def _tabview(args):
    config.set_log_output(True)
    index = indexlib.RunIndex()
    tabview.view_runs(_get_data_cb(args, index), _get_run_detail_cb(index),
                      _tabview_actions())
Exemplo n.º 7
0
 def _init_index(runs):
     index = indexlib.RunIndex()
     index.refresh(runs, ["scalar"])
     return index
Exemplo n.º 8
0
def _run_scalars(state):
    from guild import index as indexlib  # expensive

    index = indexlib.RunIndex()
    index.refresh([state.run], ["scalar"])
    return list(index.run_scalars(state.run))