Skip to content

Commit

Permalink
create dir for log file name (microsoft#867)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonichi authored Dec 30, 2022
1 parent 47a3e38 commit e688d56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions flaml/tune/tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ def easy_objective(config):
logger.addHandler(old_handlers[0])
if verbose > 0:
if log_file_name:
os.makedirs(os.path.dirname(log_file_name), exist_ok=True)
logger.addHandler(logging.FileHandler(log_file_name))
elif not logger.hasHandlers():
# Add the console handler.
Expand Down
3 changes: 1 addition & 2 deletions test/tune/test_tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ def pca_flaml(config):
metric="loss",
mode="min",
num_samples=5,
local_dir="logs",
log_file_name="logs/nested.log",
log_file_name="logs/create/nested.log",
verbose=3,
)
print(analysis.best_result)
Expand Down

0 comments on commit e688d56

Please sign in to comment.