Skip to content

Commit 9504bfc

Browse files
mxberlotOrbax Authors
authored andcommitted
Internal change
PiperOrigin-RevId: 871810032
1 parent 6a36d40 commit 9504bfc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

checkpoint/orbax/checkpoint/_src/path/atomicity.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
from __future__ import annotations
5454

55+
import abc
5556
import asyncio
5657
import pickle
5758
import threading
@@ -72,6 +73,7 @@
7273
from orbax.checkpoint._src.path import atomicity_types
7374
from orbax.checkpoint._src.path import utils
7475
from 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

7779
ValidationError = 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+
210231
class ReadOnlyTemporaryPath(atomicity_types.TemporaryPath):
211232
"""A read-only, serializable object providing path properties access.
212233

0 commit comments

Comments
 (0)