fred-oss 0.26.0__tar.gz → 0.27.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.26.0/src/main/fred_oss.egg-info → fred_oss-0.27.0}/PKG-INFO +1 -1
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/callback/_function.py +13 -2
- fred_oss-0.27.0/src/main/fred/future/callback/interface.py +51 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/impl.py +2 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/result.py +11 -1
- fred_oss-0.27.0/src/main/fred/version +1 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0/src/main/fred_oss.egg-info}/PKG-INFO +1 -1
- fred_oss-0.26.0/src/main/fred/future/callback/interface.py +0 -33
- fred_oss-0.26.0/src/main/fred/version +0 -1
- {fred_oss-0.26.0 → fred_oss-0.27.0}/MANIFEST.in +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/NOTICE.txt +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/README.md +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/requirements.txt +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/setup.cfg +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/setup.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/cli/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/cli/__main__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/cli/interface.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/cli/main.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/comp/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/comp/_keyval.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/comp/_queue.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/comp/catalog.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/comp/interface.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/service/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/service/_redis.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/service/_stdlib.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/service/catalog.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/service/interface.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/service/utils.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/callback/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/callback/catalog.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/settings.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/utils.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/cli_ext.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/runtime.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/runtimes/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/runtimes/scanner.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/runtimes/sync.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/wrappers/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/runpod/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/runpod/cli_ext.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/runpod/helper.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/maturity.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/monad/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/monad/_either.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/monad/catalog.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/monad/interface.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/settings.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/utils/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/utils/dateops.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/utils/runtime.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/version.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/interface.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/client.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/handler.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/info.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/plugins/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/plugins/_local.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/plugins/catalog.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/plugins/interface.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/cli_ext.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/routers/__init__.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/routers/_runner.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/routers/catalog.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/routers/interface.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/server.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/utils.py +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred_oss.egg-info/SOURCES.txt +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred_oss.egg-info/dependency_links.txt +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred_oss.egg-info/entry_points.txt +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred_oss.egg-info/requires.txt +0 -0
- {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred_oss.egg-info/top_level.txt +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from typing import (
|
|
2
|
+
Any,
|
|
2
3
|
Callable,
|
|
3
4
|
TypeVar,
|
|
4
5
|
)
|
|
@@ -15,5 +16,15 @@ class CallbackFunction(CallbackInterface[A]):
|
|
|
15
16
|
self.function = function
|
|
16
17
|
self.kwargs = kwargs
|
|
17
18
|
|
|
18
|
-
def
|
|
19
|
-
self.function(
|
|
19
|
+
def _on_start(self, future_id: str) -> Any:
|
|
20
|
+
return self.function(
|
|
21
|
+
future_id=future_id,
|
|
22
|
+
**self.kwargs
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
def _on_complete(self, future_id: str, output: EitherMonad.Either[A]) -> Any:
|
|
26
|
+
return self.function(
|
|
27
|
+
output=output,
|
|
28
|
+
future_id=future_id,
|
|
29
|
+
**self.kwargs
|
|
30
|
+
)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from threading import Thread
|
|
2
|
+
from typing import (
|
|
3
|
+
Generic,
|
|
4
|
+
TypeVar,
|
|
5
|
+
Optional,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
from fred.settings import logger_manager
|
|
9
|
+
from fred.monad.catalog import EitherMonad
|
|
10
|
+
|
|
11
|
+
logger = logger_manager.get_logger(__name__)
|
|
12
|
+
|
|
13
|
+
A = TypeVar("A")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class CallbackInterface(Generic[A]):
|
|
17
|
+
|
|
18
|
+
def _on_start(self, future_id: str):
|
|
19
|
+
raise NotImplementedError
|
|
20
|
+
|
|
21
|
+
def _on_complete(self, future_id: str, output: EitherMonad.Either[A]):
|
|
22
|
+
raise NotImplementedError
|
|
23
|
+
|
|
24
|
+
def run(self, future_id: str, blocking: bool = False, output: Optional[EitherMonad.Either[A]] = None) -> Optional[Thread]:
|
|
25
|
+
"""Executes the callback with the provided output and handles any exceptions.
|
|
26
|
+
Args:
|
|
27
|
+
output (EitherMonad.Either[A]): The output to be passed to the callback.
|
|
28
|
+
Returns:
|
|
29
|
+
bool: True if the callback executed successfully, False otherwise.
|
|
30
|
+
"""
|
|
31
|
+
# TODO: Consider using a richer return type to capture more details about the execution
|
|
32
|
+
# and optionally propagate the callback return value.
|
|
33
|
+
try:
|
|
34
|
+
match output:
|
|
35
|
+
case None:
|
|
36
|
+
thread = Thread(
|
|
37
|
+
target=lambda: self._on_start(future_id=future_id),
|
|
38
|
+
daemon=True
|
|
39
|
+
)
|
|
40
|
+
case EitherMonad.Either():
|
|
41
|
+
thread = Thread(
|
|
42
|
+
target=lambda: self._on_complete(future_id=future_id, output=output),
|
|
43
|
+
daemon=True
|
|
44
|
+
)
|
|
45
|
+
thread.start()
|
|
46
|
+
if blocking:
|
|
47
|
+
thread.join()
|
|
48
|
+
return thread
|
|
49
|
+
except Exception as e:
|
|
50
|
+
logger.error(f"Callback execution failed on future '{future_id}': {e}")
|
|
51
|
+
return None
|
|
@@ -60,6 +60,7 @@ class Future(MonadInterface[A]):
|
|
|
60
60
|
def __init__(
|
|
61
61
|
self,
|
|
62
62
|
function: Callable[..., A],
|
|
63
|
+
on_start: Optional[CallbackInterface] = None,
|
|
63
64
|
on_complete: Optional[CallbackInterface] = None,
|
|
64
65
|
**kwargs
|
|
65
66
|
):
|
|
@@ -84,6 +85,7 @@ class Future(MonadInterface[A]):
|
|
|
84
85
|
target=lambda: future.apply(
|
|
85
86
|
function=function,
|
|
86
87
|
on_complete=on_complete,
|
|
88
|
+
on_start=on_start,
|
|
87
89
|
**kwargs
|
|
88
90
|
),
|
|
89
91
|
daemon=True,
|
|
@@ -166,6 +166,7 @@ class FutureUndefinedPending(FutureResult[A]):
|
|
|
166
166
|
def apply(
|
|
167
167
|
self,
|
|
168
168
|
function: Callable[..., A],
|
|
169
|
+
on_start: Optional[CallbackInterface] = None,
|
|
169
170
|
on_complete: Optional[CallbackInterface] = None,
|
|
170
171
|
**kwargs
|
|
171
172
|
) -> 'FutureDefined[A]':
|
|
@@ -187,6 +188,7 @@ class FutureUndefinedPending(FutureResult[A]):
|
|
|
187
188
|
)
|
|
188
189
|
return fip.exec(
|
|
189
190
|
function=function,
|
|
191
|
+
on_start=on_start,
|
|
190
192
|
on_complete=on_complete,
|
|
191
193
|
**kwargs
|
|
192
194
|
)
|
|
@@ -212,6 +214,7 @@ class FutureUndefinedInProgress(FutureResult[A]):
|
|
|
212
214
|
def exec(
|
|
213
215
|
self,
|
|
214
216
|
function: Callable[..., A],
|
|
217
|
+
on_start: Optional[CallbackInterface] = None,
|
|
215
218
|
on_complete: Optional[CallbackInterface] = None,
|
|
216
219
|
fail: bool = False,
|
|
217
220
|
**kwargs,
|
|
@@ -230,6 +233,11 @@ class FutureUndefinedInProgress(FutureResult[A]):
|
|
|
230
233
|
Returns:
|
|
231
234
|
FutureDefined[A]: A new instance of FutureDefined representing the completed state of the Future.
|
|
232
235
|
"""
|
|
236
|
+
# Execute on_start callback if provided
|
|
237
|
+
on_start_thread = (
|
|
238
|
+
logger.debug(f"Future[{self.future_id}] executing on_start callback")
|
|
239
|
+
or on_start.run(future_id=self.future_id, blocking=False)
|
|
240
|
+
) if on_start else None
|
|
233
241
|
try:
|
|
234
242
|
ok = False
|
|
235
243
|
match function(**kwargs):
|
|
@@ -260,7 +268,9 @@ class FutureUndefinedInProgress(FutureResult[A]):
|
|
|
260
268
|
# wrapped on an Either monad so the user can handle success/failure as needed.
|
|
261
269
|
if on_complete:
|
|
262
270
|
logger.debug(f"Future[{self.future_id}] executing on_complete callback")
|
|
263
|
-
on_complete.run(future_id=self.future_id, output=value)
|
|
271
|
+
on_complete.run(future_id=self.future_id, output=value, blocking=True)
|
|
272
|
+
if on_start_thread:
|
|
273
|
+
on_start_thread.join()
|
|
264
274
|
return future_defined
|
|
265
275
|
|
|
266
276
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.27.0
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
from typing import (
|
|
2
|
-
Generic,
|
|
3
|
-
TypeVar,
|
|
4
|
-
)
|
|
5
|
-
|
|
6
|
-
from fred.settings import logger_manager
|
|
7
|
-
from fred.monad.catalog import EitherMonad
|
|
8
|
-
|
|
9
|
-
logger = logger_manager.get_logger(__name__)
|
|
10
|
-
|
|
11
|
-
A = TypeVar("A")
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class CallbackInterface(Generic[A]):
|
|
15
|
-
|
|
16
|
-
def execute(self, future_id: str, output: EitherMonad.Either[A]):
|
|
17
|
-
raise NotImplementedError()
|
|
18
|
-
|
|
19
|
-
def run(self, future_id: str, output: EitherMonad.Either[A]) -> bool:
|
|
20
|
-
"""Executes the callback with the provided output and handles any exceptions.
|
|
21
|
-
Args:
|
|
22
|
-
output (EitherMonad.Either[A]): The output to be passed to the callback.
|
|
23
|
-
Returns:
|
|
24
|
-
bool: True if the callback executed successfully, False otherwise.
|
|
25
|
-
"""
|
|
26
|
-
# TODO: Consider using a richer return type to capture more details about the execution
|
|
27
|
-
# and optionally propagate the callback return value.
|
|
28
|
-
try:
|
|
29
|
-
self.execute(future_id=future_id, output=output)
|
|
30
|
-
return True
|
|
31
|
-
except Exception as e:
|
|
32
|
-
logger.error(f"Callback execution failed on future '{future_id}': {e}")
|
|
33
|
-
return False
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.26.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
|
{fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/runtimes/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/runtimes/scanner.py
RENAMED
|
File without changes
|
|
File without changes
|
{fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/wrappers/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.26.0 → fred_oss-0.27.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
|