Commit c0347eca authored by Shreyan Chowdhury's avatar Shreyan Chowdhury

implement exit_experiment

parent bc052327
......@@ -70,6 +70,8 @@ elif hostname == 'verena-830g5': # Laptop Verena
USE_GPU = False
elif hostname == 'shreyan-HP': # Laptop Shreyan
USE_GPU = False
PATH_DATA_CACHE = '/home/shreyan/mounts/home@rk2/shared/kofta_cached_datasets'
else:
# PATH_DATA_CACHE = '/home/shreyan/mounts/home@rk3/shared/kofta_cached_datasets'
PATH_DATA_CACHE = '/mnt/2tb/datasets/data_caches'
......@@ -122,18 +124,19 @@ def make_run_name(suffix=''):
return name
CURR_RUN_PATH = ''
curr_run_name = ''
filelog = logging.getLogger()
streamlog = logging.getLogger()
logger = logging.getLogger()
def init_experiment(comment='', name=None):
global CURR_RUN_PATH
global CURR_RUN_PATH, curr_run_name
global filelog, streamlog, logger
if name is None:
curr_run_name = make_run_name(comment)
else:
curr_run_name = name
CURR_RUN_PATH = os.path.join(PATH_RESULTS, 'runs', curr_run_name)
CURR_RUN_PATH = os.path.join(PATH_RESULTS, 'runs', 'running - '+curr_run_name)
if not os.path.isdir(CURR_RUN_PATH):
os.makedirs(CURR_RUN_PATH)
......@@ -160,6 +163,18 @@ def init_experiment(comment='', name=None):
# ============================================
def exit_experiment(status, exp):
global CURR_RUN_PATH
if status=='failed':
os.rename(CURR_RUN_PATH, os.path.join(PATH_RESULTS, 'runs', 'failed - '+curr_run_name))
CURR_RUN_PATH = os.path.join(PATH_RESULTS, 'runs', 'failed - '+curr_run_name)
elif status=='stopped':
os.rename(CURR_RUN_PATH, os.path.join(PATH_RESULTS, 'runs', 'stopped - '+curr_run_name))
CURR_RUN_PATH = os.path.join(PATH_RESULTS, 'runs', 'stopped - '+curr_run_name)
else:
os.rename(CURR_RUN_PATH, os.path.join(PATH_RESULTS, 'runs', curr_run_name))
exp.save_dir = CURR_RUN_PATH
def write_to_file(data, path):
# not fully implemented. unused function as of now.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment