View source on GitHub |
A tff.program.ReleaseManager
that releases values after specified delay.
Inherits From: ReleaseManager
tff.program.DelayedReleaseManager(
release_manager: ReleaseManager[ReleasableStructure, Key], delay: int
)
A tff.program.DelayedReleaseManager
is a utility for releasing values in a
federated program, where releases only take place after a specified delay
count. I.e., releases from platform storage to customer storage will take
place only after a certain number of instances that the .release()
method is
called. After this delay, further calls to .release()
will release values
(in accordance with the release_manager
that was provided).
For example, in a federated program that runs for a long time, one may want to skip releasing values until the program has run for a sufficiently long-enough period.
The delay count is specified at construction time by setting the delay
argument (an integer). A delay
of 3
means that all values will start to be
released once release
has been invoked at least three times.
Args | |
---|---|
release_manager
|
A tff.program.ReleaseManager used to release values to.
|
delay
|
The delay duration before releasing values. Must be a positive integer. |
Raises | |
---|---|
ValueError
|
If delay is not positive.
|
Methods
release
release(
value, key
)
Releases value
from a federated program.
Args | |
---|---|
value
|
A tff.program.ReleasableStructure to release.
|
key
|
A value used to reference the released value .
|