fred-oss 0.44.0__tar.gz → 0.46.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.44.0/src/main/fred_oss.egg-info → fred_oss-0.46.0}/PKG-INFO +1 -1
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/future/impl.py +35 -3
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/future/result.py +0 -1
- fred_oss-0.46.0/src/main/fred/version +1 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/interface.py +9 -4
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/client.py +14 -2
- fred_oss-0.46.0/src/main/fred/worker/settings.py +7 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0/src/main/fred_oss.egg-info}/PKG-INFO +1 -1
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred_oss.egg-info/SOURCES.txt +1 -0
- fred_oss-0.44.0/src/main/fred/version +0 -1
- {fred_oss-0.44.0 → fred_oss-0.46.0}/MANIFEST.in +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/NOTICE.txt +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/README.md +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/requirements.txt +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/setup.cfg +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/setup.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/cli/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/cli/__main__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/cli/interface.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/cli/main.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/dao/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/dao/comp/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/dao/comp/_keyval.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/dao/comp/_pubsub.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/dao/comp/_queue.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/dao/comp/catalog.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/dao/comp/interface.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/dao/service/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/dao/service/_redis.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/dao/service/_stdlib.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/dao/service/catalog.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/dao/service/interface.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/dao/service/utils.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/future/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/future/callback/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/future/callback/_function.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/future/callback/catalog.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/future/callback/interface.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/future/settings.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/future/utils.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/databricks/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/databricks/cli_ext.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/databricks/runtime.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/databricks/runtimes/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/databricks/runtimes/scanner.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/databricks/runtimes/sync.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/databricks/wrappers/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/runpod/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/runpod/cli_ext.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/runpod/helper.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/maturity.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/monad/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/monad/_either.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/monad/catalog.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/monad/interface.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/settings.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/utils/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/utils/dateops.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/utils/runtime.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/version.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/backend.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/handler.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/model/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/model/_handler.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/model/_item.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/model/_request.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/model/_runner_spec.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/model/catalog.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/model/interface.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/plugins/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/plugins/_local.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/plugins/_runpod.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/plugins/catalog.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/plugins/interface.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/rest/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/rest/auth.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/rest/cli_ext.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/rest/routers/__init__.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/rest/routers/_runner.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/rest/routers/catalog.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/rest/routers/interface.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/rest/server.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/rest/settings.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/settings.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/signal.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/status.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/worker/runner/utils.py +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred_oss.egg-info/dependency_links.txt +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred_oss.egg-info/entry_points.txt +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred_oss.egg-info/requires.txt +0 -0
- {fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred_oss.egg-info/top_level.txt +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import time
|
|
1
2
|
from threading import Thread
|
|
2
3
|
from typing import (
|
|
3
4
|
Callable,
|
|
@@ -204,8 +205,22 @@ class Future(MonadInterface[A]):
|
|
|
204
205
|
return self.wait(timeout=timeout).resolve()
|
|
205
206
|
|
|
206
207
|
@classmethod
|
|
207
|
-
def from_value(cls, val: A) -> 'Future[A]':
|
|
208
|
-
|
|
208
|
+
def from_value(cls, val: A, **kwargs) -> 'Future[A]':
|
|
209
|
+
"""
|
|
210
|
+
Creates a Future that is immediately resolved with the given value.
|
|
211
|
+
|
|
212
|
+
Args:
|
|
213
|
+
val (A): The value to resolve the Future with.
|
|
214
|
+
**kwargs: Additional keyword arguments forwarded to the Future constructor.
|
|
215
|
+
These may include parameters such as:
|
|
216
|
+
- parent_id (Optional[str]): The parent future's ID.
|
|
217
|
+
- expiration (Optional[float]): Expiration time for the future.
|
|
218
|
+
- callback (Optional[CallbackInterface]): Callback to invoke on completion.
|
|
219
|
+
For a full list of accepted parameters, see the Future class documentation.
|
|
220
|
+
Returns:
|
|
221
|
+
Future[A]: A Future instance resolved with the provided value.
|
|
222
|
+
"""
|
|
223
|
+
return Future(function=lambda: val, **kwargs)
|
|
209
224
|
|
|
210
225
|
def flat_map(self, function: Callable[[A], 'Future[B]'], timeout: Optional[float] = None) -> 'Future[B]':
|
|
211
226
|
"""Chains the current future with another future-producing function.
|
|
@@ -305,6 +320,8 @@ class Future(MonadInterface[A]):
|
|
|
305
320
|
future_id: str,
|
|
306
321
|
on_start: Optional[CallbackInterface] = None,
|
|
307
322
|
on_complete: Optional[CallbackInterface] = None,
|
|
323
|
+
retry_delay: float = 0.2,
|
|
324
|
+
retry: int = 3,
|
|
308
325
|
) -> 'Future[A]':
|
|
309
326
|
"""Subscribes to updates for an existing future using a publish-subscribe mechanism.
|
|
310
327
|
This method allows for receiving real-time updates about the future's state
|
|
@@ -318,9 +335,13 @@ class Future(MonadInterface[A]):
|
|
|
318
335
|
Returns:
|
|
319
336
|
Future[A]: A Future instance that will execute the subscription logic.
|
|
320
337
|
"""
|
|
338
|
+
# TODO: Consider adding a timeout parameter to avoid waiting indefinitely...
|
|
339
|
+
# TODO: There's a known issue where if the future completes before we subscribe,
|
|
340
|
+
# we might miss the completion message.
|
|
321
341
|
# Define a closure that will handle incoming messages from the pub-sub channel
|
|
322
342
|
def closure():
|
|
323
343
|
for payload in FutureResult._get_bcast_channel(future_id=future_id).subscribe():
|
|
344
|
+
logger.info(f"Received pubsub message for future '{future_id}': {payload}")
|
|
324
345
|
if payload.get("type") != "message":
|
|
325
346
|
continue
|
|
326
347
|
message = payload.get("data")
|
|
@@ -352,11 +373,22 @@ class Future(MonadInterface[A]):
|
|
|
352
373
|
case instance:
|
|
353
374
|
# The future-result can be None if the future_id does not exist
|
|
354
375
|
if not instance:
|
|
355
|
-
|
|
376
|
+
if retry <= 0:
|
|
377
|
+
raise ValueError(f"Future with ID '{future_id}' does not exist.")
|
|
378
|
+
logger.error(f"Future with ID '{future_id}' does not exist; attempting to retry ({retry} retries left).")
|
|
379
|
+
time.sleep(retry_delay)
|
|
380
|
+
return cls.subscribe(
|
|
381
|
+
future_id=future_id,
|
|
382
|
+
on_start=on_start,
|
|
383
|
+
on_complete=on_complete,
|
|
384
|
+
retry_delay=retry_delay,
|
|
385
|
+
retry=max(0, retry - 1),
|
|
386
|
+
)
|
|
356
387
|
# If the future exists, but is not configured for broadcast, raise an error...
|
|
357
388
|
if not instance.broadcast:
|
|
358
389
|
raise ValueError("Future is not configured for broadcast; cannot subscribe.")
|
|
359
390
|
# If the future exists and is configured for broadcast, subscribe to updates...
|
|
391
|
+
logger.info(f"Subscribing to future '{future_id}' via broadcast channel.")
|
|
360
392
|
return cls(
|
|
361
393
|
function=closure,
|
|
362
394
|
**shared_params
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.46.0
|
|
@@ -2,6 +2,7 @@ import time
|
|
|
2
2
|
from typing import overload, Callable, Optional
|
|
3
3
|
from dataclasses import dataclass, field
|
|
4
4
|
|
|
5
|
+
from fred.worker.settings import FRD_WORKER_DEFAULT_BROADCAST
|
|
5
6
|
from fred.future.impl import Future # Should we make this import lazy?
|
|
6
7
|
from fred.utils.dateops import datetime_utcnow
|
|
7
8
|
from fred.settings import (
|
|
@@ -139,14 +140,14 @@ class HandlerInterface:
|
|
|
139
140
|
return json.loads(metadata_serialized)
|
|
140
141
|
|
|
141
142
|
@overload
|
|
142
|
-
def run(self, event: dict, as_future: bool = True, future_id: Optional[str] = None) -> Future[dict]:
|
|
143
|
+
def run(self, event: dict, as_future: bool = True, broadcast: Optional[bool] = None, future_id: Optional[str] = None) -> Future[dict]:
|
|
143
144
|
...
|
|
144
145
|
|
|
145
146
|
@overload
|
|
146
|
-
def run(self, event: dict, as_future: bool = False, future_id: Optional[str] = None) -> dict:
|
|
147
|
+
def run(self, event: dict, as_future: bool = False, broadcast: Optional[bool] = None, future_id: Optional[str] = None) -> dict:
|
|
147
148
|
...
|
|
148
149
|
|
|
149
|
-
def run(self, event: dict, as_future: bool = False, future_id: Optional[str] = None) -> dict | Future[dict]:
|
|
150
|
+
def run(self, event: dict, as_future: bool = False, broadcast: Optional[bool] = None, future_id: Optional[str] = None) -> dict | Future[dict]:
|
|
150
151
|
"""Process an incoming event and return a structured response.
|
|
151
152
|
The event is expected to be a dictionary with at least an 'id' and 'input' keys.
|
|
152
153
|
The 'input' key should contain the payload to be processed.
|
|
@@ -158,7 +159,11 @@ class HandlerInterface:
|
|
|
158
159
|
If requested as a Future, returns a Future that will resolve to the response dictionary.
|
|
159
160
|
"""
|
|
160
161
|
if as_future:
|
|
161
|
-
return Future(
|
|
162
|
+
return Future(
|
|
163
|
+
future_id=future_id,
|
|
164
|
+
function=lambda: self.run(event=event, as_future=False),
|
|
165
|
+
broadcast=FRD_WORKER_DEFAULT_BROADCAST if broadcast is None else broadcast,
|
|
166
|
+
)
|
|
162
167
|
# Extract payload and event ID
|
|
163
168
|
payload = event.get("input", {})
|
|
164
169
|
job_event_identifier = event.get("id")
|
|
@@ -124,6 +124,10 @@ class RunnerClient:
|
|
|
124
124
|
retry_backoff_rate: float = 0.1,
|
|
125
125
|
**kwargs,
|
|
126
126
|
) -> Future:
|
|
127
|
+
logger.warning(
|
|
128
|
+
"Using 'pullsync' is to be deprecated soon; use the 'Future.subscribe' "
|
|
129
|
+
"method instead (by default this is used on fetch_result with 'use_pullsync=False')."
|
|
130
|
+
)
|
|
127
131
|
return Future(
|
|
128
132
|
function=self._pullsync,
|
|
129
133
|
request_id=request_id,
|
|
@@ -160,8 +164,16 @@ class RunnerClient:
|
|
|
160
164
|
return False
|
|
161
165
|
return True
|
|
162
166
|
|
|
163
|
-
def fetch_result(
|
|
164
|
-
|
|
167
|
+
def fetch_result(
|
|
168
|
+
self,
|
|
169
|
+
request_id: str,
|
|
170
|
+
now: bool = False,
|
|
171
|
+
timeout: Optional[float] = None,
|
|
172
|
+
use_pullsync: bool = False,
|
|
173
|
+
**kwargs,
|
|
174
|
+
) -> Optional[dict]:
|
|
175
|
+
future = self.pullsync(request_id=request_id, **kwargs) \
|
|
176
|
+
if use_pullsync else Future.subscribe(future_id=request_id, **kwargs)
|
|
165
177
|
if now:
|
|
166
178
|
return future.getwhatevernow()
|
|
167
179
|
return future.wait_and_resolve(timeout=timeout)
|
|
@@ -53,6 +53,7 @@ src/main/fred/utils/dateops.py
|
|
|
53
53
|
src/main/fred/utils/runtime.py
|
|
54
54
|
src/main/fred/worker/__init__.py
|
|
55
55
|
src/main/fred/worker/interface.py
|
|
56
|
+
src/main/fred/worker/settings.py
|
|
56
57
|
src/main/fred/worker/runner/__init__.py
|
|
57
58
|
src/main/fred/worker/runner/backend.py
|
|
58
59
|
src/main/fred/worker/runner/client.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.44.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
|
|
File without changes
|
{fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/databricks/runtimes/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/databricks/runtimes/scanner.py
RENAMED
|
File without changes
|
|
File without changes
|
{fred_oss-0.44.0 → fred_oss-0.46.0}/src/main/fred/integrations/databricks/wrappers/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.44.0 → fred_oss-0.46.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
|