예제 #1
0
def list_runs(ctx):
    repo_path = ctx.obj['repo']
    if not Repo.exists(repo_path):
        click.echo(f'\'{repo_path}\' is not a valid aim repo.')
        exit(1)
    chunks_dir = os.path.join(repo_path, '.aim', 'meta', 'chunks')
    run_hashes = os.listdir(chunks_dir)

    click.echo('\t'.join(run_hashes))
    click.echo(f'Total {len(run_hashes)} runs.')
예제 #2
0
def init():
    """
    Initializes new repository in the current working directory:
     - Creates .aim directory & runs upgrades for structured DB
    """
    repo_path = os.getcwd()
    re_init = False
    if Repo.exists(repo_path):
        re_init = click.confirm('Aim repository is already initialized. ' +
                                'Do you want to re-initialize it?')
        if not re_init:
            return
        # Clear old repo
        Repo.rm(repo_path)

    repo = Repo.from_path(repo_path, init=True)
    repo.structured_db.run_upgrades()
    if re_init:
        click.echo('Re-initialized empty Aim repository at {}'.format(
            repo.root_path))
    else:
        click.echo(('Initialized a new ' + 'Aim repository at {}').format(
            repo.root_path))
예제 #3
0
def init(repo):
    """
    Initializes new repository in the --repo directory.
    Initializes new repository in the current working directory if --repo argument is not provided:
     - Creates .aim directory & runs upgrades for structured DB
    """
    repo_path = clean_repo_path(repo) or os.getcwd()
    re_init = False
    if Repo.exists(repo_path):
        re_init = click.confirm(
            'Aim repository is already initialized. '
            'Do you want to re-initialize to empty Aim repository?')
        if not re_init:
            return
        # Clear old repo
        Repo.rm(repo_path)

    repo = Repo.from_path(repo_path, init=True)
    if re_init:
        click.echo('Re-initialized empty Aim repository at {}'.format(
            repo.root_path))
    else:
        click.echo('Initialized a new Aim repository at {}'.format(
            repo.root_path))