Skip to content

Commit

Permalink
added exp disable if already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
williamFalcon committed Jul 12, 2019
1 parent f778d40 commit 96f739f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions test_tube/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,19 @@ def __init__(
self.__create_exp_file(self.version + 1)

# create a git tag if requested
if self.create_git_tag and not debug:
if self.create_git_tag:
desc = description if description is not None else 'no description'
tag_msg = 'Test tube exp: {} - {}'.format(self.name, desc)
cmd = 'git tag -a tt_{} -m "{}"'.format(self.exp_hash, tag_msg)
os.system(cmd)
print('Test tube created git tag:', 'tt_{}'.format(self.exp_hash))

if not debug:
# set the tensorboardx log path to the /tf folder in the exp folder
logdir = self.get_tensorboardx_path(self.name, self.version)
super().__init__(log_dir=logdir, *args, **kwargs)
# set the tensorboardx log path to the /tf folder in the exp folder
logdir = self.get_tensorboardx_path(self.name, self.version)
super().__init__(log_dir=logdir, *args, **kwargs)

# register on exit fx so we always close the writer
atexit.register(self.on_exit)
# register on exit fx so we always close the writer
atexit.register(self.on_exit)

def get_meta_copy(self):
"""
Expand Down Expand Up @@ -186,7 +185,7 @@ def __init_cache_file_if_needed(self):
try:
exp_cache_file = self.get_data_path(self.name, self.version)
if not os.path.isdir(exp_cache_file):
os.makedirs(exp_cache_file)
os.makedirs(exp_cache_file, exist_ok=True)
except Exception as e:
# file already exists (likely written by another exp. In this case disable the experiment
self.debug = True
Expand All @@ -206,10 +205,10 @@ def __create_exp_file(self, version):
self.version = version

# make the directory for the experiment media assets name
os.makedirs(self.get_media_path(self.name, self.version))
os.makedirs(self.get_media_path(self.name, self.version), exist_ok=True)

# make the directory for tensorboardx stuff
os.makedirs(self.get_tensorboardx_path(self.name, self.version))
os.makedirs(self.get_tensorboardx_path(self.name, self.version), exist_ok=True)
except Exception as e:
# file already exists (likely written by another exp. In this case disable the experiment
self.debug = True
Expand Down

0 comments on commit 96f739f

Please sign in to comment.