Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
torch-wrapper / aim.py
Size: Mime:
"""Modifies Aim's built-in logger ``aim.Run``"""
import string
import secrets
from datetime import datetime

from aim import Run as _BaseRun
from aim import Repo
from typing import Optional, Union


def generate_run_hash():
    today = datetime.today()
    # time = today.strftime('%m%d%H%M%S')
    time = today.strftime('%m%d%H%M')
    # rand = ''.join(secrets.choice(string.ascii_uppercase) for _ in range(6))
    rand = secrets.token_hex(4)
    return time + rand


class Run(_BaseRun):
    def __init__(self, run_hash: Optional[str] = None, repo: Optional[Union[str, 'Repo']] = None, **run_kwargs):
        """

        Parameters
        ----------
        run_hash : hash for this run
        repo
        run_kwargs : other keyword arguments for ``aim.Run``.
        """
        if run_hash is None:
            run_hash = generate_run_hash()
        super(Run, self).__init__(run_hash=run_hash, repo=repo, **run_kwargs)