Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
takahi-i committed Nov 18, 2019
1 parent c0aa7f6 commit ac5b296
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 4 additions & 3 deletions hideout/area.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def __init__(self, stage: str = None):
Stage of program.
"""
self.stage = stage
logger.info("HIDEOUT_ENABLE_CACHE is set to {}...".format(env.HIDEOUT_ENABLE_CACHE))
logger.info("HIDEOUT_SKIP_STAGES is set to {}...".format(env.HIDEOUT_SKIP_STAGES))

def resume_or_generate(self, func: Callable, func_args: Dict, label: str = None) -> object:
"""
Expand All @@ -43,11 +45,10 @@ def resume_or_generate(self, func: Callable, func_args: Dict, label: str = None)
object : object
"""
file_path = generate_path(func, func_args, label)
logger.info("cache file: {}".format(file_path))
if env.HIDEOUT_ENABLE_CACHE and self.stage not in env.HIDEOUT_SKIP_STAGES:
logger.error("trying loading cache")
logger.info("specified cache file: {}".format(file_path))
if os.path.exists(file_path):
logger.info("found {}".format(file_path))
logger.info("found {} ...".format(file_path))
with open(file_path, mode='rb') as f:
return pickle.load(f)
else:
Expand Down
2 changes: 0 additions & 2 deletions hideout/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ def freeze(target_object: object, file_path: str, stage: str=None) -> None:
Returns
-------
"""
logger.info("HIDEOUT_ENABLE_CACHE is set to {}".format(env.HIDEOUT_ENABLE_CACHE))
logger.info("HIDEOUT_SKIP_STAGES is set to {}".format(env.HIDEOUT_SKIP_STAGES))
if env.HIDEOUT_ENABLE_CACHE is False or stage in env.HIDEOUT_SKIP_STAGES:
logger.info("skip saving to cache file ...")
return
Expand Down

0 comments on commit ac5b296

Please sign in to comment.