Commit d4512404 authored by Shreyan Chowdhury's avatar Shreyan Chowdhury

add exit_experiment

parent ba5869eb
......@@ -124,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)
......@@ -162,6 +163,15 @@ def init_experiment(comment='', name=None):
# ============================================
def exit_experiment(status):
if status=='failed':
os.rename(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))
else:
os.rename(CURR_RUN_PATH, os.path.join(PATH_RESULTS, 'runs', curr_run_name))
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