Add option to remove uid from CSVLogger file path.
@@ -41,9 +41,11 @@ class CSVLogger(base.Logger):
def __init__(self,
directory_or_file: Union[str, TextIO] = '~/acme',
label: str = '',
- time_delta: float = 0.):
+ time_delta: float = 0.,
+ add_uid: bool = True):
self._last_log_time = time.time() - time_delta
self._time_delta = time_delta
+ self._add_uid = add_uid
self._writer = None
self._file = self._create_file(directory_or_file, label)
logging.info('Logging to %s', self.file_path)
@@ -53,7 +55,7 @@ class CSVLogger(base.Logger):
"""Opens a file if input is a directory or use existing file."""
if isinstance(directory_or_file, str):
directory = paths.process_path(
- directory_or_file, 'logs', label, add_uid=True)
+ directory_or_file, 'logs', label, add_uid=self._add_uid)
file_path = os.path.join(directory, 'logs.csv')
file = self._open(file_path, mode='a')
else:
