Skip to content
Snippets Groups Projects
Commit a7ed8cad authored by Neta Zmora's avatar Neta Zmora
Browse files

Fix system tests failure

The latest changes to the logger caused the CI tests to fail,
because test assumes that the logging.conf file is present in the
same directory as the sample application script.
The sample application used cwd() instead, and did not find the
log configuration file.
parent 792e9e39
No related branches found
No related tags found
No related merge requests found
...@@ -91,11 +91,12 @@ def config_pylogger(log_cfg_file, experiment_name): ...@@ -91,11 +91,12 @@ def config_pylogger(log_cfg_file, experiment_name):
""" """
timestr = time.strftime("%Y.%m.%d-%H%M%S") timestr = time.strftime("%Y.%m.%d-%H%M%S")
filename = timestr if experiment_name is None else experiment_name + '___' + timestr filename = timestr if experiment_name is None else experiment_name + '___' + timestr
logdir = './logs' + '/' + filename logdir = os.path.join('./logs', filename)
if not os.path.exists(logdir): if not os.path.exists(logdir):
os.makedirs(logdir) os.makedirs(logdir)
log_filename = os.path.join(logdir, filename + '.log') log_filename = os.path.join(logdir, filename + '.log')
logging.config.fileConfig(os.path.join(os.getcwd(), log_cfg_file), defaults={'logfilename': log_filename}) if os.path.isfile(log_cfg_file):
logging.config.fileConfig(log_cfg_file, defaults={'logfilename': log_filename})
msglogger = logging.getLogger() msglogger = logging.getLogger()
msglogger.logdir = logdir msglogger.logdir = logdir
msglogger.log_filename = log_filename msglogger.log_filename = log_filename
......
...@@ -146,7 +146,7 @@ def main(): ...@@ -146,7 +146,7 @@ def main():
global msglogger global msglogger
check_pytorch_version() check_pytorch_version()
args = parser.parse_args() args = parser.parse_args()
msglogger = apputils.config_pylogger('logging.conf', args.name) msglogger = apputils.config_pylogger(os.path.join(script_dir, 'logging.conf'), args.name)
# Log various details about the execution environment. It is sometimes useful # Log various details about the execution environment. It is sometimes useful
# to refer to past experiment executions and this information may be useful. # to refer to past experiment executions and this information may be useful.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment