fred-oss 0.25.0__tar.gz → 0.26.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.25.0/src/main/fred_oss.egg-info → fred_oss-0.26.0}/PKG-INFO +1 -1
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/future/impl.py +42 -0
- fred_oss-0.26.0/src/main/fred/future/utils.py +39 -0
- fred_oss-0.26.0/src/main/fred/version +1 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0/src/main/fred_oss.egg-info}/PKG-INFO +1 -1
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred_oss.egg-info/SOURCES.txt +1 -0
- fred_oss-0.25.0/src/main/fred/version +0 -1
- {fred_oss-0.25.0 → fred_oss-0.26.0}/MANIFEST.in +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/NOTICE.txt +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/README.md +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/requirements.txt +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/setup.cfg +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/setup.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/cli/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/cli/__main__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/cli/interface.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/cli/main.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/dao/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/dao/comp/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/dao/comp/_keyval.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/dao/comp/_queue.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/dao/comp/catalog.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/dao/comp/interface.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/dao/service/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/dao/service/_redis.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/dao/service/_stdlib.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/dao/service/catalog.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/dao/service/interface.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/dao/service/utils.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/future/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/future/callback/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/future/callback/_function.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/future/callback/catalog.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/future/callback/interface.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/future/result.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/future/settings.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/databricks/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/databricks/cli_ext.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/databricks/runtime.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/databricks/runtimes/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/databricks/runtimes/scanner.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/databricks/runtimes/sync.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/databricks/wrappers/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/runpod/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/runpod/cli_ext.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/runpod/helper.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/maturity.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/monad/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/monad/_either.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/monad/catalog.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/monad/interface.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/settings.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/utils/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/utils/dateops.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/utils/runtime.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/version.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/interface.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/client.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/handler.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/info.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/plugins/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/plugins/_local.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/plugins/catalog.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/plugins/interface.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/rest/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/rest/cli_ext.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/rest/routers/__init__.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/rest/routers/_runner.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/rest/routers/catalog.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/rest/routers/interface.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/rest/server.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/worker/runner/utils.py +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred_oss.egg-info/dependency_links.txt +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred_oss.egg-info/entry_points.txt +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred_oss.egg-info/requires.txt +0 -0
- {fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred_oss.egg-info/top_level.txt +0 -0
|
@@ -6,6 +6,7 @@ from typing import (
|
|
|
6
6
|
)
|
|
7
7
|
|
|
8
8
|
from fred.settings import logger_manager
|
|
9
|
+
from fred.future.settings import FRD_FUTURE_DEFAULT_EXPIRATION
|
|
9
10
|
from fred.future.callback.interface import CallbackInterface
|
|
10
11
|
from fred.monad.interface import MonadInterface
|
|
11
12
|
from fred.monad.catalog import EitherMonad
|
|
@@ -217,3 +218,44 @@ class Future(MonadInterface[A]):
|
|
|
217
218
|
Returns: Future[B]: A new Future containing the transformed result.
|
|
218
219
|
"""
|
|
219
220
|
return self.flat_map(function=lambda value: type(self).from_value(function(value)))
|
|
221
|
+
|
|
222
|
+
@classmethod
|
|
223
|
+
def pullsync(
|
|
224
|
+
cls,
|
|
225
|
+
future_id: str,
|
|
226
|
+
delay: float = 0.001,
|
|
227
|
+
delay_incr: float = 0.001,
|
|
228
|
+
delay_max: float = 30,
|
|
229
|
+
timeout: float = FRD_FUTURE_DEFAULT_EXPIRATION,
|
|
230
|
+
on_complete: Optional[CallbackInterface] = None,
|
|
231
|
+
**kwargs
|
|
232
|
+
) -> 'Future[A]':
|
|
233
|
+
"""Pulls an existing future from the backend storage by its ID.
|
|
234
|
+
This method allows for retrieving and interacting with a future
|
|
235
|
+
that was previously created and stored in the backend.
|
|
236
|
+
|
|
237
|
+
Args:
|
|
238
|
+
future_id (str): The unique identifier of the future to be pulled.
|
|
239
|
+
delay (float): Initial delay between checks for the future's completion.
|
|
240
|
+
delay_incr (float): Incremental increase in delay after each check.
|
|
241
|
+
delay_max (float): Maximum delay between checks.
|
|
242
|
+
timeout (float): Maximum time to wait for the future to complete.
|
|
243
|
+
on_complete (Optional[CallbackInterface]): An optional callback to be executed
|
|
244
|
+
when the future completes.
|
|
245
|
+
**kwargs: Additional keyword arguments to be passed to the Future constructor.
|
|
246
|
+
Returns:
|
|
247
|
+
Future[A]: A Future instance representing the pulled future.
|
|
248
|
+
"""
|
|
249
|
+
from fred.future.utils import pull_future_result
|
|
250
|
+
|
|
251
|
+
return cls(
|
|
252
|
+
function=lambda: pull_future_result(
|
|
253
|
+
future_id=future_id,
|
|
254
|
+
delay=delay,
|
|
255
|
+
delay_incr=delay_incr,
|
|
256
|
+
delay_max=delay_max,
|
|
257
|
+
timeout=timeout,
|
|
258
|
+
),
|
|
259
|
+
on_complete=on_complete,
|
|
260
|
+
**kwargs
|
|
261
|
+
)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import time
|
|
2
|
+
from typing import TypeVar, Optional
|
|
3
|
+
|
|
4
|
+
from fred.future.settings import FRD_FUTURE_DEFAULT_EXPIRATION
|
|
5
|
+
|
|
6
|
+
A = TypeVar("A")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def pull_future_result(
|
|
10
|
+
future_id: str,
|
|
11
|
+
delay: float = 0.001,
|
|
12
|
+
delay_incr: float = 0.001,
|
|
13
|
+
delay_max: float = 30,
|
|
14
|
+
timeout: float = FRD_FUTURE_DEFAULT_EXPIRATION,
|
|
15
|
+
) -> A:
|
|
16
|
+
from fred.future.impl import FutureResult, FutureUndefinedInProgress, FutureUndefinedPending
|
|
17
|
+
|
|
18
|
+
if timeout <= 0:
|
|
19
|
+
raise ValueError(f"Pull operation for future_id '{future_id}' has timed out.")
|
|
20
|
+
|
|
21
|
+
match FutureResult.from_backend(future_id=future_id):
|
|
22
|
+
case None:
|
|
23
|
+
raise ValueError(f"No future found with ID '{future_id}'")
|
|
24
|
+
case FutureResult(value=value):
|
|
25
|
+
return value.resolve()
|
|
26
|
+
case FutureUndefinedPending() | FutureUndefinedInProgress():
|
|
27
|
+
# If the future is not yet defined, wait for it to complete
|
|
28
|
+
time.sleep(delay)
|
|
29
|
+
# Increase the delay for the next check to avoid busy waiting (exponential backoff) capped at delay_max
|
|
30
|
+
return pull_future_result(
|
|
31
|
+
future_id=future_id,
|
|
32
|
+
delay=(delay + delay_incr) if delay < delay_max else delay_max,
|
|
33
|
+
delay_incr=delay,
|
|
34
|
+
delay_max=delay_max,
|
|
35
|
+
# TODO: Consider using a more precise timeout mechanism based on elapsed time
|
|
36
|
+
timeout=timeout - delay,
|
|
37
|
+
)
|
|
38
|
+
case _:
|
|
39
|
+
raise ValueError(f"Unknown future state for ID '{future_id}'")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.26.0
|
|
@@ -27,6 +27,7 @@ src/main/fred/future/__init__.py
|
|
|
27
27
|
src/main/fred/future/impl.py
|
|
28
28
|
src/main/fred/future/result.py
|
|
29
29
|
src/main/fred/future/settings.py
|
|
30
|
+
src/main/fred/future/utils.py
|
|
30
31
|
src/main/fred/future/callback/__init__.py
|
|
31
32
|
src/main/fred/future/callback/_function.py
|
|
32
33
|
src/main/fred/future/callback/catalog.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.25.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.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/databricks/runtimes/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/databricks/runtimes/scanner.py
RENAMED
|
File without changes
|
|
File without changes
|
{fred_oss-0.25.0 → fred_oss-0.26.0}/src/main/fred/integrations/databricks/wrappers/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.25.0 → fred_oss-0.26.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
|