File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
checkpoint/orbax/checkpoint/_src/path Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 5252
5353from __future__ import annotations
5454
55+ import abc
5556import asyncio
5657import pickle
5758import threading
7273from orbax .checkpoint ._src .path import atomicity_types
7374from orbax .checkpoint ._src .path import utils
7475from orbax .checkpoint ._src .path .snapshot import snapshot as snapshot_lib
76+ from orbax .checkpoint .experimental .v1 ._src .path import types as path_types
7577
7678
7779ValidationError = atomicity_types .ValidationError
@@ -207,6 +209,25 @@ def get(self) -> epath.Path:
207209 return self ._tmp_path
208210
209211
212+ class DeferredWritableTemporaryPath (TemporaryPathBase ):
213+ """A TemporaryPath that supports deferred writable path allocation.
214+
215+ This abstract base class is for backends (like TFHub) where the writable
216+ path is allocated asynchronously and may not be immediately available.
217+ Subclasses must implement `get_awaitable_path()` to provide access to the
218+ path as a `PathAwaitingCreation`.
219+ """
220+
221+ @abc .abstractmethod
222+ def get_awaitable_path (self ) -> path_types .PathAwaitingCreation :
223+ """Returns the writable path as a PathAwaitingCreation.
224+
225+ Returns:
226+ A PathAwaitingCreation that resolves to the writable path.
227+ """
228+ ...
229+
230+
210231class ReadOnlyTemporaryPath (atomicity_types .TemporaryPath ):
211232 """A read-only, serializable object providing path properties access.
212233
You can’t perform that action at this time.
0 commit comments