fred-oss 0.17.0__tar.gz → 0.19.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.17.0/src/main/fred_oss.egg-info → fred_oss-0.19.0}/PKG-INFO +1 -1
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/dao/comp/_keyval.py +23 -6
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/dao/comp/_queue.py +23 -0
- fred_oss-0.19.0/src/main/fred/dao/service/_stdlib.py +54 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/dao/service/catalog.py +2 -0
- fred_oss-0.19.0/src/main/fred/version +1 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0/src/main/fred_oss.egg-info}/PKG-INFO +1 -1
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred_oss.egg-info/SOURCES.txt +1 -0
- fred_oss-0.17.0/src/main/fred/version +0 -1
- {fred_oss-0.17.0 → fred_oss-0.19.0}/MANIFEST.in +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/NOTICE.txt +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/README.md +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/requirements.txt +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/setup.cfg +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/setup.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/cli/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/cli/__main__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/cli/interface.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/cli/main.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/dao/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/dao/comp/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/dao/comp/catalog.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/dao/comp/interface.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/dao/service/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/dao/service/_redis.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/dao/service/interface.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/dao/service/utils.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/databricks/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/databricks/cli_ext.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/databricks/runtime.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/databricks/runtimes/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/databricks/runtimes/scanner.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/databricks/runtimes/sync.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/databricks/wrappers/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/runpod/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/runpod/cli_ext.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/runpod/helper.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/maturity.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/settings.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/utils/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/utils/dateops.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/utils/runtime.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/version.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/interface.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/client.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/handler.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/info.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/plugins/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/plugins/_local.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/plugins/catalog.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/plugins/interface.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/rest/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/rest/cli_ext.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/rest/routers/__init__.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/rest/routers/_runner.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/rest/routers/catalog.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/rest/routers/interface.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/rest/server.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/worker/runner/utils.py +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred_oss.egg-info/dependency_links.txt +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred_oss.egg-info/entry_points.txt +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred_oss.egg-info/requires.txt +0 -0
- {fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred_oss.egg-info/top_level.txt +0 -0
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Optional
|
|
3
3
|
|
|
4
|
+
from fred.settings import logger_manager
|
|
4
5
|
from fred.dao.service.catalog import ServiceCatalog
|
|
5
6
|
from fred.dao.comp.interface import ComponentInterface
|
|
6
7
|
|
|
8
|
+
logger = logger_manager.get_logger(name=__name__)
|
|
9
|
+
|
|
7
10
|
|
|
8
11
|
@dataclass(frozen=True, slots=True)
|
|
9
12
|
class FredKeyVal(ComponentInterface):
|
|
@@ -12,8 +15,9 @@ class FredKeyVal(ComponentInterface):
|
|
|
12
15
|
getting, and deleting key-value pairs. The actual implementation of these methods
|
|
13
16
|
depends on the underlying service being used (e.g., Redis).
|
|
14
17
|
"""
|
|
18
|
+
key: str
|
|
15
19
|
|
|
16
|
-
def set(self,
|
|
20
|
+
def set(self, value: str, key: Optional[str] = None, **kwargs) -> None:
|
|
17
21
|
"""Sets a key-value pair in the store.
|
|
18
22
|
The implementation of this method depends on the underlying service.
|
|
19
23
|
For example, if the service is Redis, it uses the SET command to store the
|
|
@@ -26,16 +30,22 @@ class FredKeyVal(ComponentInterface):
|
|
|
26
30
|
Raises:
|
|
27
31
|
NotImplementedError: If the method is not implemented for the current service.
|
|
28
32
|
"""
|
|
33
|
+
key = key or self.key
|
|
29
34
|
match self._cat:
|
|
30
35
|
case ServiceCatalog.REDIS:
|
|
31
36
|
self._srv.client.set(key, value)
|
|
32
37
|
expire = kwargs.get("expire")
|
|
33
38
|
if expire and isinstance(expire, int):
|
|
34
39
|
self._srv.client.expire(key, expire)
|
|
40
|
+
case ServiceCatalog.STDLIB:
|
|
41
|
+
self._srv.client._memstore_keyval[key] = value
|
|
42
|
+
# TODO: Implement expiration logic
|
|
43
|
+
if "expire" in kwargs:
|
|
44
|
+
logger.warning("Expiration not implemented for STDLIB service.")
|
|
35
45
|
case _:
|
|
36
46
|
raise NotImplementedError(f"Set method not implemented for service {self._nme}")
|
|
37
47
|
|
|
38
|
-
def get(self, key: str, fail: bool = False) -> Optional[str]:
|
|
48
|
+
def get(self, key: Optional[str] = None, fail: bool = False) -> Optional[str]:
|
|
39
49
|
"""Gets the value associated with a key from the store.
|
|
40
50
|
The implementation of this method depends on the underlying service.
|
|
41
51
|
For example, if the service is Redis, it uses the GET command to retrieve the
|
|
@@ -50,16 +60,20 @@ class FredKeyVal(ComponentInterface):
|
|
|
50
60
|
KeyError: If the key is not found and fail is True.
|
|
51
61
|
NotImplementedError: If the method is not implemented for the current service.
|
|
52
62
|
"""
|
|
63
|
+
key = key or self.key
|
|
64
|
+
result = None
|
|
53
65
|
match self._cat:
|
|
54
66
|
case ServiceCatalog.REDIS:
|
|
55
67
|
result = self._srv.client.get(key)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return result
|
|
68
|
+
case ServiceCatalog.STDLIB:
|
|
69
|
+
result = self._srv.client._memstore_keyval.get(key)
|
|
59
70
|
case _:
|
|
60
71
|
raise NotImplementedError(f"Get method not implemented for service {self._nme}")
|
|
72
|
+
if fail and result is None:
|
|
73
|
+
raise KeyError(f"Key {key} not found.")
|
|
74
|
+
return result
|
|
61
75
|
|
|
62
|
-
def delete(self, key: str) -> None:
|
|
76
|
+
def delete(self, key: Optional[str] = None) -> None:
|
|
63
77
|
"""Deletes a key-value pair from the store.
|
|
64
78
|
The implementation of this method depends on the underlying service.
|
|
65
79
|
For example, if the service is Redis, it uses the DEL command to remove the
|
|
@@ -69,8 +83,11 @@ class FredKeyVal(ComponentInterface):
|
|
|
69
83
|
Raises:
|
|
70
84
|
NotImplementedError: If the method is not implemented for the current service.
|
|
71
85
|
"""
|
|
86
|
+
key = key or self.key
|
|
72
87
|
match self._cat:
|
|
73
88
|
case ServiceCatalog.REDIS:
|
|
74
89
|
self._srv.client.delete(key)
|
|
90
|
+
case ServiceCatalog.STDLIB:
|
|
91
|
+
self._srv.client._memstore_keyval.pop(key, None)
|
|
75
92
|
case _:
|
|
76
93
|
raise NotImplementedError(f"Delete method not implemented for service {self._nme}")
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Optional
|
|
3
3
|
|
|
4
|
+
from fred.settings import logger_manager
|
|
4
5
|
from fred.dao.service.catalog import ServiceCatalog
|
|
5
6
|
from fred.dao.comp.interface import ComponentInterface
|
|
6
7
|
|
|
8
|
+
logger = logger_manager.get_logger(name=__name__)
|
|
9
|
+
|
|
7
10
|
|
|
8
11
|
@dataclass(frozen=True, slots=True)
|
|
9
12
|
class FredQueue(ComponentInterface):
|
|
@@ -29,6 +32,9 @@ class FredQueue(ComponentInterface):
|
|
|
29
32
|
match self._cat:
|
|
30
33
|
case ServiceCatalog.REDIS:
|
|
31
34
|
return self._srv.client.llen(self.name)
|
|
35
|
+
case ServiceCatalog.STDLIB:
|
|
36
|
+
q = self._srv.client._memstore_queue.get(self.name, None)
|
|
37
|
+
return q.qsize() if q else 0
|
|
32
38
|
case _:
|
|
33
39
|
raise NotImplementedError(f"Size method not implemented for service {self._nme}")
|
|
34
40
|
|
|
@@ -43,6 +49,9 @@ class FredQueue(ComponentInterface):
|
|
|
43
49
|
match self._cat:
|
|
44
50
|
case ServiceCatalog.REDIS:
|
|
45
51
|
self._srv.client.delete(self.name)
|
|
52
|
+
case ServiceCatalog.STDLIB:
|
|
53
|
+
if (q := self._srv.client._memstore_queue.pop(self.name, None)):
|
|
54
|
+
del q
|
|
46
55
|
case _:
|
|
47
56
|
raise NotImplementedError(f"Clear method not implemented for service {self._nme}")
|
|
48
57
|
|
|
@@ -59,6 +68,11 @@ class FredQueue(ComponentInterface):
|
|
|
59
68
|
match self._cat:
|
|
60
69
|
case ServiceCatalog.REDIS:
|
|
61
70
|
self._srv.client.lpush(self.name, item)
|
|
71
|
+
case ServiceCatalog.STDLIB:
|
|
72
|
+
from queue import Queue
|
|
73
|
+
qs = self._srv.client._memstore_queue
|
|
74
|
+
q = qs[self.name] = qs.get(self.name, None) or Queue()
|
|
75
|
+
q.put(item)
|
|
62
76
|
case _:
|
|
63
77
|
raise NotImplementedError(f"Add method not implemented for service {self._srv._nme}")
|
|
64
78
|
|
|
@@ -75,5 +89,14 @@ class FredQueue(ComponentInterface):
|
|
|
75
89
|
match self._cat:
|
|
76
90
|
case ServiceCatalog.REDIS:
|
|
77
91
|
return self._srv.client.rpop(self.name)
|
|
92
|
+
case ServiceCatalog.STDLIB:
|
|
93
|
+
from queue import Empty
|
|
94
|
+
if not (q := self._srv.client._memstore_queue.get(self.name, None)):
|
|
95
|
+
return None
|
|
96
|
+
try:
|
|
97
|
+
return q.get_nowait()
|
|
98
|
+
except Empty:
|
|
99
|
+
logger.info(f"Queue '{self.name}' is empty.")
|
|
100
|
+
return None
|
|
78
101
|
case _:
|
|
79
102
|
raise NotImplementedError(f"Pop method not implemented for service {self._srv._nme}")
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from queue import Queue
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from fred.utils.runtime import RuntimeInfo
|
|
6
|
+
from fred.dao.service.interface import ServiceConnectionPoolInterface, ServiceInterface
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class StdLibSingleton:
|
|
10
|
+
_instance: Optional["StdLib"] = None
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def get_instance(cls, **kwargs) -> "StdLib":
|
|
14
|
+
if cls._instance is None:
|
|
15
|
+
cls._instance = StdLib.auto(**kwargs)
|
|
16
|
+
return cls._instance
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass(frozen=True, slots=True)
|
|
20
|
+
class StdLib:
|
|
21
|
+
runtime_info: RuntimeInfo
|
|
22
|
+
_memstore_keyval: dict[str, str]
|
|
23
|
+
_memstore_queue: dict[str, Queue]
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def auto(cls, **kwargs) -> "StdLib":
|
|
27
|
+
_memstore_keyval = kwargs.pop("memstore_keyval", {})
|
|
28
|
+
_memstore_queue = kwargs.pop("memstore_queue", {})
|
|
29
|
+
return cls(
|
|
30
|
+
runtime_info=RuntimeInfo.auto(**kwargs),
|
|
31
|
+
_memstore_keyval=_memstore_keyval,
|
|
32
|
+
_memstore_queue=_memstore_queue,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class StdLibConnectionPool(ServiceConnectionPoolInterface[StdLibSingleton]):
|
|
37
|
+
|
|
38
|
+
@classmethod
|
|
39
|
+
def _create_pool(cls, **kwargs) -> StdLibSingleton:
|
|
40
|
+
return StdLibSingleton(**kwargs)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class StdLibService(ServiceInterface[StdLib]):
|
|
44
|
+
instance: StdLib
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def _create_instance(cls, **kwargs) -> StdLib:
|
|
48
|
+
pool = StdLibConnectionPool.get_or_create_pool(**kwargs)
|
|
49
|
+
return pool.get_instance(**kwargs)
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def auto(cls, **kwargs) -> "StdLib":
|
|
53
|
+
cls.instance = cls._create_instance(**kwargs)
|
|
54
|
+
return cls(**kwargs)
|
|
@@ -4,11 +4,13 @@ from typing import TypeVar, Optional
|
|
|
4
4
|
|
|
5
5
|
from fred.dao.service.interface import ServiceInterface
|
|
6
6
|
from fred.dao.service._redis import RedisService
|
|
7
|
+
from fred.dao.service._stdlib import StdLibService
|
|
7
8
|
|
|
8
9
|
T = TypeVar("T")
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class ServiceCatalog(enum.Enum):
|
|
13
|
+
STDLIB = StdLibService
|
|
12
14
|
REDIS = RedisService
|
|
13
15
|
|
|
14
16
|
@classmethod
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.19.0
|
|
@@ -19,6 +19,7 @@ src/main/fred/dao/comp/catalog.py
|
|
|
19
19
|
src/main/fred/dao/comp/interface.py
|
|
20
20
|
src/main/fred/dao/service/__init__.py
|
|
21
21
|
src/main/fred/dao/service/_redis.py
|
|
22
|
+
src/main/fred/dao/service/_stdlib.py
|
|
22
23
|
src/main/fred/dao/service/catalog.py
|
|
23
24
|
src/main/fred/dao/service/interface.py
|
|
24
25
|
src/main/fred/dao/service/utils.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.17.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
|
{fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/databricks/runtimes/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/databricks/runtimes/scanner.py
RENAMED
|
File without changes
|
|
File without changes
|
{fred_oss-0.17.0 → fred_oss-0.19.0}/src/main/fred/integrations/databricks/wrappers/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.17.0 → fred_oss-0.19.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
|