nebu 0.1.57__py3-none-any.whl → 0.1.59__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.
- nebu/processors/processor.py +14 -6
- {nebu-0.1.57.dist-info → nebu-0.1.59.dist-info}/METADATA +1 -1
- {nebu-0.1.57.dist-info → nebu-0.1.59.dist-info}/RECORD +6 -6
- {nebu-0.1.57.dist-info → nebu-0.1.59.dist-info}/WHEEL +0 -0
- {nebu-0.1.57.dist-info → nebu-0.1.59.dist-info}/licenses/LICENSE +0 -0
- {nebu-0.1.57.dist-info → nebu-0.1.59.dist-info}/top_level.txt +0 -0
nebu/processors/processor.py
CHANGED
@@ -7,7 +7,7 @@ from pydantic import BaseModel
|
|
7
7
|
|
8
8
|
from nebu.auth import get_user_profile
|
9
9
|
from nebu.config import GlobalConfig
|
10
|
-
from nebu.meta import V1ResourceMetaRequest
|
10
|
+
from nebu.meta import V1ResourceMetaRequest, V1ResourceReference
|
11
11
|
from nebu.processors.models import (
|
12
12
|
V1ContainerRequest,
|
13
13
|
V1Processor,
|
@@ -20,6 +20,7 @@ from nebu.processors.models import (
|
|
20
20
|
)
|
21
21
|
|
22
22
|
InputType = TypeVar("InputType", bound=BaseModel)
|
23
|
+
OutputType = TypeVar("OutputType", bound=BaseModel)
|
23
24
|
|
24
25
|
|
25
26
|
def _fetch_and_print_logs(log_url: str, api_key: str, processor_name: str):
|
@@ -80,7 +81,7 @@ def _fetch_and_print_logs(log_url: str, api_key: str, processor_name: str):
|
|
80
81
|
)
|
81
82
|
|
82
83
|
|
83
|
-
class Processor(Generic[InputType]):
|
84
|
+
class Processor(Generic[InputType, OutputType]):
|
84
85
|
"""
|
85
86
|
A class for managing Processor instances.
|
86
87
|
"""
|
@@ -203,6 +204,7 @@ class Processor(Generic[InputType]):
|
|
203
204
|
headers={"Authorization": f"Bearer {self.api_key}"},
|
204
205
|
)
|
205
206
|
patch_response.raise_for_status()
|
207
|
+
self.processor = V1Processor.model_validate(patch_response.json())
|
206
208
|
print(f"Updated Processor {self.processor.metadata.name}")
|
207
209
|
|
208
210
|
def __call__(
|
@@ -211,7 +213,7 @@ class Processor(Generic[InputType]):
|
|
211
213
|
wait: bool = False,
|
212
214
|
logs: bool = False,
|
213
215
|
api_key: Optional[str] = None,
|
214
|
-
) -> Dict[str, Any]:
|
216
|
+
) -> OutputType | Dict[str, Any] | None:
|
215
217
|
"""
|
216
218
|
Allows the Processor instance to be called like a function, sending data.
|
217
219
|
"""
|
@@ -223,7 +225,7 @@ class Processor(Generic[InputType]):
|
|
223
225
|
wait: bool = False,
|
224
226
|
logs: bool = False,
|
225
227
|
api_key: Optional[str] = None,
|
226
|
-
) -> Dict[str, Any]:
|
228
|
+
) -> OutputType | Dict[str, Any] | None:
|
227
229
|
"""
|
228
230
|
Send data to the processor and optionally stream logs in the background.
|
229
231
|
"""
|
@@ -389,11 +391,17 @@ class Processor(Generic[InputType]):
|
|
389
391
|
response.raise_for_status()
|
390
392
|
return
|
391
393
|
|
392
|
-
def ref(self) ->
|
394
|
+
def ref(self) -> V1ResourceReference:
|
393
395
|
"""
|
394
396
|
Get the resource ref for the processor.
|
395
397
|
"""
|
396
|
-
|
398
|
+
if not self.processor:
|
399
|
+
raise ValueError("Processor not found")
|
400
|
+
return V1ResourceReference(
|
401
|
+
name=self.processor.metadata.name,
|
402
|
+
namespace=self.processor.metadata.namespace,
|
403
|
+
kind="Processor",
|
404
|
+
)
|
397
405
|
|
398
406
|
def stop_logs(self):
|
399
407
|
"""
|
@@ -14,12 +14,12 @@ nebu/processors/consumer.py,sha256=q4cFKPEfMf1xIs0Y3CjUDCR35QVjr0F_hSOZUKUYc_U,3
|
|
14
14
|
nebu/processors/decorate.py,sha256=f4y0BL2W07XMMVzm0GPwh7GfJ-QRioSjBofJSa7hQtg,53175
|
15
15
|
nebu/processors/default.py,sha256=W4slJenG59rvyTlJ7gRp58eFfXcNOTT2Hfi6zzJAobI,365
|
16
16
|
nebu/processors/models.py,sha256=y40HoW-MEzDWB2dm_tsYlUy3Nf3s6eiLC0iGO9BoNog,3956
|
17
|
-
nebu/processors/processor.py,sha256=
|
17
|
+
nebu/processors/processor.py,sha256=PsLs-Oo0bcvqoDKHErpOaic25y8uvTQ8KxtyFwLptW0,16165
|
18
18
|
nebu/processors/remote.py,sha256=TeAIPGEMqnDIb7H1iett26IEZrBlcbPB_-DSm6jcH1E,1285
|
19
19
|
nebu/redis/models.py,sha256=coPovAcVXnOU1Xh_fpJL4PO3QctgK9nBe5QYoqEcnxg,1230
|
20
20
|
nebu/services/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
|
-
nebu-0.1.
|
22
|
-
nebu-0.1.
|
23
|
-
nebu-0.1.
|
24
|
-
nebu-0.1.
|
25
|
-
nebu-0.1.
|
21
|
+
nebu-0.1.59.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
22
|
+
nebu-0.1.59.dist-info/METADATA,sha256=Lpu2VpwTK1086RmcT96z6kjezq8VZMym24_1C1GzlGA,1731
|
23
|
+
nebu-0.1.59.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
24
|
+
nebu-0.1.59.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
|
25
|
+
nebu-0.1.59.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|