nebu 0.1.5__py3-none-any.whl → 0.1.7__py3-none-any.whl

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.
@@ -26,7 +26,7 @@ class Container:
26
26
  self,
27
27
  name: str,
28
28
  image: str,
29
- namespace: str = "default",
29
+ namespace: Optional[str] = None,
30
30
  platform: Optional[str] = None,
31
31
  env: Optional[List[V1EnvVar]] = None,
32
32
  command: Optional[str] = None,
@@ -208,8 +208,8 @@ class Container:
208
208
 
209
209
  # Save constructor params to `self` for reference, like you do in ReplayBuffer.
210
210
  self.kind = "Container"
211
- self.namespace = namespace
212
- self.name = name
211
+ self.namespace = self.container.metadata.namespace
212
+ self.name = self.container.metadata.name
213
213
  self.platform = platform
214
214
  self.metadata = meta_request
215
215
  self.image = image
@@ -290,7 +290,7 @@ class Container:
290
290
  def load(
291
291
  cls,
292
292
  name: str,
293
- namespace: str = "default",
293
+ namespace: Optional[str] = None,
294
294
  config: Optional[GlobalConfig] = None,
295
295
  ):
296
296
  """
@@ -7,13 +7,12 @@ from typing import Any, Callable, List, Optional
7
7
  import requests
8
8
 
9
9
  from nebu.containers.container import Container
10
- from nebu.containers.models import V1ContainerRequest, V1EnvVar, V1ResourceMetaRequest
11
10
 
12
11
 
13
12
  def container(
14
13
  image: str,
15
14
  name: Optional[str] = None,
16
- namespace: str = "default",
15
+ namespace: Optional[str] = None,
17
16
  accelerators: Optional[List[str]] = None,
18
17
  platform: str = "runpod",
19
18
  python_cmd: str = "python",
@@ -84,91 +83,3 @@ def container(
84
83
  return wrapper
85
84
 
86
85
  return decorator
87
-
88
-
89
- def on_feedback(
90
- human: Human,
91
- accelerators: Optional[List[str]] = None,
92
- platform: str = "runpod",
93
- python_cmd: str = "python",
94
- timeout: Optional[str] = None,
95
- env: Optional[List[V1EnvVar]] = None,
96
- ):
97
- def decorator(func: Callable):
98
- nonlocal name
99
- if name is None:
100
- name = func.__name__
101
-
102
- # Get function source code
103
- func_code = inspect.getsource(func)
104
-
105
- command = """
106
-
107
- """
108
-
109
- # Create the container request
110
- container_request = V1ContainerRequest(
111
- kind="Container",
112
- platform=platform,
113
- metadata=V1ResourceMetaRequest(
114
- name=name,
115
- namespace=namespace,
116
- ),
117
- image=image,
118
- env=env,
119
- command=f"{python_cmd} -m nebu.containers.server",
120
- accelerators=accelerators,
121
- timeout=timeout,
122
- proxy_port=8080,
123
- restart="Never", # Jobs should not restart
124
- )
125
-
126
- def run(*args: Any, **kwargs: Any):
127
- # Create a container from the request
128
- cont = Container.from_request(container_request)
129
-
130
- # Wait for container to be running
131
- while (
132
- cont.status
133
- and cont.status.status
134
- and cont.status.status.lower() != "running"
135
- ):
136
- print(f"Job '{cont.metadata.name}' not running yet; waiting...")
137
- time.sleep(1)
138
-
139
- # Serialize arguments using pickle for complex objects
140
- serialized_args = base64.b64encode(pickle.dumps(args)).decode("utf-8")
141
- serialized_kwargs = base64.b64encode(pickle.dumps(kwargs)).decode("utf-8")
142
-
143
- # Prepare payload
144
- payload = {
145
- "function_code": func_code,
146
- "args": serialized_args,
147
- "kwargs": serialized_kwargs,
148
- }
149
-
150
- # Get container URL
151
- container_url = (
152
- cont.status.tailnet_url
153
- if cont.status and hasattr(cont.status, "tailnet_url")
154
- else "http://localhost:8080"
155
- )
156
-
157
- # Send to container and get result
158
- response = requests.post(f"{container_url}/execute", json=payload)
159
-
160
- if response.status_code != 200:
161
- raise RuntimeError(f"Function execution failed: {response.text}")
162
-
163
- # Deserialize the result
164
- serialized_result = response.json()["result"]
165
- result = pickle.loads(base64.b64decode(serialized_result))
166
-
167
- return result
168
-
169
- # Attach the run method to the container request
170
- container_request.run = run # type: ignore
171
-
172
- return container_request
173
-
174
- return decorator
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nebu
3
- Version: 0.1.5
3
+ Version: 0.1.7
4
4
  Summary: A globally distributed container runtime
5
5
  Requires-Python: >=3.10.14
6
6
  Description-Content-Type: text/markdown
@@ -1,16 +1,16 @@
1
1
  nebu/__init__.py,sha256=EbdC8ZKnRTt6jkX0WN0p1pnaDEzb2InqZ1r8QZWzph0,195
2
2
  nebu/config.py,sha256=XBY7uKgcJX9d1HGxqqpx87o_9DuF3maUlUnKkcpUrKU,4565
3
3
  nebu/meta.py,sha256=CzFHMND9seuewzq9zNNx9WTr6JvrCBExe7BLqDSr7lM,745
4
- nebu/containers/container.py,sha256=JbqdzjsagdlPmB8J_IueVqWuLixPAQ6RW9PRVlnRiqE,13444
5
- nebu/containers/decorator.py,sha256=sZQ4ZwqQk_jLDJ-n9P6N0MlxvWL9Ac7eCPIHVxYq58c,5576
4
+ nebu/containers/container.py,sha256=yb7KaPTVXnEEAlrpdlUi4HNqF6P7z9bmwAILGlq6iqU,13502
5
+ nebu/containers/decorator.py,sha256=qiM7hbHne9MhSp1gDgX5z5bimsXr_YPjTIZoe09dwr4,2741
6
6
  nebu/containers/models.py,sha256=_d6BS6puoVWvyHhWX-74WFHJSOE8WJaFt2zGMTm9EEA,6782
7
7
  nebu/containers/server.py,sha256=yFa2Y9PzBn59E1HftKiv0iapPonli2rbGAiU6r-wwe0,2513
8
8
  nebu/processors/models.py,sha256=6XSw4iM77XYJf6utm8QReN9fyMS0dK40a5sVwsC7RRA,1970
9
9
  nebu/processors/processor.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  nebu/redis/models.py,sha256=coPovAcVXnOU1Xh_fpJL4PO3QctgK9nBe5QYoqEcnxg,1230
11
11
  nebu/services/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- nebu-0.1.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
13
- nebu-0.1.5.dist-info/METADATA,sha256=YI3zEPhY_Fit5ErIMM0I0mBpgAxx0L63Rm2yn_cx-gw,1587
14
- nebu-0.1.5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
15
- nebu-0.1.5.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
16
- nebu-0.1.5.dist-info/RECORD,,
12
+ nebu-0.1.7.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
13
+ nebu-0.1.7.dist-info/METADATA,sha256=1tmqknTkrPQ-Q5qiK2T420II-fBLSN0-1gPYbZLoL1o,1587
14
+ nebu-0.1.7.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
15
+ nebu-0.1.7.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
16
+ nebu-0.1.7.dist-info/RECORD,,
File without changes