fred-oss 0.36.0__tar.gz → 0.38.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fred_oss-0.36.0/src/main/fred_oss.egg-info → fred_oss-0.38.0}/PKG-INFO +1 -1
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/future/impl.py +33 -2
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/future/result.py +23 -2
- fred_oss-0.38.0/src/main/fred/version +1 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0/src/main/fred_oss.egg-info}/PKG-INFO +1 -1
- fred_oss-0.36.0/src/main/fred/version +0 -1
- {fred_oss-0.36.0 → fred_oss-0.38.0}/MANIFEST.in +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/NOTICE.txt +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/README.md +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/requirements.txt +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/setup.cfg +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/setup.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/cli/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/cli/__main__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/cli/interface.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/cli/main.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/dao/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/dao/comp/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/dao/comp/_keyval.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/dao/comp/_queue.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/dao/comp/catalog.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/dao/comp/interface.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/dao/service/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/dao/service/_redis.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/dao/service/_stdlib.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/dao/service/catalog.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/dao/service/interface.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/dao/service/utils.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/future/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/future/callback/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/future/callback/_function.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/future/callback/catalog.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/future/callback/interface.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/future/settings.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/future/utils.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/databricks/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/databricks/cli_ext.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/databricks/runtime.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/databricks/runtimes/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/databricks/runtimes/scanner.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/databricks/runtimes/sync.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/databricks/wrappers/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/runpod/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/runpod/cli_ext.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/runpod/helper.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/maturity.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/monad/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/monad/_either.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/monad/catalog.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/monad/interface.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/settings.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/utils/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/utils/dateops.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/utils/runtime.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/version.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/interface.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/backend.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/client.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/handler.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/model/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/model/_handler.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/model/_item.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/model/_request.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/model/_runner_spec.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/model/catalog.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/model/interface.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/plugins/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/plugins/_local.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/plugins/_runpod.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/plugins/catalog.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/plugins/interface.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/rest/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/rest/auth.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/rest/cli_ext.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/rest/routers/__init__.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/rest/routers/_runner.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/rest/routers/catalog.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/rest/routers/interface.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/rest/server.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/rest/settings.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/settings.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/signal.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/status.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/worker/runner/utils.py +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred_oss.egg-info/SOURCES.txt +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred_oss.egg-info/dependency_links.txt +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred_oss.egg-info/entry_points.txt +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred_oss.egg-info/requires.txt +0 -0
- {fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred_oss.egg-info/top_level.txt +0 -0
|
@@ -62,6 +62,7 @@ class Future(MonadInterface[A]):
|
|
|
62
62
|
function: Callable[..., A],
|
|
63
63
|
on_start: Optional[CallbackInterface] = None,
|
|
64
64
|
on_complete: Optional[CallbackInterface] = None,
|
|
65
|
+
parent_id: Optional[str] = None,
|
|
65
66
|
**kwargs
|
|
66
67
|
):
|
|
67
68
|
"""Initializes a Future with the provided function to be executed asynchronously.
|
|
@@ -76,11 +77,12 @@ class Future(MonadInterface[A]):
|
|
|
76
77
|
All keyword arguments except 'future_id' are forwarded to the target function.
|
|
77
78
|
"""
|
|
78
79
|
# Create a new available future
|
|
79
|
-
future = FutureUndefinedPending.auto(future_id=kwargs.pop("future_id", None))
|
|
80
|
+
future = FutureUndefinedPending.auto(parent_id=parent_id, future_id=kwargs.pop("future_id", None))
|
|
80
81
|
# Register the Future-ID and define the available future via the provided function.
|
|
81
82
|
# Note: The 'apply' method is blocking by itself; thus, we run it in a separate thread.
|
|
82
83
|
# Note: The thread is a daemon to ensure it does not block program exit.
|
|
83
84
|
self.future_id = future.future_id
|
|
85
|
+
self.parent_id = parent_id
|
|
84
86
|
self.thread = Thread(
|
|
85
87
|
target=lambda: future.apply(
|
|
86
88
|
function=function,
|
|
@@ -220,6 +222,7 @@ class Future(MonadInterface[A]):
|
|
|
220
222
|
Future[B]: A new Future representing the chained operation."""
|
|
221
223
|
# TODO: Is there a more efficient implementation?
|
|
222
224
|
return Future(
|
|
225
|
+
parent_id=self.future_id,
|
|
223
226
|
function=lambda:
|
|
224
227
|
function(self.wait_and_resolve(timeout=timeout))
|
|
225
228
|
.wait_and_resolve(timeout=timeout)
|
|
@@ -228,12 +231,23 @@ class Future(MonadInterface[A]):
|
|
|
228
231
|
def map(self, function: Callable[[A], B]) -> 'Future[B]':
|
|
229
232
|
"""Applies a function to the result of the future, returning a new future.
|
|
230
233
|
This method allows for transforming the result of a future without blocking.
|
|
234
|
+
|
|
235
|
+
Original implementation:
|
|
236
|
+
return self.flat_map(function=lambda value: type(self).from_value(function(value)))
|
|
237
|
+
|
|
238
|
+
However, that implementation would create an intermediate Future just to
|
|
239
|
+
hold the transformed value, which is unnecessary overhead. Instead, we can directly create a new Future
|
|
240
|
+
that applies the transformation function to the result of the current future.
|
|
241
|
+
|
|
231
242
|
Args:
|
|
232
243
|
function (Callable[[A], B]): A function that takes the result of the current future
|
|
233
244
|
and returns a new value.
|
|
234
245
|
Returns: Future[B]: A new Future containing the transformed result.
|
|
235
246
|
"""
|
|
236
|
-
return
|
|
247
|
+
return Future(
|
|
248
|
+
function=lambda: function(self.wait_and_resolve()),
|
|
249
|
+
parent_id=self.future_id,
|
|
250
|
+
)
|
|
237
251
|
|
|
238
252
|
@classmethod
|
|
239
253
|
def pullsync(
|
|
@@ -275,3 +289,20 @@ class Future(MonadInterface[A]):
|
|
|
275
289
|
on_complete=on_complete,
|
|
276
290
|
**kwargs
|
|
277
291
|
)
|
|
292
|
+
def lineage(self) -> list[str]:
|
|
293
|
+
"""Retrieves the lineage of the future, tracing back through its parent futures.
|
|
294
|
+
This method is useful for debugging and understanding the sequence of computations
|
|
295
|
+
that led to the current future.
|
|
296
|
+
Returns:
|
|
297
|
+
list[str]: A list of future IDs representing the lineage, starting from the current future
|
|
298
|
+
and tracing back through its parents.
|
|
299
|
+
"""
|
|
300
|
+
logger.warning(
|
|
301
|
+
"The 'lineage' method should only be used for debugging purposes "
|
|
302
|
+
"as it may have performance implications and unreliable lineage due to "
|
|
303
|
+
"possible missing parent_id values caused by cleanup or TTL expiration."
|
|
304
|
+
)
|
|
305
|
+
if not (fr := FutureResult.from_backend(future_id=self.future_id)):
|
|
306
|
+
logger.error(f"Current future_id '{self.future_id}' does not exist in backend.")
|
|
307
|
+
return []
|
|
308
|
+
return fr._lineage()
|
|
@@ -79,6 +79,7 @@ class FutureResult(Generic[A], FutureBackend.infer_backend()):
|
|
|
79
79
|
It uses a key-value store to persist the state and result of the Future, allowing for
|
|
80
80
|
retrieval and management of asynchronous tasks."""
|
|
81
81
|
future_id: str
|
|
82
|
+
parent_id: Optional[str]
|
|
82
83
|
|
|
83
84
|
@staticmethod
|
|
84
85
|
def _get_future_keyname(future_id: str) -> str:
|
|
@@ -131,7 +132,24 @@ class FutureResult(Generic[A], FutureBackend.infer_backend()):
|
|
|
131
132
|
|
|
132
133
|
@classmethod
|
|
133
134
|
def from_backend(cls, future_id: str) -> Optional['FutureResult[A]']:
|
|
134
|
-
return FutureResult(future_id=future_id)._from_backend()
|
|
135
|
+
return FutureResult(future_id=future_id, parent_id=None)._from_backend()
|
|
136
|
+
|
|
137
|
+
@property
|
|
138
|
+
def _pre(self) -> Optional['FutureResult']:
|
|
139
|
+
if not self.parent_id:
|
|
140
|
+
return None
|
|
141
|
+
return FutureResult.from_backend(future_id=self.parent_id)
|
|
142
|
+
|
|
143
|
+
def _lineage(self) -> list[str]:
|
|
144
|
+
if not self.parent_id:
|
|
145
|
+
return [self.future_id]
|
|
146
|
+
if not (parent := self._pre):
|
|
147
|
+
logger.warning(
|
|
148
|
+
f"Cannot retrieve full lineage for Future[{self.future_id}] "
|
|
149
|
+
f"due to missing parent_id '{self.parent_id}'"
|
|
150
|
+
)
|
|
151
|
+
return [self.future_id, self.parent_id]
|
|
152
|
+
return [self.future_id, *parent._lineage()]
|
|
135
153
|
|
|
136
154
|
|
|
137
155
|
@dataclass(frozen=True, slots=False)
|
|
@@ -149,8 +167,9 @@ class FutureUndefinedPending(FutureResult[A]):
|
|
|
149
167
|
FutureUndefinedPending[A]: A new instance of FutureUndefinedPending with a unique future_id.
|
|
150
168
|
"""
|
|
151
169
|
import uuid
|
|
170
|
+
parent_id = kwargs.pop("parent_id", None)
|
|
152
171
|
future_id = kwargs.pop("future_id", None) or str(uuid.uuid4())
|
|
153
|
-
return FutureUndefinedPending[A](future_id=future_id, **kwargs)
|
|
172
|
+
return FutureUndefinedPending[A](future_id=future_id, parent_id=parent_id, **kwargs)
|
|
154
173
|
|
|
155
174
|
def __post_init__(self):
|
|
156
175
|
logger.debug(f"Future[{self.future_id}] initialized and pending execution")
|
|
@@ -183,6 +202,7 @@ class FutureUndefinedPending(FutureResult[A]):
|
|
|
183
202
|
"""
|
|
184
203
|
fip = FutureUndefinedInProgress[A](
|
|
185
204
|
future_id=self.future_id,
|
|
205
|
+
parent_id=self.parent_id,
|
|
186
206
|
started_at=perf_counter(),
|
|
187
207
|
function_name=function.__name__,
|
|
188
208
|
)
|
|
@@ -257,6 +277,7 @@ class FutureUndefinedInProgress(FutureResult[A]):
|
|
|
257
277
|
raise e
|
|
258
278
|
future_defined = FutureDefined(
|
|
259
279
|
future_id=self.future_id,
|
|
280
|
+
parent_id=self.parent_id,
|
|
260
281
|
value=value,
|
|
261
282
|
ok=ok,
|
|
262
283
|
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.38.0
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.36.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/databricks/runtimes/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/databricks/runtimes/scanner.py
RENAMED
|
File without changes
|
|
File without changes
|
{fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/databricks/wrappers/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.36.0 → fred_oss-0.38.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|