orca-python 0.4.0__tar.gz → 0.6.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.
- {orca_python-0.4.0 → orca_python-0.6.0}/PKG-INFO +1 -1
- {orca_python-0.4.0 → orca_python-0.6.0}/orca/core/protobufs/python/service_pb2.py +64 -50
- {orca_python-0.4.0 → orca_python-0.6.0}/orca/core/protobufs/python/service_pb2.pyi +31 -2
- {orca_python-0.4.0 → orca_python-0.6.0}/orca/core/protobufs/python/service_pb2_grpc.py +44 -0
- orca_python-0.6.0/orca_python/__init__.py +23 -0
- {orca_python-0.4.0 → orca_python-0.6.0}/orca_python/exceptions.py +4 -0
- {orca_python-0.4.0 → orca_python-0.6.0}/orca_python/main.py +163 -41
- {orca_python-0.4.0 → orca_python-0.6.0}/pyproject.toml +1 -1
- orca_python-0.4.0/orca_python/__init__.py +0 -3
- {orca_python-0.4.0 → orca_python-0.6.0}/LICENSE +0 -0
- {orca_python-0.4.0 → orca_python-0.6.0}/README.md +0 -0
- {orca_python-0.4.0 → orca_python-0.6.0}/orca/core/protobufs/python/__init__.py +0 -0
- {orca_python-0.4.0 → orca_python-0.6.0}/orca/core/protobufs/python/vendor/__init__.py +0 -0
- {orca_python-0.4.0 → orca_python-0.6.0}/orca/core/protobufs/python/vendor/validate_pb2.py +0 -0
- {orca_python-0.4.0 → orca_python-0.6.0}/orca/core/protobufs/python/vendor/validate_pb2.pyi +0 -0
- {orca_python-0.4.0 → orca_python-0.6.0}/orca/core/protobufs/python/vendor/validate_pb2_grpc.py +0 -0
- {orca_python-0.4.0 → orca_python-0.6.0}/orca_python/envs.py +0 -0
- {orca_python-0.4.0 → orca_python-0.6.0}/orca_python/py.typed +0 -0
@@ -26,7 +26,7 @@ from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
|
|
26
26
|
from vendor import validate_pb2 as vendor_dot_validate__pb2
|
27
27
|
|
28
28
|
|
29
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rservice.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x15vendor/validate.proto\"\xb9\x02\n\x06Window\x12\x1d\n\ttime_from\x18\x01 \x01(\x04\x42\n\xbaH\x07\x32\x02 \x00\xc8\x01\x01\x12\x17\n\x07time_to\x18\x02 \x01(\x04\x42\x06\xbaH\x03\xc8\x01\x01\x12 \n\x10window_type_name\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12#\n\x13window_type_version\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x16\n\x06origin\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12)\n\x08metadata\x18\x06 \x01(\x0b\x32\x17.google.protobuf.Struct:m\xbaHj\x1ah\n\x0ewindow.time_to\x12\x36`time_to` must be greater than or equal to `time_from`\x1a\x1ethis.time_to >= this.time_from\"X\n\nWindowType\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x17\n\x07version\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x1b\n\x0b\x64\x65scription\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\"\xa4\x01\n\x10WindowEmitStatus\x12\x34\n\x06status\x18\x01 \x01(\x0e\x32\x1c.WindowEmitStatus.StatusEnumB\x06\xbaH\x03\xc8\x01\x01\"Z\n\nStatusEnum\x12\x1b\n\x17NO_TRIGGERED_ALGORITHMS\x10\x00\x12\x18\n\x14PROCESSING_TRIGGERED\x10\x01\x12\x15\n\x11TRIGGERING_FAILED\x10\x02\"\x87\x01\n\x13\x41lgorithmDependency\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x17\n\x07version\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x1e\n\x0eprocessor_name\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12!\n\x11processor_runtime\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\"\
|
29
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rservice.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x15vendor/validate.proto\"\xb9\x02\n\x06Window\x12\x1d\n\ttime_from\x18\x01 \x01(\x04\x42\n\xbaH\x07\x32\x02 \x00\xc8\x01\x01\x12\x17\n\x07time_to\x18\x02 \x01(\x04\x42\x06\xbaH\x03\xc8\x01\x01\x12 \n\x10window_type_name\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12#\n\x13window_type_version\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x16\n\x06origin\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12)\n\x08metadata\x18\x06 \x01(\x0b\x32\x17.google.protobuf.Struct:m\xbaHj\x1ah\n\x0ewindow.time_to\x12\x36`time_to` must be greater than or equal to `time_from`\x1a\x1ethis.time_to >= this.time_from\"X\n\nWindowType\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x17\n\x07version\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x1b\n\x0b\x64\x65scription\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\"\xa4\x01\n\x10WindowEmitStatus\x12\x34\n\x06status\x18\x01 \x01(\x0e\x32\x1c.WindowEmitStatus.StatusEnumB\x06\xbaH\x03\xc8\x01\x01\"Z\n\nStatusEnum\x12\x1b\n\x17NO_TRIGGERED_ALGORITHMS\x10\x00\x12\x18\n\x14PROCESSING_TRIGGERED\x10\x01\x12\x15\n\x11TRIGGERING_FAILED\x10\x02\"\x87\x01\n\x13\x41lgorithmDependency\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x17\n\x07version\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x1e\n\x0eprocessor_name\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12!\n\x11processor_runtime\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\"\xba\x01\n\tAlgorithm\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x17\n\x07version\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12(\n\x0bwindow_type\x18\x03 \x01(\x0b\x32\x0b.WindowTypeB\x06\xbaH\x03\xc8\x01\x01\x12*\n\x0c\x64\x65pendencies\x18\x04 \x03(\x0b\x32\x14.AlgorithmDependency\x12(\n\x0bresult_type\x18\x05 \x01(\x0e\x32\x0b.ResultTypeB\x06\xbaH\x03\xc8\x01\x01\"\x1c\n\nFloatArray\x12\x0e\n\x06values\x18\x01 \x03(\x02\"\xc7\x01\n\x06Result\x12%\n\x06status\x18\x01 \x01(\x0e\x32\r.ResultStatusB\x06\xbaH\x03\xc8\x01\x01\x12\x16\n\x0csingle_value\x18\x02 \x01(\x02H\x00\x12#\n\x0c\x66loat_values\x18\x03 \x01(\x0b\x32\x0b.FloatArrayH\x00\x12/\n\x0cstruct_value\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x12\x19\n\ttimestamp\x18\x05 \x01(\x03\x42\x06\xbaH\x03\xc8\x01\x01\x42\r\n\x0bresult_data\"\x98\x01\n\x15ProcessorRegistration\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x17\n\x07runtime\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x1e\n\x0e\x63onnection_str\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x30\n\x14supported_algorithms\x18\x04 \x03(\x0b\x32\n.AlgorithmB\x06\xbaH\x03\xc8\x01\x01\"\x96\x01\n\x0eProcessingTask\x12\x17\n\x07task_id\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12%\n\talgorithm\x18\x02 \x01(\x0b\x32\n.AlgorithmB\x06\xbaH\x03\xc8\x01\x01\x12\x1f\n\x06window\x18\x03 \x01(\x0b\x32\x07.WindowB\x06\xbaH\x03\xc8\x01\x01\x12#\n\x12\x64\x65pendency_results\x18\x04 \x03(\x0b\x32\x07.Result\"\x99\x01\n\x10\x45xecutionRequest\x12\x17\n\x07\x65xec_id\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x1f\n\x06window\x18\x02 \x01(\x0b\x32\x07.WindowB\x06\xbaH\x03\xc8\x01\x01\x12+\n\x11\x61lgorithm_results\x18\x03 \x03(\x0b\x32\x10.AlgorithmResult\x12\x1e\n\nalgorithms\x18\x04 \x03(\x0b\x32\n.Algorithm\"^\n\x0f\x45xecutionResult\x12\x17\n\x07\x65xec_id\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01\x12\x32\n\x10\x61lgorithm_result\x18\x03 \x01(\x0b\x32\x10.AlgorithmResultB\x06\xbaH\x03\xc8\x01\x01\"Y\n\x0f\x41lgorithmResult\x12%\n\talgorithm\x18\x01 \x01(\x0b\x32\n.AlgorithmB\x06\xbaH\x03\xc8\x01\x01\x12\x1f\n\x06result\x18\x02 \x01(\x0b\x32\x07.ResultB\x06\xbaH\x03\xc8\x01\x01\"+\n\x06Status\x12\x10\n\x08received\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t\"/\n\x12HealthCheckRequest\x12\x19\n\ttimestamp\x18\x01 \x01(\x03\x42\x06\xbaH\x03\xc8\x01\x01\"\xe3\x01\n\x13HealthCheckResponse\x12\x33\n\x06status\x18\x01 \x01(\x0e\x32\x1b.HealthCheckResponse.StatusB\x06\xbaH\x03\xc8\x01\x01\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\"\n\x07metrics\x18\x03 \x01(\x0b\x32\x11.ProcessorMetrics\"b\n\x06Status\x12\x12\n\x0eSTATUS_UNKNOWN\x10\x00\x12\x12\n\x0eSTATUS_SERVING\x10\x01\x12\x18\n\x14STATUS_TRANSITIONING\x10\x02\x12\x16\n\x12STATUS_NOT_SERVING\x10\x03\"k\n\x10ProcessorMetrics\x12\x14\n\x0c\x61\x63tive_tasks\x18\x01 \x01(\x05\x12\x14\n\x0cmemory_bytes\x18\x02 \x01(\x03\x12\x13\n\x0b\x63pu_percent\x18\x03 \x01(\x02\x12\x16\n\x0euptime_seconds\x18\x04 \x01(\x03\"\x10\n\x0eWindowTypeRead\"+\n\x0bWindowTypes\x12\x1c\n\x07windows\x18\x01 \x03(\x0b\x32\x0b.WindowType\"\x10\n\x0e\x41lgorithmsRead\"+\n\nAlgorithms\x12\x1d\n\talgorithm\x18\x01 \x03(\x0b\x32\n.Algorithm\"\x10\n\x0eProcessorsRead\"b\n\nProcessors\x12(\n\tprocessor\x18\x01 \x03(\x0b\x32\x15.Processors.Processor\x1a*\n\tProcessor\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07runtime\x18\x02 \x01(\t\"\x12\n\x10ResultsStatsRead\"\x1d\n\x0cResultsStats\x12\r\n\x05\x43ount\x18\x01 \x01(\x03\"p\n\x13\x41lgorithmFieldsRead\x12\x19\n\ttime_from\x18\x01 \x01(\x03\x42\x06\xbaH\x03\xc8\x01\x01\x12\x17\n\x07time_to\x18\x02 \x01(\x03\x42\x06\xbaH\x03\xc8\x01\x01\x12%\n\talgorithm\x18\x03 \x01(\x0b\x32\n.AlgorithmB\x06\xbaH\x03\xc8\x01\x01\" \n\x0f\x41lgorithmFields\x12\r\n\x05\x66ield\x18\x01 \x03(\t*A\n\nResultType\x12\x11\n\rNOT_SPECIFIED\x10\x00\x12\n\n\x06STRUCT\x10\x01\x12\t\n\x05VALUE\x10\x02\x12\t\n\x05\x41RRAY\x10\x03*p\n\x0cResultStatus\x12 \n\x1cRESULT_STATUS_HANDLED_FAILED\x10\x00\x12\"\n\x1eRESULT_STATUS_UNHANDLED_FAILED\x10\x01\x12\x1a\n\x16RESULT_STATUS_SUCEEDED\x10\x02\x32\xfa\x02\n\x08OrcaCore\x12\x34\n\x11RegisterProcessor\x12\x16.ProcessorRegistration\x1a\x07.Status\x12(\n\nEmitWindow\x12\x07.Window\x1a\x11.WindowEmitStatus\x12\x30\n\x0fReadWindowTypes\x12\x0f.WindowTypeRead\x1a\x0c.WindowTypes\x12.\n\x0eReadAlgorithms\x12\x0f.AlgorithmsRead\x1a\x0b.Algorithms\x12.\n\x0eReadProcessors\x12\x0f.ProcessorsRead\x1a\x0b.Processors\x12\x34\n\x10ReadResultsStats\x12\x11.ResultsStatsRead\x1a\r.ResultsStats\x12\x46\n\x1cReadResultFieldsForAlgorithm\x12\x14.AlgorithmFieldsRead\x1a\x10.AlgorithmFields2\x82\x01\n\rOrcaProcessor\x12\x37\n\x0e\x45xecuteDagPart\x12\x11.ExecutionRequest\x1a\x10.ExecutionResult0\x01\x12\x38\n\x0bHealthCheck\x12\x13.HealthCheckRequest\x1a\x14.HealthCheckResponseB\'Z%github.com/predixus/orca/protobufs/gob\x06proto3')
|
30
30
|
|
31
31
|
_globals = globals()
|
32
32
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
@@ -68,6 +68,8 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
68
68
|
_globals['_ALGORITHM'].fields_by_name['version']._serialized_options = b'\272H\003\310\001\001'
|
69
69
|
_globals['_ALGORITHM'].fields_by_name['window_type']._loaded_options = None
|
70
70
|
_globals['_ALGORITHM'].fields_by_name['window_type']._serialized_options = b'\272H\003\310\001\001'
|
71
|
+
_globals['_ALGORITHM'].fields_by_name['result_type']._loaded_options = None
|
72
|
+
_globals['_ALGORITHM'].fields_by_name['result_type']._serialized_options = b'\272H\003\310\001\001'
|
71
73
|
_globals['_RESULT'].fields_by_name['status']._loaded_options = None
|
72
74
|
_globals['_RESULT'].fields_by_name['status']._serialized_options = b'\272H\003\310\001\001'
|
73
75
|
_globals['_RESULT'].fields_by_name['timestamp']._loaded_options = None
|
@@ -102,8 +104,16 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
102
104
|
_globals['_HEALTHCHECKREQUEST'].fields_by_name['timestamp']._serialized_options = b'\272H\003\310\001\001'
|
103
105
|
_globals['_HEALTHCHECKRESPONSE'].fields_by_name['status']._loaded_options = None
|
104
106
|
_globals['_HEALTHCHECKRESPONSE'].fields_by_name['status']._serialized_options = b'\272H\003\310\001\001'
|
105
|
-
_globals['
|
106
|
-
_globals['
|
107
|
+
_globals['_ALGORITHMFIELDSREAD'].fields_by_name['time_from']._loaded_options = None
|
108
|
+
_globals['_ALGORITHMFIELDSREAD'].fields_by_name['time_from']._serialized_options = b'\272H\003\310\001\001'
|
109
|
+
_globals['_ALGORITHMFIELDSREAD'].fields_by_name['time_to']._loaded_options = None
|
110
|
+
_globals['_ALGORITHMFIELDSREAD'].fields_by_name['time_to']._serialized_options = b'\272H\003\310\001\001'
|
111
|
+
_globals['_ALGORITHMFIELDSREAD'].fields_by_name['algorithm']._loaded_options = None
|
112
|
+
_globals['_ALGORITHMFIELDSREAD'].fields_by_name['algorithm']._serialized_options = b'\272H\003\310\001\001'
|
113
|
+
_globals['_RESULTTYPE']._serialized_start=2729
|
114
|
+
_globals['_RESULTTYPE']._serialized_end=2794
|
115
|
+
_globals['_RESULTSTATUS']._serialized_start=2796
|
116
|
+
_globals['_RESULTSTATUS']._serialized_end=2908
|
107
117
|
_globals['_WINDOW']._serialized_start=71
|
108
118
|
_globals['_WINDOW']._serialized_end=384
|
109
119
|
_globals['_WINDOWTYPE']._serialized_start=386
|
@@ -115,51 +125,55 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
115
125
|
_globals['_ALGORITHMDEPENDENCY']._serialized_start=644
|
116
126
|
_globals['_ALGORITHMDEPENDENCY']._serialized_end=779
|
117
127
|
_globals['_ALGORITHM']._serialized_start=782
|
118
|
-
_globals['_ALGORITHM']._serialized_end=
|
119
|
-
_globals['_FLOATARRAY']._serialized_start=
|
120
|
-
_globals['_FLOATARRAY']._serialized_end=
|
121
|
-
_globals['_RESULT']._serialized_start=
|
122
|
-
_globals['_RESULT']._serialized_end=
|
123
|
-
_globals['_PROCESSORREGISTRATION']._serialized_start=
|
124
|
-
_globals['_PROCESSORREGISTRATION']._serialized_end=
|
125
|
-
_globals['_PROCESSINGTASK']._serialized_start=
|
126
|
-
_globals['_PROCESSINGTASK']._serialized_end=
|
127
|
-
_globals['_EXECUTIONREQUEST']._serialized_start=
|
128
|
-
_globals['_EXECUTIONREQUEST']._serialized_end=
|
129
|
-
_globals['_EXECUTIONRESULT']._serialized_start=
|
130
|
-
_globals['_EXECUTIONRESULT']._serialized_end=
|
131
|
-
_globals['_ALGORITHMRESULT']._serialized_start=
|
132
|
-
_globals['_ALGORITHMRESULT']._serialized_end=
|
133
|
-
_globals['_STATUS']._serialized_start=
|
134
|
-
_globals['_STATUS']._serialized_end=
|
135
|
-
_globals['_HEALTHCHECKREQUEST']._serialized_start=
|
136
|
-
_globals['_HEALTHCHECKREQUEST']._serialized_end=
|
137
|
-
_globals['_HEALTHCHECKRESPONSE']._serialized_start=
|
138
|
-
_globals['_HEALTHCHECKRESPONSE']._serialized_end=
|
139
|
-
_globals['_HEALTHCHECKRESPONSE_STATUS']._serialized_start=
|
140
|
-
_globals['_HEALTHCHECKRESPONSE_STATUS']._serialized_end=
|
141
|
-
_globals['_PROCESSORMETRICS']._serialized_start=
|
142
|
-
_globals['_PROCESSORMETRICS']._serialized_end=
|
143
|
-
_globals['_WINDOWTYPEREAD']._serialized_start=
|
144
|
-
_globals['_WINDOWTYPEREAD']._serialized_end=
|
145
|
-
_globals['_WINDOWTYPES']._serialized_start=
|
146
|
-
_globals['_WINDOWTYPES']._serialized_end=
|
147
|
-
_globals['_ALGORITHMSREAD']._serialized_start=
|
148
|
-
_globals['_ALGORITHMSREAD']._serialized_end=
|
149
|
-
_globals['_ALGORITHMS']._serialized_start=
|
150
|
-
_globals['_ALGORITHMS']._serialized_end=
|
151
|
-
_globals['_PROCESSORSREAD']._serialized_start=
|
152
|
-
_globals['_PROCESSORSREAD']._serialized_end=
|
153
|
-
_globals['_PROCESSORS']._serialized_start=
|
154
|
-
_globals['_PROCESSORS']._serialized_end=
|
155
|
-
_globals['_PROCESSORS_PROCESSOR']._serialized_start=
|
156
|
-
_globals['_PROCESSORS_PROCESSOR']._serialized_end=
|
157
|
-
_globals['_RESULTSSTATSREAD']._serialized_start=
|
158
|
-
_globals['_RESULTSSTATSREAD']._serialized_end=
|
159
|
-
_globals['_RESULTSSTATS']._serialized_start=
|
160
|
-
_globals['_RESULTSSTATS']._serialized_end=
|
161
|
-
_globals['
|
162
|
-
_globals['
|
163
|
-
_globals['
|
164
|
-
_globals['
|
128
|
+
_globals['_ALGORITHM']._serialized_end=968
|
129
|
+
_globals['_FLOATARRAY']._serialized_start=970
|
130
|
+
_globals['_FLOATARRAY']._serialized_end=998
|
131
|
+
_globals['_RESULT']._serialized_start=1001
|
132
|
+
_globals['_RESULT']._serialized_end=1200
|
133
|
+
_globals['_PROCESSORREGISTRATION']._serialized_start=1203
|
134
|
+
_globals['_PROCESSORREGISTRATION']._serialized_end=1355
|
135
|
+
_globals['_PROCESSINGTASK']._serialized_start=1358
|
136
|
+
_globals['_PROCESSINGTASK']._serialized_end=1508
|
137
|
+
_globals['_EXECUTIONREQUEST']._serialized_start=1511
|
138
|
+
_globals['_EXECUTIONREQUEST']._serialized_end=1664
|
139
|
+
_globals['_EXECUTIONRESULT']._serialized_start=1666
|
140
|
+
_globals['_EXECUTIONRESULT']._serialized_end=1760
|
141
|
+
_globals['_ALGORITHMRESULT']._serialized_start=1762
|
142
|
+
_globals['_ALGORITHMRESULT']._serialized_end=1851
|
143
|
+
_globals['_STATUS']._serialized_start=1853
|
144
|
+
_globals['_STATUS']._serialized_end=1896
|
145
|
+
_globals['_HEALTHCHECKREQUEST']._serialized_start=1898
|
146
|
+
_globals['_HEALTHCHECKREQUEST']._serialized_end=1945
|
147
|
+
_globals['_HEALTHCHECKRESPONSE']._serialized_start=1948
|
148
|
+
_globals['_HEALTHCHECKRESPONSE']._serialized_end=2175
|
149
|
+
_globals['_HEALTHCHECKRESPONSE_STATUS']._serialized_start=2077
|
150
|
+
_globals['_HEALTHCHECKRESPONSE_STATUS']._serialized_end=2175
|
151
|
+
_globals['_PROCESSORMETRICS']._serialized_start=2177
|
152
|
+
_globals['_PROCESSORMETRICS']._serialized_end=2284
|
153
|
+
_globals['_WINDOWTYPEREAD']._serialized_start=2286
|
154
|
+
_globals['_WINDOWTYPEREAD']._serialized_end=2302
|
155
|
+
_globals['_WINDOWTYPES']._serialized_start=2304
|
156
|
+
_globals['_WINDOWTYPES']._serialized_end=2347
|
157
|
+
_globals['_ALGORITHMSREAD']._serialized_start=2349
|
158
|
+
_globals['_ALGORITHMSREAD']._serialized_end=2365
|
159
|
+
_globals['_ALGORITHMS']._serialized_start=2367
|
160
|
+
_globals['_ALGORITHMS']._serialized_end=2410
|
161
|
+
_globals['_PROCESSORSREAD']._serialized_start=2412
|
162
|
+
_globals['_PROCESSORSREAD']._serialized_end=2428
|
163
|
+
_globals['_PROCESSORS']._serialized_start=2430
|
164
|
+
_globals['_PROCESSORS']._serialized_end=2528
|
165
|
+
_globals['_PROCESSORS_PROCESSOR']._serialized_start=2486
|
166
|
+
_globals['_PROCESSORS_PROCESSOR']._serialized_end=2528
|
167
|
+
_globals['_RESULTSSTATSREAD']._serialized_start=2530
|
168
|
+
_globals['_RESULTSSTATSREAD']._serialized_end=2548
|
169
|
+
_globals['_RESULTSSTATS']._serialized_start=2550
|
170
|
+
_globals['_RESULTSSTATS']._serialized_end=2579
|
171
|
+
_globals['_ALGORITHMFIELDSREAD']._serialized_start=2581
|
172
|
+
_globals['_ALGORITHMFIELDSREAD']._serialized_end=2693
|
173
|
+
_globals['_ALGORITHMFIELDS']._serialized_start=2695
|
174
|
+
_globals['_ALGORITHMFIELDS']._serialized_end=2727
|
175
|
+
_globals['_ORCACORE']._serialized_start=2911
|
176
|
+
_globals['_ORCACORE']._serialized_end=3289
|
177
|
+
_globals['_ORCAPROCESSOR']._serialized_start=3292
|
178
|
+
_globals['_ORCAPROCESSOR']._serialized_end=3422
|
165
179
|
# @@protoc_insertion_point(module_scope)
|
@@ -8,11 +8,22 @@ from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Map
|
|
8
8
|
|
9
9
|
DESCRIPTOR: _descriptor.FileDescriptor
|
10
10
|
|
11
|
+
class ResultType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
12
|
+
__slots__ = ()
|
13
|
+
NOT_SPECIFIED: _ClassVar[ResultType]
|
14
|
+
STRUCT: _ClassVar[ResultType]
|
15
|
+
VALUE: _ClassVar[ResultType]
|
16
|
+
ARRAY: _ClassVar[ResultType]
|
17
|
+
|
11
18
|
class ResultStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
12
19
|
__slots__ = ()
|
13
20
|
RESULT_STATUS_HANDLED_FAILED: _ClassVar[ResultStatus]
|
14
21
|
RESULT_STATUS_UNHANDLED_FAILED: _ClassVar[ResultStatus]
|
15
22
|
RESULT_STATUS_SUCEEDED: _ClassVar[ResultStatus]
|
23
|
+
NOT_SPECIFIED: ResultType
|
24
|
+
STRUCT: ResultType
|
25
|
+
VALUE: ResultType
|
26
|
+
ARRAY: ResultType
|
16
27
|
RESULT_STATUS_HANDLED_FAILED: ResultStatus
|
17
28
|
RESULT_STATUS_UNHANDLED_FAILED: ResultStatus
|
18
29
|
RESULT_STATUS_SUCEEDED: ResultStatus
|
@@ -70,16 +81,18 @@ class AlgorithmDependency(_message.Message):
|
|
70
81
|
def __init__(self, name: _Optional[str] = ..., version: _Optional[str] = ..., processor_name: _Optional[str] = ..., processor_runtime: _Optional[str] = ...) -> None: ...
|
71
82
|
|
72
83
|
class Algorithm(_message.Message):
|
73
|
-
__slots__ = ("name", "version", "window_type", "dependencies")
|
84
|
+
__slots__ = ("name", "version", "window_type", "dependencies", "result_type")
|
74
85
|
NAME_FIELD_NUMBER: _ClassVar[int]
|
75
86
|
VERSION_FIELD_NUMBER: _ClassVar[int]
|
76
87
|
WINDOW_TYPE_FIELD_NUMBER: _ClassVar[int]
|
77
88
|
DEPENDENCIES_FIELD_NUMBER: _ClassVar[int]
|
89
|
+
RESULT_TYPE_FIELD_NUMBER: _ClassVar[int]
|
78
90
|
name: str
|
79
91
|
version: str
|
80
92
|
window_type: WindowType
|
81
93
|
dependencies: _containers.RepeatedCompositeFieldContainer[AlgorithmDependency]
|
82
|
-
|
94
|
+
result_type: ResultType
|
95
|
+
def __init__(self, name: _Optional[str] = ..., version: _Optional[str] = ..., window_type: _Optional[_Union[WindowType, _Mapping]] = ..., dependencies: _Optional[_Iterable[_Union[AlgorithmDependency, _Mapping]]] = ..., result_type: _Optional[_Union[ResultType, str]] = ...) -> None: ...
|
83
96
|
|
84
97
|
class FloatArray(_message.Message):
|
85
98
|
__slots__ = ("values",)
|
@@ -245,3 +258,19 @@ class ResultsStats(_message.Message):
|
|
245
258
|
COUNT_FIELD_NUMBER: _ClassVar[int]
|
246
259
|
Count: int
|
247
260
|
def __init__(self, Count: _Optional[int] = ...) -> None: ...
|
261
|
+
|
262
|
+
class AlgorithmFieldsRead(_message.Message):
|
263
|
+
__slots__ = ("time_from", "time_to", "algorithm")
|
264
|
+
TIME_FROM_FIELD_NUMBER: _ClassVar[int]
|
265
|
+
TIME_TO_FIELD_NUMBER: _ClassVar[int]
|
266
|
+
ALGORITHM_FIELD_NUMBER: _ClassVar[int]
|
267
|
+
time_from: int
|
268
|
+
time_to: int
|
269
|
+
algorithm: Algorithm
|
270
|
+
def __init__(self, time_from: _Optional[int] = ..., time_to: _Optional[int] = ..., algorithm: _Optional[_Union[Algorithm, _Mapping]] = ...) -> None: ...
|
271
|
+
|
272
|
+
class AlgorithmFields(_message.Message):
|
273
|
+
__slots__ = ("field",)
|
274
|
+
FIELD_FIELD_NUMBER: _ClassVar[int]
|
275
|
+
field: _containers.RepeatedScalarFieldContainer[str]
|
276
|
+
def __init__(self, field: _Optional[_Iterable[str]] = ...) -> None: ...
|
@@ -70,6 +70,11 @@ class OrcaCoreStub(object):
|
|
70
70
|
request_serializer=service__pb2.ResultsStatsRead.SerializeToString,
|
71
71
|
response_deserializer=service__pb2.ResultsStats.FromString,
|
72
72
|
_registered_method=True)
|
73
|
+
self.ReadResultFieldsForAlgorithm = channel.unary_unary(
|
74
|
+
'/OrcaCore/ReadResultFieldsForAlgorithm',
|
75
|
+
request_serializer=service__pb2.AlgorithmFieldsRead.SerializeToString,
|
76
|
+
response_deserializer=service__pb2.AlgorithmFields.FromString,
|
77
|
+
_registered_method=True)
|
73
78
|
|
74
79
|
|
75
80
|
class OrcaCoreServicer(object):
|
@@ -120,6 +125,13 @@ class OrcaCoreServicer(object):
|
|
120
125
|
context.set_details('Method not implemented!')
|
121
126
|
raise NotImplementedError('Method not implemented!')
|
122
127
|
|
128
|
+
def ReadResultFieldsForAlgorithm(self, request, context):
|
129
|
+
"""rpc ReadResultsForAlgorithm(AlgorithmResultsRead) returns (AlgorithmResults);
|
130
|
+
"""
|
131
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
132
|
+
context.set_details('Method not implemented!')
|
133
|
+
raise NotImplementedError('Method not implemented!')
|
134
|
+
|
123
135
|
|
124
136
|
def add_OrcaCoreServicer_to_server(servicer, server):
|
125
137
|
rpc_method_handlers = {
|
@@ -153,6 +165,11 @@ def add_OrcaCoreServicer_to_server(servicer, server):
|
|
153
165
|
request_deserializer=service__pb2.ResultsStatsRead.FromString,
|
154
166
|
response_serializer=service__pb2.ResultsStats.SerializeToString,
|
155
167
|
),
|
168
|
+
'ReadResultFieldsForAlgorithm': grpc.unary_unary_rpc_method_handler(
|
169
|
+
servicer.ReadResultFieldsForAlgorithm,
|
170
|
+
request_deserializer=service__pb2.AlgorithmFieldsRead.FromString,
|
171
|
+
response_serializer=service__pb2.AlgorithmFields.SerializeToString,
|
172
|
+
),
|
156
173
|
}
|
157
174
|
generic_handler = grpc.method_handlers_generic_handler(
|
158
175
|
'OrcaCore', rpc_method_handlers)
|
@@ -332,6 +349,33 @@ class OrcaCore(object):
|
|
332
349
|
metadata,
|
333
350
|
_registered_method=True)
|
334
351
|
|
352
|
+
@staticmethod
|
353
|
+
def ReadResultFieldsForAlgorithm(request,
|
354
|
+
target,
|
355
|
+
options=(),
|
356
|
+
channel_credentials=None,
|
357
|
+
call_credentials=None,
|
358
|
+
insecure=False,
|
359
|
+
compression=None,
|
360
|
+
wait_for_ready=None,
|
361
|
+
timeout=None,
|
362
|
+
metadata=None):
|
363
|
+
return grpc.experimental.unary_unary(
|
364
|
+
request,
|
365
|
+
target,
|
366
|
+
'/OrcaCore/ReadResultFieldsForAlgorithm',
|
367
|
+
service__pb2.AlgorithmFieldsRead.SerializeToString,
|
368
|
+
service__pb2.AlgorithmFields.FromString,
|
369
|
+
options,
|
370
|
+
channel_credentials,
|
371
|
+
insecure,
|
372
|
+
call_credentials,
|
373
|
+
compression,
|
374
|
+
wait_for_ready,
|
375
|
+
timeout,
|
376
|
+
metadata,
|
377
|
+
_registered_method=True)
|
378
|
+
|
335
379
|
|
336
380
|
class OrcaProcessorStub(object):
|
337
381
|
"""OrcaProcessor defines the interface that each processing node must implement.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
from orca_python.main import (
|
2
|
+
Window,
|
3
|
+
Processor,
|
4
|
+
EmitWindow,
|
5
|
+
NoneResult,
|
6
|
+
WindowType,
|
7
|
+
ArrayResult,
|
8
|
+
ValueResult,
|
9
|
+
StructResult,
|
10
|
+
ExecutionParams,
|
11
|
+
)
|
12
|
+
|
13
|
+
__all__ = [
|
14
|
+
"Processor",
|
15
|
+
"EmitWindow",
|
16
|
+
"Window",
|
17
|
+
"WindowType",
|
18
|
+
"StructResult",
|
19
|
+
"ValueResult",
|
20
|
+
"ArrayResult",
|
21
|
+
"NoneResult",
|
22
|
+
"ExecutionParams",
|
23
|
+
]
|
@@ -6,6 +6,10 @@ class InvalidAlgorithmArgument(BaseOrcaException):
|
|
6
6
|
"""Raised when an argument to `@algorithm` is not correct"""
|
7
7
|
|
8
8
|
|
9
|
+
class InvalidAlgorithmReturnType(BaseOrcaException):
|
10
|
+
"""Raised when the return type of an algorithm is not valid"""
|
11
|
+
|
12
|
+
|
9
13
|
class InvalidDependency(BaseOrcaException):
|
10
14
|
"""Raised when a dependency is invalid"""
|
11
15
|
|
@@ -19,17 +19,22 @@ logging.basicConfig(
|
|
19
19
|
)
|
20
20
|
|
21
21
|
import time
|
22
|
+
import types
|
23
|
+
import typing
|
22
24
|
from typing import (
|
23
25
|
Any,
|
24
26
|
Dict,
|
25
27
|
List,
|
28
|
+
Union,
|
26
29
|
TypeVar,
|
27
30
|
Callable,
|
28
31
|
Iterable,
|
32
|
+
Optional,
|
33
|
+
Protocol,
|
29
34
|
Generator,
|
30
|
-
TypeAlias,
|
31
35
|
AsyncGenerator,
|
32
36
|
)
|
37
|
+
from inspect import signature
|
33
38
|
from concurrent import futures
|
34
39
|
from dataclasses import field, dataclass
|
35
40
|
|
@@ -41,16 +46,17 @@ from google.protobuf import json_format
|
|
41
46
|
from service_pb2_grpc import OrcaProcessorServicer
|
42
47
|
|
43
48
|
from orca_python import envs
|
44
|
-
from orca_python.exceptions import
|
49
|
+
from orca_python.exceptions import (
|
50
|
+
InvalidDependency,
|
51
|
+
InvalidAlgorithmArgument,
|
52
|
+
InvalidAlgorithmReturnType,
|
53
|
+
)
|
45
54
|
|
46
55
|
# Regex patterns for validation
|
47
56
|
ALGORITHM_NAME = r"^[A-Z][a-zA-Z0-9]*$"
|
48
57
|
SEMVER_PATTERN = r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$"
|
49
58
|
WINDOW_NAME = r"^[A-Z][a-zA-Z0-9]*$"
|
50
59
|
|
51
|
-
AlgorithmFn: TypeAlias = Callable[..., Any]
|
52
|
-
|
53
|
-
T = TypeVar("T", bound=AlgorithmFn)
|
54
60
|
|
55
61
|
LOGGER = logging.getLogger(__name__)
|
56
62
|
|
@@ -74,6 +80,74 @@ class WindowType:
|
|
74
80
|
)
|
75
81
|
|
76
82
|
|
83
|
+
@dataclass
|
84
|
+
class StructResult:
|
85
|
+
value: Dict[str, Any]
|
86
|
+
|
87
|
+
def __init__(self, value: Dict[str, Any]) -> None:
|
88
|
+
"""
|
89
|
+
Produce a struct/dictionary based result
|
90
|
+
|
91
|
+
Args:
|
92
|
+
value: The result to produce. e.g.: {'min': -1.1, 'median': 4.2, 'max': 5.0}
|
93
|
+
"""
|
94
|
+
self.value = value
|
95
|
+
|
96
|
+
|
97
|
+
@dataclass
|
98
|
+
class ValueResult:
|
99
|
+
value: float | int | bool
|
100
|
+
|
101
|
+
def __init__(self, value: float | int | bool) -> None:
|
102
|
+
"""
|
103
|
+
Produce a value result
|
104
|
+
|
105
|
+
Args:
|
106
|
+
value: The result to produce. E.g. 1.0
|
107
|
+
"""
|
108
|
+
self.value = value
|
109
|
+
|
110
|
+
|
111
|
+
@dataclass
|
112
|
+
class ArrayResult:
|
113
|
+
value: Iterable[float | int | bool]
|
114
|
+
|
115
|
+
def __init__(self, value: Iterable[float | int | bool]) -> None:
|
116
|
+
"""
|
117
|
+
Produce an array result
|
118
|
+
|
119
|
+
Args:
|
120
|
+
value: The result to produce. E.g. [1, 2, 3, 4, 5]
|
121
|
+
"""
|
122
|
+
self.value = value
|
123
|
+
|
124
|
+
|
125
|
+
class NoneResult:
|
126
|
+
"""
|
127
|
+
The `None` result type
|
128
|
+
"""
|
129
|
+
|
130
|
+
value: None = None
|
131
|
+
|
132
|
+
|
133
|
+
returnResult = StructResult | ArrayResult | ValueResult | NoneResult
|
134
|
+
|
135
|
+
|
136
|
+
@dataclass
|
137
|
+
class ExecutionParams:
|
138
|
+
window: pb.Window
|
139
|
+
dependencies: Optional[Iterable[pb.AlgorithmResult]] = None
|
140
|
+
|
141
|
+
|
142
|
+
class AlgorithmFn(Protocol):
|
143
|
+
def __call__(
|
144
|
+
self, params: ExecutionParams, *args: Any, **kwargs: Any
|
145
|
+
) -> returnResult: ...
|
146
|
+
|
147
|
+
|
148
|
+
T = TypeVar("T", bound=AlgorithmFn)
|
149
|
+
|
150
|
+
|
77
151
|
@dataclass
|
78
152
|
class Window:
|
79
153
|
time_from: int
|
@@ -134,6 +208,7 @@ class Algorithm:
|
|
134
208
|
exec_fn: AlgorithmFn
|
135
209
|
processor: str
|
136
210
|
runtime: str
|
211
|
+
result_type: returnResult
|
137
212
|
|
138
213
|
@property
|
139
214
|
def full_name(self) -> str:
|
@@ -200,12 +275,11 @@ class Algorithms:
|
|
200
275
|
break
|
201
276
|
|
202
277
|
if not dependencyAlgo:
|
278
|
+
dep_name = getattr(dependency, "__name__", "<unknown>")
|
203
279
|
LOGGER.error(
|
204
|
-
f"Failed to find registered algorithm for dependency: {
|
205
|
-
)
|
206
|
-
raise ValueError(
|
207
|
-
f"Dependency {dependency.__name__} not found in registered algorithms"
|
280
|
+
f"Failed to find registered algorithm for dependency: {dep_name}"
|
208
281
|
)
|
282
|
+
raise ValueError(f"Dependency {dep_name} not found in reg=ms")
|
209
283
|
|
210
284
|
if algorithm not in self._dependencyFns:
|
211
285
|
self._dependencyFns[algorithm] = [dependency]
|
@@ -265,7 +339,7 @@ class Processor(OrcaProcessorServicer): # type: ignore
|
|
265
339
|
self,
|
266
340
|
exec_id: str,
|
267
341
|
algorithm: pb.Algorithm,
|
268
|
-
|
342
|
+
params: ExecutionParams,
|
269
343
|
) -> pb.ExecutionResult:
|
270
344
|
"""
|
271
345
|
Executes a single algorithm with resolved dependencies.
|
@@ -273,7 +347,7 @@ class Processor(OrcaProcessorServicer): # type: ignore
|
|
273
347
|
Args:
|
274
348
|
exec_id (str): Unique execution ID.
|
275
349
|
algorithm (pb.Algorithm): The algorithm to execute.
|
276
|
-
|
350
|
+
params (ExecutionParams): The execution params object, which contains the triggering window and dependency results.
|
277
351
|
|
278
352
|
Returns:
|
279
353
|
pb.ExecutionResult: The result of the execution.
|
@@ -288,27 +362,28 @@ class Processor(OrcaProcessorServicer): # type: ignore
|
|
288
362
|
|
289
363
|
# convert dependency results into a dict of name -> value
|
290
364
|
dependency_values = {}
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
365
|
+
if params.dependencies:
|
366
|
+
for dep_result in params.dependencies:
|
367
|
+
# extract value based on which oneof field is set
|
368
|
+
dep_value = None
|
369
|
+
if dep_result.result.HasField("single_value"):
|
370
|
+
dep_value = dep_result.result.single_value
|
371
|
+
elif dep_result.result.HasField("float_values"):
|
372
|
+
dep_value = list(dep_result.result.float_values.values)
|
373
|
+
elif dep_result.result.HasField("struct_value"):
|
374
|
+
dep_value = json_format.MessageToDict(
|
375
|
+
dep_result.result.struct_value
|
376
|
+
)
|
377
|
+
|
378
|
+
dep_name = (
|
379
|
+
f"{dep_result.algorithm.name}_{dep_result.algorithm.version}"
|
301
380
|
)
|
302
|
-
|
303
|
-
dep_name = f"{dep_result.algorithm.name}_{dep_result.algorithm.version}"
|
304
|
-
dependency_values[dep_name] = dep_value
|
381
|
+
dependency_values[dep_name] = dep_value
|
305
382
|
|
306
383
|
# execute in thread pool since algo.exec_fn is synchronous
|
307
384
|
loop = asyncio.get_event_loop()
|
308
385
|
|
309
|
-
algoResult = await loop.run_in_executor(
|
310
|
-
None, algo.exec_fn, dependency_values
|
311
|
-
)
|
386
|
+
algoResult = await loop.run_in_executor(None, algo.exec_fn, params)
|
312
387
|
|
313
388
|
# create result based on the return type
|
314
389
|
current_time = int(time.time()) # Current timestamp in seconds
|
@@ -410,13 +485,13 @@ class Processor(OrcaProcessorServicer): # type: ignore
|
|
410
485
|
return pb.ExecutionResult(exec_id=exec_id, algorithm_result=algo_result)
|
411
486
|
|
412
487
|
def ExecuteDagPart(
|
413
|
-
self,
|
488
|
+
self, executionRequest: pb.ExecutionRequest, context: grpc.ServicerContext
|
414
489
|
) -> Generator[pb.ExecutionResult, None, None]:
|
415
490
|
"""
|
416
491
|
Executes part of a DAG (Directed Acyclic Graph) of algorithms.
|
417
492
|
|
418
493
|
Args:
|
419
|
-
|
494
|
+
executionRequest (pb.ExecutionRequest): The DAG execution request.
|
420
495
|
context (grpc.ServicerContext): gRPC context for the request.
|
421
496
|
|
422
497
|
Yields:
|
@@ -428,8 +503,8 @@ class Processor(OrcaProcessorServicer): # type: ignore
|
|
428
503
|
|
429
504
|
LOGGER.info(
|
430
505
|
(
|
431
|
-
f"Received DAG execution request with {len(
|
432
|
-
f"algorithms and ExecId: {
|
506
|
+
f"Received DAG execution request with {len(executionRequest.algorithms)} "
|
507
|
+
f"algorithms and ExecId: {executionRequest.exec_id}"
|
433
508
|
)
|
434
509
|
)
|
435
510
|
|
@@ -444,11 +519,14 @@ class Processor(OrcaProcessorServicer): # type: ignore
|
|
444
519
|
# create tasks for all algorithms
|
445
520
|
tasks = [
|
446
521
|
self.execute_algorithm(
|
447
|
-
|
522
|
+
executionRequest.exec_id,
|
448
523
|
algorithm,
|
449
|
-
|
524
|
+
ExecutionParams(
|
525
|
+
window=executionRequest.window,
|
526
|
+
dependencies=executionRequest.algorithm_results,
|
527
|
+
),
|
450
528
|
)
|
451
|
-
for algorithm in
|
529
|
+
for algorithm in executionRequest.algorithms
|
452
530
|
]
|
453
531
|
|
454
532
|
# execute all tasks concurrently and yield results as they complete
|
@@ -526,6 +604,21 @@ class Processor(OrcaProcessorServicer): # type: ignore
|
|
526
604
|
algo_msg.name = algorithm.name
|
527
605
|
algo_msg.version = algorithm.version
|
528
606
|
|
607
|
+
# manage the return type of the algorithm
|
608
|
+
if algorithm.result_type == ValueResult: # type: ignore
|
609
|
+
result_type_pb = pb.ResultType.VALUE
|
610
|
+
elif algorithm.result_type == StructResult: # type: ignore
|
611
|
+
result_type_pb = pb.ResultType.STRUCT
|
612
|
+
elif algorithm.result_type == ArrayResult: # type: ignore
|
613
|
+
result_type_pb = pb.ResultType.ARRAY
|
614
|
+
else:
|
615
|
+
raise InvalidAlgorithmReturnType(
|
616
|
+
f"Algorithm has return type {algorithm.result_type}, but expected one of `StructResult`, `ValueResult`, `ArrayResult`"
|
617
|
+
)
|
618
|
+
|
619
|
+
## add the result type
|
620
|
+
algo_msg.result_type = result_type_pb
|
621
|
+
|
529
622
|
# Add window type
|
530
623
|
algo_msg.window_type.name = algorithm.window_name
|
531
624
|
algo_msg.window_type.version = algorithm.window_version
|
@@ -637,18 +730,16 @@ class Processor(OrcaProcessorServicer): # type: ignore
|
|
637
730
|
|
638
731
|
def inner(algo: T) -> T:
|
639
732
|
def wrapper(
|
640
|
-
|
733
|
+
params: ExecutionParams,
|
641
734
|
*args: Any,
|
642
735
|
**kwargs: Any,
|
643
|
-
) ->
|
736
|
+
) -> returnResult:
|
644
737
|
LOGGER.debug(f"Executing algorithm {name}_{version}")
|
645
738
|
try:
|
646
739
|
# setup ready for the algo
|
647
|
-
#
|
648
|
-
|
649
|
-
kwargs["dependencies"] = dependency_values
|
740
|
+
# pack the params into the kwargs - user can decide if they want it
|
741
|
+
kwargs["params"] = params
|
650
742
|
LOGGER.debug(f"Algorithm {name}_{version} setup complete")
|
651
|
-
# TODO
|
652
743
|
|
653
744
|
# run the algo
|
654
745
|
LOGGER.info(f"Running algorithm {name}_{version}")
|
@@ -664,6 +755,13 @@ class Processor(OrcaProcessorServicer): # type: ignore
|
|
664
755
|
)
|
665
756
|
raise
|
666
757
|
|
758
|
+
sig = signature(algo)
|
759
|
+
returnType = sig.return_annotation
|
760
|
+
if not is_type_in_union(returnType, returnResult): # type: ignore
|
761
|
+
raise InvalidAlgorithmReturnType(
|
762
|
+
f"Algorithm has return type {sig.return_annotation}, but expected one of `StructResult`, `ValueResult`, `ArrayResult`"
|
763
|
+
)
|
764
|
+
|
667
765
|
algorithm = Algorithm(
|
668
766
|
name=name,
|
669
767
|
version=version,
|
@@ -673,6 +771,7 @@ class Processor(OrcaProcessorServicer): # type: ignore
|
|
673
771
|
exec_fn=wrapper,
|
674
772
|
processor=self._name,
|
675
773
|
runtime=sys.version,
|
774
|
+
result_type=returnType,
|
676
775
|
)
|
677
776
|
|
678
777
|
self._algorithmsSingleton._add_algorithm(algorithm.full_name, algorithm)
|
@@ -695,6 +794,29 @@ class Processor(OrcaProcessorServicer): # type: ignore
|
|
695
794
|
# needs to be defined before a dependency can be created, and you can only register depencenies
|
696
795
|
# once. But when dependencies are grabbed from a server, circular dependencies will be possible
|
697
796
|
|
698
|
-
return wrapper # type: ignore
|
797
|
+
return wrapper # type: ignore[return-value]
|
699
798
|
|
700
799
|
return inner
|
800
|
+
|
801
|
+
|
802
|
+
def is_type_in_union(target_type, union_type): # type: ignore
|
803
|
+
"""
|
804
|
+
Check if target_type is contained within union_type.
|
805
|
+
Works with both new syntax (int | float) and typing.Union.
|
806
|
+
"""
|
807
|
+
try:
|
808
|
+
# handle new union syntax (Python 3.10+) - types.UnionType
|
809
|
+
if isinstance(union_type, types.UnionType):
|
810
|
+
return target_type in union_type.__args__
|
811
|
+
|
812
|
+
# handle typing.Union syntax
|
813
|
+
origin = getattr(typing, "get_origin", lambda x: None)(union_type)
|
814
|
+
if origin is Union:
|
815
|
+
args = getattr(typing, "get_args", lambda x: ())(union_type)
|
816
|
+
return target_type in args
|
817
|
+
|
818
|
+
# handle single type (not a union)
|
819
|
+
return target_type == union_type
|
820
|
+
|
821
|
+
except (AttributeError, TypeError):
|
822
|
+
return False
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{orca_python-0.4.0 → orca_python-0.6.0}/orca/core/protobufs/python/vendor/validate_pb2_grpc.py
RENAMED
File without changes
|
File without changes
|
File without changes
|