nebu 0.1.14__tar.gz → 0.1.17__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.
- {nebu-0.1.14/src/nebu.egg-info → nebu-0.1.17}/PKG-INFO +4 -1
- {nebu-0.1.14 → nebu-0.1.17}/pyproject.toml +6 -1
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/containers/decorator.py +11 -3
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/processors/consumer.py +36 -19
- nebu-0.1.17/src/nebu/processors/decorate.py +823 -0
- {nebu-0.1.14 → nebu-0.1.17/src/nebu.egg-info}/PKG-INFO +4 -1
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu.egg-info/requires.txt +3 -0
- nebu-0.1.14/src/nebu/processors/decorate.py +0 -401
- {nebu-0.1.14 → nebu-0.1.17}/LICENSE +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/README.md +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/setup.cfg +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/__init__.py +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/auth.py +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/config.py +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/containers/container.py +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/containers/models.py +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/containers/server.py +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/meta.py +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/processors/default.py +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/processors/models.py +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/processors/processor.py +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/redis/models.py +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu/services/service.py +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu.egg-info/SOURCES.txt +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu.egg-info/dependency_links.txt +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/src/nebu.egg-info/top_level.txt +0 -0
- {nebu-0.1.14 → nebu-0.1.17}/tests/test_containers.py +0 -0
@@ -1,13 +1,16 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nebu
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.17
|
4
4
|
Summary: A globally distributed container runtime
|
5
5
|
Requires-Python: >=3.10.14
|
6
6
|
Description-Content-Type: text/markdown
|
7
7
|
License-File: LICENSE
|
8
|
+
Requires-Dist: dill>=0.3.8
|
8
9
|
Requires-Dist: openai>=1.68.2
|
9
10
|
Requires-Dist: pydantic>=2.10.6
|
11
|
+
Requires-Dist: pysocks>=1.7.1
|
10
12
|
Requires-Dist: pyyaml>=6.0.2
|
13
|
+
Requires-Dist: redis[socks]>=5.0
|
11
14
|
Requires-Dist: requests>=2.32.3
|
12
15
|
Dynamic: license-file
|
13
16
|
|
@@ -1,19 +1,24 @@
|
|
1
1
|
[project]
|
2
2
|
name = "nebu"
|
3
|
-
version = "0.1.
|
3
|
+
version = "0.1.17"
|
4
4
|
description = "A globally distributed container runtime"
|
5
5
|
readme = "README.md"
|
6
6
|
requires-python = ">=3.10.14"
|
7
7
|
dependencies = [
|
8
|
+
"dill>=0.3.8",
|
8
9
|
"openai>=1.68.2",
|
9
10
|
"pydantic>=2.10.6",
|
11
|
+
"pysocks>=1.7.1",
|
10
12
|
"pyyaml>=6.0.2",
|
13
|
+
"redis[socks]>=5.0",
|
11
14
|
"requests>=2.32.3",
|
12
15
|
]
|
13
16
|
|
14
17
|
[dependency-groups]
|
15
18
|
dev = [
|
16
19
|
"ipykernel>=6.29.5",
|
20
|
+
"nbformat>=5.10.4",
|
21
|
+
"notebook>=7.3.3",
|
17
22
|
"pytest>=8.3.5",
|
18
23
|
"trl>=0.16.1",
|
19
24
|
]
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import base64
|
2
|
-
import inspect
|
3
2
|
import pickle
|
4
3
|
import time
|
5
4
|
from typing import Any, Callable, List, Optional
|
6
5
|
|
6
|
+
import dill # Import dill
|
7
7
|
import requests
|
8
8
|
|
9
9
|
from nebu.containers.container import Container
|
@@ -47,8 +47,16 @@ def container(
|
|
47
47
|
)
|
48
48
|
time.sleep(1)
|
49
49
|
|
50
|
-
# Get function source code
|
51
|
-
|
50
|
+
# Get function source code using dill
|
51
|
+
try:
|
52
|
+
func_code = dill.source.getsource(func)
|
53
|
+
except (OSError, TypeError) as e:
|
54
|
+
raise RuntimeError(
|
55
|
+
f"Failed to retrieve source code for function '{func.__name__}'. "
|
56
|
+
"This can happen with functions defined dynamically or interactively "
|
57
|
+
"(e.g., in a Jupyter notebook or REPL). Ensure the function is defined "
|
58
|
+
f"in a standard Python module if possible. Original error: {e}"
|
59
|
+
)
|
52
60
|
|
53
61
|
# Serialize arguments using pickle for complex objects
|
54
62
|
serialized_args = base64.b64encode(pickle.dumps(args)).decode("utf-8")
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env python3
|
2
2
|
import json
|
3
3
|
import os
|
4
|
+
import socket
|
4
5
|
import sys
|
5
6
|
import time
|
6
7
|
import traceback
|
@@ -8,6 +9,7 @@ from datetime import datetime
|
|
8
9
|
from typing import Dict, TypeVar
|
9
10
|
|
10
11
|
import redis
|
12
|
+
import socks
|
11
13
|
|
12
14
|
# Define TypeVar for generic models
|
13
15
|
T = TypeVar("T")
|
@@ -97,6 +99,26 @@ try:
|
|
97
99
|
exec("from nebu.processors.models import *", local_namespace)
|
98
100
|
exec("from nebu.processors.processor import *", local_namespace)
|
99
101
|
|
102
|
+
# Execute included object sources FIRST, as they might define types needed by others
|
103
|
+
print("[Consumer] Executing included object sources...")
|
104
|
+
for i, (obj_source, args_sources) in enumerate(included_object_sources):
|
105
|
+
try:
|
106
|
+
exec(obj_source, local_namespace)
|
107
|
+
print(f"[Consumer] Successfully executed included object {i} base source")
|
108
|
+
for j, arg_source in enumerate(args_sources):
|
109
|
+
try:
|
110
|
+
exec(arg_source, local_namespace)
|
111
|
+
print(
|
112
|
+
f"[Consumer] Successfully executed included object {i} arg {j} source"
|
113
|
+
)
|
114
|
+
except Exception as e:
|
115
|
+
print(f"Error executing included object {i} arg {j} source: {e}")
|
116
|
+
traceback.print_exc()
|
117
|
+
except Exception as e:
|
118
|
+
print(f"Error executing included object {i} base source: {e}")
|
119
|
+
traceback.print_exc()
|
120
|
+
print("[Consumer] Finished executing included object sources.")
|
121
|
+
|
100
122
|
# First try to import the module to get any needed dependencies
|
101
123
|
# This is a fallback in case the module is available
|
102
124
|
module_name = os.environ.get("MODULE_NAME")
|
@@ -176,22 +198,6 @@ try:
|
|
176
198
|
print(f"Error defining output model: {e}")
|
177
199
|
traceback.print_exc()
|
178
200
|
|
179
|
-
# Execute included object sources
|
180
|
-
for i, (obj_source, args_sources) in enumerate(included_object_sources):
|
181
|
-
try:
|
182
|
-
exec(obj_source, local_namespace)
|
183
|
-
print(f"Successfully executed included object {i} base source")
|
184
|
-
for j, arg_source in enumerate(args_sources):
|
185
|
-
try:
|
186
|
-
exec(arg_source, local_namespace)
|
187
|
-
print(f"Successfully executed included object {i} arg {j} source")
|
188
|
-
except Exception as e:
|
189
|
-
print(f"Error executing included object {i} arg {j} source: {e}")
|
190
|
-
traceback.print_exc()
|
191
|
-
except Exception as e:
|
192
|
-
print(f"Error executing included object {i} base source: {e}")
|
193
|
-
traceback.print_exc()
|
194
|
-
|
195
201
|
# Finally, execute the function code
|
196
202
|
try:
|
197
203
|
exec(function_source, local_namespace)
|
@@ -216,13 +222,24 @@ if not all([REDIS_URL, REDIS_CONSUMER_GROUP, REDIS_STREAM]):
|
|
216
222
|
print("Missing required Redis environment variables")
|
217
223
|
sys.exit(1)
|
218
224
|
|
225
|
+
# Configure SOCKS proxy before connecting to Redis
|
226
|
+
# Use the proxy settings provided by tailscaled
|
227
|
+
socks.set_default_proxy(socks.SOCKS5, "localhost", 1055)
|
228
|
+
socket.socket = socks.socksocket
|
229
|
+
print("Configured SOCKS5 proxy for socket connections via localhost:1055")
|
230
|
+
|
219
231
|
# Connect to Redis
|
220
232
|
try:
|
221
|
-
|
233
|
+
# Parse the Redis URL to handle potential credentials or specific DBs if needed
|
234
|
+
# Although from_url should work now with the patched socket
|
235
|
+
r = redis.from_url(
|
236
|
+
REDIS_URL, decode_responses=True
|
237
|
+
) # Added decode_responses for convenience
|
238
|
+
r.ping() # Test connection
|
222
239
|
redis_info = REDIS_URL.split("@")[-1] if "@" in REDIS_URL else REDIS_URL
|
223
|
-
print(f"Connected to Redis at {redis_info}")
|
240
|
+
print(f"Connected to Redis via SOCKS proxy at {redis_info}")
|
224
241
|
except Exception as e:
|
225
|
-
print(f"Failed to connect to Redis: {e}")
|
242
|
+
print(f"Failed to connect to Redis via SOCKS proxy: {e}")
|
226
243
|
traceback.print_exc()
|
227
244
|
sys.exit(1)
|
228
245
|
|