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.
Files changed (80) hide show
  1. {fred_oss-0.26.0/src/main/fred_oss.egg-info → fred_oss-0.27.0}/PKG-INFO +1 -1
  2. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/callback/_function.py +13 -2
  3. fred_oss-0.27.0/src/main/fred/future/callback/interface.py +51 -0
  4. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/impl.py +2 -0
  5. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/result.py +11 -1
  6. fred_oss-0.27.0/src/main/fred/version +1 -0
  7. {fred_oss-0.26.0 → fred_oss-0.27.0/src/main/fred_oss.egg-info}/PKG-INFO +1 -1
  8. fred_oss-0.26.0/src/main/fred/future/callback/interface.py +0 -33
  9. fred_oss-0.26.0/src/main/fred/version +0 -1
  10. {fred_oss-0.26.0 → fred_oss-0.27.0}/MANIFEST.in +0 -0
  11. {fred_oss-0.26.0 → fred_oss-0.27.0}/NOTICE.txt +0 -0
  12. {fred_oss-0.26.0 → fred_oss-0.27.0}/README.md +0 -0
  13. {fred_oss-0.26.0 → fred_oss-0.27.0}/requirements.txt +0 -0
  14. {fred_oss-0.26.0 → fred_oss-0.27.0}/setup.cfg +0 -0
  15. {fred_oss-0.26.0 → fred_oss-0.27.0}/setup.py +0 -0
  16. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/cli/__init__.py +0 -0
  17. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/cli/__main__.py +0 -0
  18. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/cli/interface.py +0 -0
  19. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/cli/main.py +0 -0
  20. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/__init__.py +0 -0
  21. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/comp/__init__.py +0 -0
  22. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/comp/_keyval.py +0 -0
  23. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/comp/_queue.py +0 -0
  24. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/comp/catalog.py +0 -0
  25. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/comp/interface.py +0 -0
  26. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/service/__init__.py +0 -0
  27. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/service/_redis.py +0 -0
  28. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/service/_stdlib.py +0 -0
  29. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/service/catalog.py +0 -0
  30. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/service/interface.py +0 -0
  31. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/dao/service/utils.py +0 -0
  32. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/__init__.py +0 -0
  33. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/callback/__init__.py +0 -0
  34. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/callback/catalog.py +0 -0
  35. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/settings.py +0 -0
  36. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/future/utils.py +0 -0
  37. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/__init__.py +0 -0
  38. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/cli_ext.py +0 -0
  39. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/runtime.py +0 -0
  40. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/runtimes/__init__.py +0 -0
  41. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/runtimes/scanner.py +0 -0
  42. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/runtimes/sync.py +0 -0
  43. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/wrappers/__init__.py +0 -0
  44. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py +0 -0
  45. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/runpod/__init__.py +0 -0
  46. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/runpod/cli_ext.py +0 -0
  47. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/integrations/runpod/helper.py +0 -0
  48. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/maturity.py +0 -0
  49. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/monad/__init__.py +0 -0
  50. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/monad/_either.py +0 -0
  51. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/monad/catalog.py +0 -0
  52. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/monad/interface.py +0 -0
  53. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/settings.py +0 -0
  54. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/utils/__init__.py +0 -0
  55. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/utils/dateops.py +0 -0
  56. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/utils/runtime.py +0 -0
  57. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/version.py +0 -0
  58. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/__init__.py +0 -0
  59. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/interface.py +0 -0
  60. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/__init__.py +0 -0
  61. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/client.py +0 -0
  62. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/handler.py +0 -0
  63. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/info.py +0 -0
  64. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/plugins/__init__.py +0 -0
  65. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/plugins/_local.py +0 -0
  66. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/plugins/catalog.py +0 -0
  67. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/plugins/interface.py +0 -0
  68. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/__init__.py +0 -0
  69. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/cli_ext.py +0 -0
  70. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/routers/__init__.py +0 -0
  71. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/routers/_runner.py +0 -0
  72. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/routers/catalog.py +0 -0
  73. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/routers/interface.py +0 -0
  74. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/rest/server.py +0 -0
  75. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred/worker/runner/utils.py +0 -0
  76. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred_oss.egg-info/SOURCES.txt +0 -0
  77. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred_oss.egg-info/dependency_links.txt +0 -0
  78. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred_oss.egg-info/entry_points.txt +0 -0
  79. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred_oss.egg-info/requires.txt +0 -0
  80. {fred_oss-0.26.0 → fred_oss-0.27.0}/src/main/fred_oss.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fred-oss
3
- Version: 0.26.0
3
+ Version: 0.27.0
4
4
  Summary: FREDOSS
5
5
  Home-page: https://fred.fahera.mx
6
6
  Author: Fahera Research, Education, and Development
@@ -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 execute(self, future_id: str, output: EitherMonad.Either[A]):
19
- self.function(output, **self.kwargs)
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fred-oss
3
- Version: 0.26.0
3
+ Version: 0.27.0
4
4
  Summary: FREDOSS
5
5
  Home-page: https://fred.fahera.mx
6
6
  Author: Fahera Research, Education, and Development
@@ -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