fred-oss 0.42.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.
- {fred_oss-0.42.0/src/main/fred_oss.egg-info → fred_oss-0.43.0}/PKG-INFO +1 -1
- fred_oss-0.43.0/src/main/fred/dao/comp/_pubsub.py +78 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/dao/comp/catalog.py +2 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/dao/service/utils.py +3 -3
- fred_oss-0.43.0/src/main/fred/version +1 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0/src/main/fred_oss.egg-info}/PKG-INFO +1 -1
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred_oss.egg-info/SOURCES.txt +1 -0
- fred_oss-0.42.0/src/main/fred/version +0 -1
- {fred_oss-0.42.0 → fred_oss-0.43.0}/MANIFEST.in +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/NOTICE.txt +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/README.md +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/requirements.txt +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/setup.cfg +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/setup.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/cli/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/cli/__main__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/cli/interface.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/cli/main.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/dao/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/dao/comp/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/dao/comp/_keyval.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/dao/comp/_queue.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/dao/comp/interface.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/dao/service/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/dao/service/_redis.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/dao/service/_stdlib.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/dao/service/catalog.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/dao/service/interface.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/future/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/future/callback/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/future/callback/_function.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/future/callback/catalog.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/future/callback/interface.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/future/impl.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/future/result.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/future/settings.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/future/utils.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/cli_ext.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/runtime.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/runtimes/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/runtimes/scanner.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/runtimes/sync.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/wrappers/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/runpod/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/runpod/cli_ext.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/runpod/helper.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/maturity.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/monad/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/monad/_either.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/monad/catalog.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/monad/interface.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/settings.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/utils/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/utils/dateops.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/utils/runtime.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/version.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/interface.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/backend.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/client.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/handler.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/_handler.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/_item.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/_request.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/_runner_spec.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/catalog.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/model/interface.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/plugins/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/plugins/_local.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/plugins/_runpod.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/plugins/catalog.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/plugins/interface.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/auth.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/cli_ext.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/routers/__init__.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/routers/_runner.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/routers/catalog.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/routers/interface.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/server.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/rest/settings.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/settings.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/signal.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/status.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/worker/runner/utils.py +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred_oss.egg-info/dependency_links.txt +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred_oss.egg-info/entry_points.txt +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred_oss.egg-info/requires.txt +0 -0
- {fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred_oss.egg-info/top_level.txt +0 -0
|
@@ -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
|
|
@@ -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.42.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.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/runtimes/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/runtimes/scanner.py
RENAMED
|
File without changes
|
|
File without changes
|
{fred_oss-0.42.0 → fred_oss-0.43.0}/src/main/fred/integrations/databricks/wrappers/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.42.0 → fred_oss-0.43.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
|
|
File without changes
|
|
File without changes
|