orca-python 0.7.2__py3-none-any.whl → 0.7.4__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/main.py +18 -42
- {orca_python-0.7.2.dist-info → orca_python-0.7.4.dist-info}/METADATA +1 -1
- {orca_python-0.7.2.dist-info → orca_python-0.7.4.dist-info}/RECORD +5 -5
- {orca_python-0.7.2.dist-info → orca_python-0.7.4.dist-info}/LICENSE +0 -0
- {orca_python-0.7.2.dist-info → orca_python-0.7.4.dist-info}/WHEEL +0 -0
orca_python/main.py
CHANGED
@@ -198,8 +198,8 @@ def EmitWindow(window: Window) -> None:
|
|
198
198
|
_time_to.FromDatetime(window.time_to)
|
199
199
|
|
200
200
|
window_pb = pb.Window()
|
201
|
-
window_pb.time_to
|
202
|
-
window_pb.time_from
|
201
|
+
window_pb.time_to.CopyFrom(_time_to)
|
202
|
+
window_pb.time_from.CopyFrom(_time_from)
|
203
203
|
window_pb.window_type_name = window.name
|
204
204
|
window_pb.window_type_version = window.version
|
205
205
|
window_pb.origin = window.origin
|
@@ -415,61 +415,37 @@ class Processor(OrcaProcessorServicer): # type: ignore
|
|
415
415
|
|
416
416
|
algoResult = await loop.run_in_executor(None, algo.exec_fn, params)
|
417
417
|
|
418
|
-
#
|
419
|
-
|
420
|
-
|
421
|
-
if isinstance(algoResult, dict):
|
422
|
-
# for dictionary results, use struct_value
|
418
|
+
# depending on algo result type, map to whatever instance
|
419
|
+
if algo.result_type == StructResult: # type: ignore
|
423
420
|
struct_value = struct_pb2.Struct()
|
424
|
-
json_format.ParseDict(algoResult, struct_value)
|
421
|
+
json_format.ParseDict(algoResult.value, struct_value)
|
425
422
|
|
426
423
|
resultPb = pb.Result(
|
427
|
-
status=pb.ResultStatus.RESULT_STATUS_SUCEEDED,
|
424
|
+
status=pb.ResultStatus.RESULT_STATUS_SUCEEDED,
|
428
425
|
struct_value=struct_value,
|
429
|
-
timestamp=current_time,
|
430
426
|
)
|
431
|
-
|
427
|
+
|
428
|
+
elif algo.result_type == ValueResult: # type: ignore
|
432
429
|
# for single numeric values
|
433
430
|
resultPb = pb.Result(
|
434
431
|
status=pb.ResultStatus.RESULT_STATUS_SUCEEDED,
|
435
|
-
single_value=
|
436
|
-
timestamp=current_time,
|
432
|
+
single_value=algoResult.value,
|
437
433
|
)
|
438
|
-
elif
|
439
|
-
isinstance(x, (int, float)) for x in algoResult
|
440
|
-
):
|
434
|
+
elif algo.result_type == ArrayResult: # type: ignore
|
441
435
|
# for lists of numeric values
|
442
436
|
float_array = pb.FloatArray(values=algoResult)
|
443
437
|
resultPb = pb.Result(
|
444
438
|
status=pb.ResultStatus.RESULT_STATUS_SUCEEDED,
|
445
|
-
float_values=float_array,
|
446
|
-
timestamp=current_time,
|
439
|
+
float_values=float_array.values,
|
447
440
|
)
|
448
441
|
else:
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
result_dict = {"value": str(algoResult)}
|
457
|
-
|
458
|
-
json_format.ParseDict(result_dict, struct_value)
|
459
|
-
resultPb = pb.Result(
|
460
|
-
status=pb.ResultStatus.RESULT_STATUS_SUCEEDED,
|
461
|
-
struct_value=struct_value,
|
462
|
-
timestamp=current_time,
|
463
|
-
)
|
464
|
-
except Exception as conv_error:
|
465
|
-
LOGGER.error(
|
466
|
-
f"Failed to convert result to protobuf: {str(conv_error)}"
|
467
|
-
)
|
468
|
-
# create a handled failure result
|
469
|
-
resultPb = pb.Result(
|
470
|
-
status=pb.ResultStatus.RESULT_STATUS_HANDLED_FAILED,
|
471
|
-
timestamp=current_time,
|
472
|
-
)
|
442
|
+
LOGGER.error(
|
443
|
+
f"Algorithm {algo.name} {algo.version} has unhandled return type {algo.result_type}"
|
444
|
+
)
|
445
|
+
# create a handled failure result
|
446
|
+
resultPb = pb.Result(
|
447
|
+
status=pb.ResultStatus.RESULT_STATUS_HANDLED_FAILED,
|
448
|
+
)
|
473
449
|
|
474
450
|
# create the algorithm result
|
475
451
|
algoResultPb = pb.AlgorithmResult(
|
@@ -9,9 +9,9 @@ vendor/validate_pb2_grpc.py,sha256=qIlTS0MGHE7myQ7tCMbS-pPqA9FMZl_Hn9Mh_uq2o9o,8
|
|
9
9
|
orca_python/__init__.py,sha256=tHVOEF69iiLzbymMTuEKdbGSqeaAzpc-BiZY7VY1Gz4,362
|
10
10
|
orca_python/envs.py,sha256=zSuukNSpEw78VpSSIDAA9KRAurWedQMwx1qyQg9f8pk,560
|
11
11
|
orca_python/exceptions.py,sha256=el7a5VUd21nNCTSTgVn5T9gyULncrQgKyFQghWmApnw,629
|
12
|
-
orca_python/main.py,sha256=
|
12
|
+
orca_python/main.py,sha256=BJvV_xOxzJzcsAp3UKvckqLFyV8mCPfDh0tpk3Jwp0A,29264
|
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.4.dist-info/LICENSE,sha256=sxb8X8qhbZ_JaCBFmoIriJzA-jelKmh86sAKQsIRN_I,1062
|
15
|
+
orca_python-0.7.4.dist-info/METADATA,sha256=M_aEO78bjkFF9kVKvI1fuZmigYRkYPFtDibrbZDpdwY,3019
|
16
|
+
orca_python-0.7.4.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
17
|
+
orca_python-0.7.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|