fred-oss 0.9.0__tar.gz → 0.11.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.9.0/src/main/fred_oss.egg-info → fred_oss-0.11.0}/PKG-INFO +1 -1
- fred_oss-0.11.0/src/main/fred/version +1 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/worker/runner/client.py +11 -5
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/worker/runner/handler.py +17 -17
- fred_oss-0.11.0/src/main/fred/worker/runner/utils.py +49 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0/src/main/fred_oss.egg-info}/PKG-INFO +1 -1
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred_oss.egg-info/SOURCES.txt +1 -0
- fred_oss-0.9.0/src/main/fred/version +0 -1
- {fred_oss-0.9.0 → fred_oss-0.11.0}/MANIFEST.in +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/NOTICE.txt +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/README.md +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/requirements.txt +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/setup.cfg +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/setup.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/cli/__init__.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/cli/__main__.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/cli/interface.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/cli/main.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/databricks/__init__.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/databricks/cli_ext.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/databricks/runtime.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/databricks/runtimes/__init__.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/databricks/runtimes/scanner.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/databricks/runtimes/sync.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/databricks/wrappers/__init__.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/runpod/__init__.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/runpod/cli_ext.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/runpod/helper.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/maturity.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/settings.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/utils/__init__.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/utils/dateops.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/utils/runtime.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/version.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/worker/__init__.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/worker/interface.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/worker/runner/__init__.py +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred_oss.egg-info/dependency_links.txt +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred_oss.egg-info/entry_points.txt +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred_oss.egg-info/requires.txt +0 -0
- {fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred_oss.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.11.0
|
|
@@ -6,6 +6,10 @@ from fred.settings import (
|
|
|
6
6
|
get_environ_variable,
|
|
7
7
|
logger_manager,
|
|
8
8
|
)
|
|
9
|
+
from fred.worker.runner.utils import (
|
|
10
|
+
get_request_queue_name_from_payload,
|
|
11
|
+
get_response_queue_name_from_payload,
|
|
12
|
+
)
|
|
9
13
|
|
|
10
14
|
from redis import Redis
|
|
11
15
|
|
|
@@ -23,14 +27,16 @@ class RunnerClient:
|
|
|
23
27
|
redis_configs = {
|
|
24
28
|
"host": kwargs.get("host") or get_environ_variable(name="REDIS_HOST", default="localhost"),
|
|
25
29
|
"port": int(kwargs.get("port") or get_environ_variable(name="REDIS_PORT", default=6379)),
|
|
30
|
+
"password": get_environ_variable(name="REDIS_PASSWORD", default=None),
|
|
26
31
|
"db": int(kwargs.get("db") or get_environ_variable(name="REDIS_DB", default=0)),
|
|
32
|
+
"decode_responses": True,
|
|
33
|
+
**kwargs.pop("redis_configs", {}),
|
|
27
34
|
}
|
|
28
35
|
redis_instance = Redis(**redis_configs)
|
|
29
|
-
req_queue =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
logger.warning("Redis response queue not specified; defaulting to inferring pattern.") or f"res:{req_queue.split(':')[-1]}"
|
|
36
|
+
req_queue = get_request_queue_name_from_payload(payload=kwargs, keep=False)
|
|
37
|
+
res_queue = get_response_queue_name_from_payload(payload=kwargs, keep=False) or (
|
|
38
|
+
logger.warning("Redis response queue not specified; defaulting to inferring pattern.")
|
|
39
|
+
or f"res:{req_queue.split(':')[-1]}"
|
|
34
40
|
)
|
|
35
41
|
logger.info(f"Connecting to Redis, using request queue '{req_queue}' and response queue '{res_queue}'.")
|
|
36
42
|
return cls(
|
|
@@ -8,6 +8,10 @@ from fred.settings import (
|
|
|
8
8
|
get_environ_variable,
|
|
9
9
|
logger_manager,
|
|
10
10
|
)
|
|
11
|
+
from fred.worker.runner.utils import (
|
|
12
|
+
get_request_queue_name_from_payload,
|
|
13
|
+
get_response_queue_name_from_payload,
|
|
14
|
+
)
|
|
11
15
|
|
|
12
16
|
from redis import Redis
|
|
13
17
|
|
|
@@ -27,22 +31,18 @@ class RunnerHandler(HandlerInterface):
|
|
|
27
31
|
lifespan = payload.get("lifetime", 3600) # Default to 1 hour if not specified
|
|
28
32
|
timeout = payload.get("timeout", 30) # Default to 30 seconds if not specified
|
|
29
33
|
# Get Redis connection details from payload or environment variables
|
|
30
|
-
redis_configs =
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
34
|
+
redis_configs = {
|
|
35
|
+
"host": get_environ_variable(name="REDIS_HOST", default="localhost"),
|
|
36
|
+
"port": int(get_environ_variable(name="REDIS_PORT", default=6379)),
|
|
37
|
+
"password": get_environ_variable(name="REDIS_PASSWORD", default=None),
|
|
38
|
+
"db": int(get_environ_variable(name="REDIS_DB", default=0)),
|
|
39
|
+
"decode_responses": True,
|
|
40
|
+
**payload.pop("redis_configs", {}),
|
|
41
|
+
}
|
|
38
42
|
# Connect to Redis
|
|
39
43
|
redis = Redis(**redis_configs)
|
|
40
|
-
req_queue = payload
|
|
41
|
-
|
|
42
|
-
)
|
|
43
|
-
res_queue = payload.pop("redis_response_queue", None) or get_environ_variable(name="FRD_RUNNER_RESPONSE_QUEUE", default=None) or (
|
|
44
|
-
logger.warning("Redis response queue not specified; defaulting to: None (not using response queue)") or None
|
|
45
|
-
)
|
|
44
|
+
req_queue = get_request_queue_name_from_payload(payload=payload, keep=False)
|
|
45
|
+
res_queue = get_response_queue_name_from_payload(payload=payload, keep=False)
|
|
46
46
|
# Handoff to target handler (i.e., runner)
|
|
47
47
|
runner_configs = payload.pop("runner_configs")
|
|
48
48
|
runner_id = runner_configs.pop("id", str(uuid.uuid4()))
|
|
@@ -64,16 +64,16 @@ class RunnerHandler(HandlerInterface):
|
|
|
64
64
|
break
|
|
65
65
|
# Fetch item from Redis queue
|
|
66
66
|
try:
|
|
67
|
-
|
|
67
|
+
item_str = redis.rpop(req_queue)
|
|
68
68
|
except Exception as e:
|
|
69
69
|
logger.error(f"Error fetching item from Redis queue '{req_queue}': {e}")
|
|
70
70
|
continue
|
|
71
71
|
# If no item, iterate again
|
|
72
|
-
if not
|
|
72
|
+
if not item_str:
|
|
73
73
|
continue
|
|
74
74
|
try:
|
|
75
75
|
# Handle special signals
|
|
76
|
-
match
|
|
76
|
+
match item_str:
|
|
77
77
|
case "STOP" | "SHUTDOWN" | "TERMINATE":
|
|
78
78
|
logger.info("Received STOP signal; exiting runner loop.")
|
|
79
79
|
break
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from fred.settings import get_environ_variable, logger_manager
|
|
4
|
+
|
|
5
|
+
logger = logger_manager.get_logger(name=__name__)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def get_queue_name_from_payload(
|
|
9
|
+
payload: dict,
|
|
10
|
+
search_keys: list[str],
|
|
11
|
+
env_fallback: str,
|
|
12
|
+
default: Optional[str] = None,
|
|
13
|
+
keep: bool = False,
|
|
14
|
+
) -> str:
|
|
15
|
+
for key in search_keys:
|
|
16
|
+
if (queue_name := payload.get(key) if keep else payload.pop(key, None)):
|
|
17
|
+
return queue_name
|
|
18
|
+
return (
|
|
19
|
+
queue_name
|
|
20
|
+
or get_environ_variable(name=env_fallback, default=None)
|
|
21
|
+
or (
|
|
22
|
+
logger.warning(f"Redis queue not specified; defaulting to: '{default}'")
|
|
23
|
+
or default
|
|
24
|
+
)
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
def get_request_queue_name_from_payload(
|
|
28
|
+
payload: dict,
|
|
29
|
+
keep: bool = False,
|
|
30
|
+
) -> Optional[str]:
|
|
31
|
+
return get_queue_name_from_payload(
|
|
32
|
+
payload=payload,
|
|
33
|
+
search_keys=["redis_request_queue", "request_queue", "req_queue"],
|
|
34
|
+
env_fallback="FRD_RUNNER_REQUEST_QUEUE",
|
|
35
|
+
default="req:demo",
|
|
36
|
+
keep=keep,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
def get_response_queue_name_from_payload(
|
|
40
|
+
payload: dict,
|
|
41
|
+
keep: bool = False,
|
|
42
|
+
) -> Optional[str]:
|
|
43
|
+
return get_queue_name_from_payload(
|
|
44
|
+
payload=payload,
|
|
45
|
+
search_keys=["redis_response_queue", "response_queue", "res_queue"],
|
|
46
|
+
env_fallback="FRD_RUNNER_RESPONSE_QUEUE",
|
|
47
|
+
default=None,
|
|
48
|
+
keep=keep,
|
|
49
|
+
)
|
|
@@ -30,6 +30,7 @@ src/main/fred/worker/interface.py
|
|
|
30
30
|
src/main/fred/worker/runner/__init__.py
|
|
31
31
|
src/main/fred/worker/runner/client.py
|
|
32
32
|
src/main/fred/worker/runner/handler.py
|
|
33
|
+
src/main/fred/worker/runner/utils.py
|
|
33
34
|
src/main/fred_oss.egg-info/PKG-INFO
|
|
34
35
|
src/main/fred_oss.egg-info/SOURCES.txt
|
|
35
36
|
src/main/fred_oss.egg-info/dependency_links.txt
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.9.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
|
{fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/databricks/runtimes/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/databricks/runtimes/scanner.py
RENAMED
|
File without changes
|
|
File without changes
|
{fred_oss-0.9.0 → fred_oss-0.11.0}/src/main/fred/integrations/databricks/wrappers/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.9.0 → fred_oss-0.11.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
|