orca-python 0.7.1__py3-none-any.whl → 0.7.2__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.
- orca_python/exceptions.py +4 -0
- orca_python/main.py +33 -12
- {orca_python-0.7.1.dist-info → orca_python-0.7.2.dist-info}/METADATA +1 -1
- {orca_python-0.7.1.dist-info → orca_python-0.7.2.dist-info}/RECORD +6 -6
- {orca_python-0.7.1.dist-info → orca_python-0.7.2.dist-info}/LICENSE +0 -0
- {orca_python-0.7.1.dist-info → orca_python-0.7.2.dist-info}/WHEEL +0 -0
orca_python/exceptions.py
CHANGED
@@ -10,6 +10,10 @@ class InvalidAlgorithmReturnType(BaseOrcaException):
|
|
10
10
|
"""Raised when the return type of an algorithm is not valid"""
|
11
11
|
|
12
12
|
|
13
|
+
class InvalidWindowArgument(BaseOrcaException):
|
14
|
+
"""Raised when an argument to the Window class is not valid"""
|
15
|
+
|
16
|
+
|
13
17
|
class InvalidDependency(BaseOrcaException):
|
14
18
|
"""Raised when a dependency is invalid"""
|
15
19
|
|
orca_python/main.py
CHANGED
@@ -13,7 +13,7 @@ import logging
|
|
13
13
|
import datetime as dt
|
14
14
|
import traceback
|
15
15
|
|
16
|
-
from google.protobuf import timestamp_pb2
|
16
|
+
from google.protobuf import json_format, timestamp_pb2
|
17
17
|
|
18
18
|
logging.basicConfig(
|
19
19
|
level=logging.INFO,
|
@@ -51,6 +51,7 @@ from service_pb2_grpc import OrcaProcessorServicer
|
|
51
51
|
from orca_python import envs
|
52
52
|
from orca_python.exceptions import (
|
53
53
|
InvalidDependency,
|
54
|
+
InvalidWindowArgument,
|
54
55
|
InvalidAlgorithmArgument,
|
55
56
|
InvalidAlgorithmReturnType,
|
56
57
|
)
|
@@ -136,11 +137,41 @@ class NoneResult:
|
|
136
137
|
returnResult = StructResult | ArrayResult | ValueResult | NoneResult
|
137
138
|
|
138
139
|
|
140
|
+
@dataclass
|
141
|
+
class Window:
|
142
|
+
time_from: dt.datetime
|
143
|
+
time_to: dt.datetime
|
144
|
+
name: str
|
145
|
+
version: str
|
146
|
+
origin: str
|
147
|
+
metadata: Dict[str, Any] = field(default_factory=dict)
|
148
|
+
|
149
|
+
|
139
150
|
@dataclass
|
140
151
|
class ExecutionParams:
|
141
|
-
window:
|
152
|
+
window: Window
|
142
153
|
dependencies: Optional[Iterable[pb.AlgorithmResult]] = None
|
143
154
|
|
155
|
+
def __init__(
|
156
|
+
self,
|
157
|
+
window: Window | pb.Window,
|
158
|
+
dependencies: Optional[Iterable[pb.AlgorithmResult]] = None,
|
159
|
+
):
|
160
|
+
if isinstance(window, Window):
|
161
|
+
self.window = window
|
162
|
+
elif isinstance(window, pb.Window):
|
163
|
+
self.window = Window(
|
164
|
+
time_from=window.time_from.ToDatetime(),
|
165
|
+
time_to=window.time_to.ToDatetime(),
|
166
|
+
name=window.window_type_name,
|
167
|
+
version=window.window_type_version,
|
168
|
+
origin=window.origin,
|
169
|
+
metadata=json_format.MessageToDict(window.metadata),
|
170
|
+
)
|
171
|
+
else:
|
172
|
+
raise InvalidWindowArgument(f"window of type {type(window)} not handled")
|
173
|
+
self.dependencies = dependencies
|
174
|
+
|
144
175
|
|
145
176
|
class AlgorithmFn(Protocol):
|
146
177
|
def __call__(
|
@@ -151,16 +182,6 @@ class AlgorithmFn(Protocol):
|
|
151
182
|
T = TypeVar("T", bound=AlgorithmFn)
|
152
183
|
|
153
184
|
|
154
|
-
@dataclass
|
155
|
-
class Window:
|
156
|
-
time_from: dt.datetime
|
157
|
-
time_to: dt.datetime
|
158
|
-
name: str
|
159
|
-
version: str
|
160
|
-
origin: str
|
161
|
-
metadata: Dict[str, Any] = field(default_factory=dict)
|
162
|
-
|
163
|
-
|
164
185
|
def EmitWindow(window: Window) -> None:
|
165
186
|
"""
|
166
187
|
Emits a window to Orca-core.
|
@@ -8,10 +8,10 @@ vendor/validate_pb2.pyi,sha256=Qyebm_XUdrvo8As3XovHu7vVsHXYJtTdP3bYUmQEecs,30245
|
|
8
8
|
vendor/validate_pb2_grpc.py,sha256=qIlTS0MGHE7myQ7tCMbS-pPqA9FMZl_Hn9Mh_uq2o9o,896
|
9
9
|
orca_python/__init__.py,sha256=tHVOEF69iiLzbymMTuEKdbGSqeaAzpc-BiZY7VY1Gz4,362
|
10
10
|
orca_python/envs.py,sha256=zSuukNSpEw78VpSSIDAA9KRAurWedQMwx1qyQg9f8pk,560
|
11
|
-
orca_python/exceptions.py,sha256=
|
12
|
-
orca_python/main.py,sha256=
|
11
|
+
orca_python/exceptions.py,sha256=el7a5VUd21nNCTSTgVn5T9gyULncrQgKyFQghWmApnw,629
|
12
|
+
orca_python/main.py,sha256=0o4ZzVpwKUsNk5nGdp0aBI3N-Q7_JkK62UErjBhftlc,30453
|
13
13
|
orca_python/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
-
orca_python-0.7.
|
15
|
-
orca_python-0.7.
|
16
|
-
orca_python-0.7.
|
17
|
-
orca_python-0.7.
|
14
|
+
orca_python-0.7.2.dist-info/LICENSE,sha256=sxb8X8qhbZ_JaCBFmoIriJzA-jelKmh86sAKQsIRN_I,1062
|
15
|
+
orca_python-0.7.2.dist-info/METADATA,sha256=Eg_nxSuf7bc9F6p5pFFNr-44UldKOgPeZhe8ZWxJZ0M,3019
|
16
|
+
orca_python-0.7.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
17
|
+
orca_python-0.7.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|