orbit.actions.ExportFileManager
Stay organized with collections
Save and categorize content based on your preferences.
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.
Args |
base_name
|
A shared base name for file names generated by this class.
|
max_to_keep
|
The maximum number of files matching base_name to keep
after each call to cleanup . The most recent (as determined by file
modification time) max_to_keep files are preserved; the rest are
deleted. If < 0, all files are preserved.
|
next_id_fn
|
An optional callable that returns integer IDs to append to
base name (formatted as '{base_name}-{id}' ). The order of integers is
used to sort files to determine the oldest ones deleted by clean_up .
If not supplied, a default ID based on an incrementing counter is used.
One common alternative maybe be to use the current global step count,
for instance passing next_id_fn=global_step.numpy .
|
subdirectory
|
An optional subdirectory to concat after the
{base_name}-{id}. Then the file manager will manage
{base_name}-{id}/{subdirectory} files.
|
Attributes |
managed_files
|
Returns all files managed by this instance, in sorted order.
|
Methods
clean_up
View source
clean_up()
Cleans up old files matching {base_name}-*
.
The most recent max_to_keep
files are preserved.
next_name
View source
next_name() -> str
Returns a new file name based on base_name
and next_id_fn()
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-11-01 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-01 UTC."],[],[]]