tff.program.ProgramStateManager
Stay organized with collections
Save and categorize content based on your preferences.
An interface for saving and loading program state in a federated program.
A tff.program.ProgramStateManager
is used to implement fault tolerance in a
federated program. The structure or type of the program state that is saved is
unknown at construction time and can change as the program runs.
Methods
get_versions
View source
get_versions()
Returns a list of saved versions or None
.
Returns |
A list of saved versions or None if there is no saved program state.
|
load
View source
load(
version, structure
)
Returns the saved program state for the given version
.
Args |
version
|
A integer representing the version of a saved program state.
|
structure
|
The structure of the saved program state for the given
version used to support serialization and deserailization of
user-defined classes in the structure.
|
Raises |
ProgramStateNotFoundError
|
If there is no program state for the given
version .
|
load_latest
View source
load_latest(
structure
)
Returns the latest saved program state and version or (None
, 0).
Args |
structure
|
The structure of the saved program state for the given
version used to support serialization and deserailization of
user-defined classes in the structure.
|
Returns |
A tuple of the latest saved (program state, version) or (None , 0) if
there is no latest saved program state.
|
save
View source
save(
program_state, version
)
Saves program_state
for the given version
.
Raises |
ProgramStateExistsError
|
If there is already program state for the given
version .
|
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.
Last updated 2024-09-20 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-09-20 UTC."],[],[]]