fred-oss 0.41.0__tar.gz → 0.43.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 (93) hide show
  1. {fred_oss-0.41.0/src/main/fred_oss.egg-info → fred_oss-0.43.0}/PKG-INFO +1 -1
  2. fred_oss-0.43.0/src/main/fred/dao/comp/_pubsub.py +78 -0
  3. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/dao/comp/catalog.py +2 -0
  4. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/dao/service/utils.py +3 -3
  5. fred_oss-0.43.0/src/main/fred/version +1 -0
  6. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/routers/_runner.py +3 -1
  7. {fred_oss-0.41.0 → fred_oss-0.43.0/src/main/fred_oss.egg-info}/PKG-INFO +1 -1
  8. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred_oss.egg-info/SOURCES.txt +1 -0
  9. fred_oss-0.41.0/src/main/fred/version +0 -1
  10. {fred_oss-0.41.0 → fred_oss-0.43.0}/MANIFEST.in +0 -0
  11. {fred_oss-0.41.0 → fred_oss-0.43.0}/NOTICE.txt +0 -0
  12. {fred_oss-0.41.0 → fred_oss-0.43.0}/README.md +0 -0
  13. {fred_oss-0.41.0 → fred_oss-0.43.0}/requirements.txt +0 -0
  14. {fred_oss-0.41.0 → fred_oss-0.43.0}/setup.cfg +0 -0
  15. {fred_oss-0.41.0 → fred_oss-0.43.0}/setup.py +0 -0
  16. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/cli/__init__.py +0 -0
  17. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/cli/__main__.py +0 -0
  18. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/cli/interface.py +0 -0
  19. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/cli/main.py +0 -0
  20. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/dao/__init__.py +0 -0
  21. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/dao/comp/__init__.py +0 -0
  22. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/dao/comp/_keyval.py +0 -0
  23. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/dao/comp/_queue.py +0 -0
  24. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/dao/comp/interface.py +0 -0
  25. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/dao/service/__init__.py +0 -0
  26. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/dao/service/_redis.py +0 -0
  27. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/dao/service/_stdlib.py +0 -0
  28. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/dao/service/catalog.py +0 -0
  29. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/dao/service/interface.py +0 -0
  30. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/future/__init__.py +0 -0
  31. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/future/callback/__init__.py +0 -0
  32. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/future/callback/_function.py +0 -0
  33. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/future/callback/catalog.py +0 -0
  34. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/future/callback/interface.py +0 -0
  35. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/future/impl.py +0 -0
  36. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/future/result.py +0 -0
  37. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/future/settings.py +0 -0
  38. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/future/utils.py +0 -0
  39. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/__init__.py +0 -0
  40. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/cli_ext.py +0 -0
  41. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/runtime.py +0 -0
  42. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/runtimes/__init__.py +0 -0
  43. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/runtimes/scanner.py +0 -0
  44. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/runtimes/sync.py +0 -0
  45. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/wrappers/__init__.py +0 -0
  46. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py +0 -0
  47. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/integrations/runpod/__init__.py +0 -0
  48. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/integrations/runpod/cli_ext.py +0 -0
  49. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/integrations/runpod/helper.py +0 -0
  50. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/maturity.py +0 -0
  51. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/monad/__init__.py +0 -0
  52. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/monad/_either.py +0 -0
  53. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/monad/catalog.py +0 -0
  54. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/monad/interface.py +0 -0
  55. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/settings.py +0 -0
  56. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/utils/__init__.py +0 -0
  57. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/utils/dateops.py +0 -0
  58. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/utils/runtime.py +0 -0
  59. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/version.py +0 -0
  60. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/__init__.py +0 -0
  61. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/interface.py +0 -0
  62. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/__init__.py +0 -0
  63. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/backend.py +0 -0
  64. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/client.py +0 -0
  65. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/handler.py +0 -0
  66. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/__init__.py +0 -0
  67. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/_handler.py +0 -0
  68. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/_item.py +0 -0
  69. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/_request.py +0 -0
  70. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/_runner_spec.py +0 -0
  71. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/catalog.py +0 -0
  72. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/interface.py +0 -0
  73. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/plugins/__init__.py +0 -0
  74. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/plugins/_local.py +0 -0
  75. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/plugins/_runpod.py +0 -0
  76. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/plugins/catalog.py +0 -0
  77. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/plugins/interface.py +0 -0
  78. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/__init__.py +0 -0
  79. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/auth.py +0 -0
  80. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/cli_ext.py +0 -0
  81. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/routers/__init__.py +0 -0
  82. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/routers/catalog.py +0 -0
  83. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/routers/interface.py +0 -0
  84. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/server.py +0 -0
  85. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/settings.py +0 -0
  86. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/settings.py +0 -0
  87. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/signal.py +0 -0
  88. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/status.py +0 -0
  89. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/utils.py +0 -0
  90. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred_oss.egg-info/dependency_links.txt +0 -0
  91. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred_oss.egg-info/entry_points.txt +0 -0
  92. {fred_oss-0.41.0 → fred_oss-0.43.0}/src/main/fred_oss.egg-info/requires.txt +0 -0
  93. {fred_oss-0.41.0 → fred_oss-0.43.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.41.0
3
+ Version: 0.43.0
4
4
  Summary: FREDOSS
5
5
  Home-page: https://fred.fahera.mx
6
6
  Author: Fahera Research, Education, and Development
@@ -0,0 +1,78 @@
1
+ import uuid
2
+ from dataclasses import dataclass
3
+ from typing import Optional
4
+
5
+ from fred.settings import logger_manager
6
+ from fred.dao.service.catalog import ServiceCatalog
7
+ from fred.dao.comp.interface import ComponentInterface
8
+
9
+ logger = logger_manager.get_logger(name=__name__)
10
+
11
+
12
+ class FredSubscriptionMixin:
13
+ # TODO: Improve typing... and better underlying subscriptions management!
14
+ # This only works within the same python process.
15
+ subs: dict = {}
16
+
17
+
18
+ @dataclass(frozen=True, slots=True)
19
+ class FredPubSub(ComponentInterface, FredSubscriptionMixin):
20
+ """A simple publish-subscribe (pub-sub) implementation using a backend service.
21
+ This class provides methods to interact with pub-sub channels, such as publishing
22
+ messages, subscribing to channels, and managing subscriptions. The actual implementation
23
+ of these methods depends on the underlying service being used (e.g., Redis).
24
+ Attributes:
25
+ name: str: The name of the pub-sub channel.
26
+ """
27
+ name: str
28
+
29
+ def publish(self, item: str) -> int:
30
+ match self._cat:
31
+ case ServiceCatalog.REDIS:
32
+ return self._srv.client.publish(self.name, item)
33
+ case ServiceCatalog.STDLIB:
34
+ raise NotImplementedError("Publish method not implemented for STDLIB service")
35
+ case _:
36
+ raise NotImplementedError(f"Publish method not implemented for service {self._nme}")
37
+
38
+ def subscribe(self, subscription_id: Optional[str] = None):
39
+ """Subscribe to the pub/sub channel and yield messages as they arrive.
40
+
41
+ This method creates (or reuses) a subscription to the channel specified by `self.name`.
42
+ It returns a generator that yields messages received on the channel.
43
+ The implementation depends on the underlying service (e.g., Redis).
44
+
45
+ Args:
46
+ subscription_id (Optional[str]): An optional identifier for the subscription. If not provided, a new UUID is generated.
47
+
48
+ Yields:
49
+ Messages received from the channel.
50
+ Raises:
51
+ NotImplementedError: If the method is not implemented for the current service.
52
+ """
53
+ subscription_id = subscription_id or (
54
+ logger.info(f"Creating new subscriber for channel: {self.name}")
55
+ or str(uuid.uuid4())
56
+ )
57
+ logger.info(f"Using subscription ID: {subscription_id}")
58
+ match self._cat:
59
+ case ServiceCatalog.REDIS:
60
+ subscriber = self.subs[subscription_id] = self.subs.get(subscription_id, None) or self._srv.client.pubsub()
61
+ subscriber.subscribe(self.name)
62
+ yield from subscriber.listen()
63
+ case ServiceCatalog.STDLIB:
64
+ raise NotImplementedError("Subscribe method not implemented for STDLIB service")
65
+ case _:
66
+ raise NotImplementedError(f"Subscribe method not implemented for service {self._nme}")
67
+
68
+ @classmethod
69
+ def unsubscribe(cls, subscription_id: str, close: bool = False) -> None:
70
+ # TODO: Implement the 'unsubscribe' and optially close the subscriber.
71
+ logger.error("The unsubscribe method not implemented yet.")
72
+ raise NotImplementedError("Unsubscribe method not implemented yet.")
73
+
74
+ @classmethod
75
+ def subscribers(cls) -> list[str]:
76
+ # TODO: Implement the 'subscribers' method to list active subscriptions.
77
+ logger.error("The subscribers method not implemented yet.")
78
+ raise NotImplementedError("Subscribers method not implemented yet.")
@@ -5,6 +5,7 @@ from typing import Optional
5
5
  from fred.dao.comp.interface import ComponentInterface, SRV_REF_TYPE
6
6
  from fred.dao.comp._queue import FredQueue
7
7
  from fred.dao.comp._keyval import FredKeyVal
8
+ from fred.dao.comp._pubsub import FredPubSub
8
9
 
9
10
 
10
11
  class _PreconfCatalogMixin:
@@ -34,6 +35,7 @@ class CompCatalog(enum.Enum):
34
35
  """
35
36
  QUEUE = FredQueue
36
37
  KEYVAL = FredKeyVal
38
+ PUBSUB = FredPubSub
37
39
 
38
40
  @classmethod
39
41
  def from_classname(cls, classname: str) -> "CompCatalog":
@@ -28,10 +28,10 @@ def get_redis_configs_from_payload(
28
28
  if (db := payload.get(db_key) if keep else payload.pop(db_key, None)):
29
29
  break
30
30
  return {
31
- "host": host or get_environ_variable(name="REDIS_HOST", default="localhost"),
32
- "port": int(port or get_environ_variable(name="REDIS_PORT", default=6379)),
31
+ "host": host or get_environ_variable(name="REDIS_HOST", default=None) or "localhost",
32
+ "port": int(port or get_environ_variable(name="REDIS_PORT", default=None) or 6379),
33
33
  "password": password or get_environ_variable(name="REDIS_PASSWORD", default=None),
34
- "db": int(db or get_environ_variable(name="REDIS_DB", default=0)),
34
+ "db": int(db or get_environ_variable(name="REDIS_DB", default=None) or 0),
35
35
  "decode_responses": True,
36
36
  **(payload.get("redis_configs", {}) if keep else payload.pop("redis_configs", {})),
37
37
  }
@@ -0,0 +1 @@
1
+ 0.43.0
@@ -58,8 +58,10 @@ class RunnerRouterMethods:
58
58
  runner_spec = RunnerModelCatalog.RUNNER_SPEC.value.from_payload(payload=payload)
59
59
  # Instantiate the plugin and execute the runner
60
60
  plugin = PluginCatalog[plugin_name.upper()]()
61
+ output = plugin.execute(runner_spec, wait_for_exec=wait_for_exec, **payload)
61
62
  return {
62
- "runner_id": plugin.execute(runner_spec, wait_for_exec=wait_for_exec, **payload).runner_id,
63
+ "runner_id": output.runner_id,
64
+ "future_id": output.future_exec.future_id,
63
65
  "queue_slug": runner_spec.queue_slug,
64
66
  }
65
67
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fred-oss
3
- Version: 0.41.0
3
+ Version: 0.43.0
4
4
  Summary: FREDOSS
5
5
  Home-page: https://fred.fahera.mx
6
6
  Author: Fahera Research, Education, and Development
@@ -14,6 +14,7 @@ src/main/fred/cli/main.py
14
14
  src/main/fred/dao/__init__.py
15
15
  src/main/fred/dao/comp/__init__.py
16
16
  src/main/fred/dao/comp/_keyval.py
17
+ src/main/fred/dao/comp/_pubsub.py
17
18
  src/main/fred/dao/comp/_queue.py
18
19
  src/main/fred/dao/comp/catalog.py
19
20
  src/main/fred/dao/comp/interface.py
@@ -1 +0,0 @@
1
- 0.41.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes