Пример #1
0
def wandb_dir():
    root_dir = env.get_dir(os.getcwd())
    path = os.path.join(root_dir, __stage_dir__ or ("wandb" + os.sep))
    if not os.access(root_dir, os.W_OK):
        termwarn("Path %s wasn't writable, using system temp directory" % path)
        path = os.path.join(tempfile.gettempdir(), __stage_dir__
                            or ("wandb" + os.sep))
    return path
Пример #2
0
def wandb_dir(root_dir=None):
    if root_dir is None or root_dir == "":
        try:
            cwd = os.getcwd()
        except OSError:
            termwarn(
                "os.getcwd() no longer exists, using system temp directory")
            cwd = tempfile.gettempdir()
        root_dir = env.get_dir(cwd)
    path = os.path.join(root_dir, __stage_dir__ or ("wandb" + os.sep))
    if not os.access(root_dir, os.W_OK):
        termwarn("Path %s wasn't writable, using system temp directory" % path)
        path = os.path.join(tempfile.gettempdir(), __stage_dir__
                            or ("wandb" + os.sep))
    return path
Пример #3
0
 def __init__(self, client, username, project, name, attrs={}):
     self.client = client
     self.username = username
     self.project = project
     self.name = name
     self._files = {}
     self._base_dir = get_dir(tempfile.gettempdir())
     self.dir = os.path.join(self._base_dir, *self.path)
     try:
         os.makedirs(self.dir)
     except OSError:
         pass
     self._summary = None
     super(Run, self).__init__(attrs)
     self.state = attrs.get("state", "not found")
     self.load()
Пример #4
0
    def __init__(self, client, entity, project, run_id, attrs={}):
        super(Run, self).__init__(dict(attrs))
        self.client = client
        self._entity = entity
        self.project = project
        self._files = {}
        self._base_dir = env.get_dir(tempfile.gettempdir())
        self.id = run_id
        self.dir = os.path.join(self._base_dir, *self.path)
        try:
            os.makedirs(self.dir)
        except OSError:
            pass
        self._summary = None
        self.state = attrs.get("state", "not found")

        self.load(force=not attrs)
Пример #5
0
    def __init__(self, client, entity, project, run_id, attrs={}):
        """
        Run is always initialized by calling api.runs() where api is an instance of wandb.Api
        """
        super(Run, self).__init__(dict(attrs))
        self.client = client
        self._entity = entity
        self.project = project
        self._files = {}
        self._base_dir = env.get_dir(tempfile.gettempdir())
        self.id = run_id
        self.dir = os.path.join(self._base_dir, *self.path)
        try:
            os.makedirs(self.dir)
        except OSError:
            pass
        self._summary = None
        self.state = attrs.get("state", "not found")

        self.load(force=not attrs)
Пример #6
0
The purpose of this module is to break circular imports.
"""

import os
import string
import sys
import time
import tempfile

import click
import wandb

from wandb import env

# We use the hidden version if it already exists, otherwise non-hidden.
if os.path.exists(os.path.join(env.get_dir(os.getcwd()), '.wandb')):
    __stage_dir__ = '.wandb' + os.sep
elif os.path.exists(os.path.join(env.get_dir(os.getcwd()), 'wandb')):
    __stage_dir__ = f'wandb{os.sep}'
else:
    __stage_dir__ = None

SCRIPT_PATH = os.path.abspath(sys.argv[0])
wandb.START_TIME = time.time()
LIB_ROOT = os.path.join(os.path.dirname(__file__), '..')
IS_GIT = os.path.exists(os.path.join(LIB_ROOT, '.git'))


def wandb_dir(root_dir=None):
    if root_dir is None or root_dir == "":
        root_dir = env.get_dir(os.getcwd())