View source on GitHub |
Utility class that manages a group of files with a shared base name.
orbit.actions.ExportFileManager(
base_name: str,
max_to_keep: int = 5,
next_id_fn: Optional[Callable[[], int]] = None,
subdirectory: Optional[str] = None
)
For actions like SavedModel exporting, there are potentially many different file naming and cleanup strategies that may be desirable. This class provides a basic interface allowing SavedModel export to be decoupled from these details, and a default implementation that should work for many basic scenarios. Users may subclass this class to alter behavior and define more customized naming and cleanup strategies.
Attributes | |
---|---|
managed_files
|
Returns all files managed by this instance, in sorted order. |
Methods
clean_up
clean_up()
Cleans up old files matching {base_name}-*
.
The most recent max_to_keep
files are preserved.
next_name
next_name() -> str
Returns a new file name based on base_name
and next_id_fn()
.