orca-python 0.7.4__py3-none-any.whl → 0.7.6__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/envs.py +15 -9
- orca_python/main.py +28 -8
- {orca_python-0.7.4.dist-info → orca_python-0.7.6.dist-info}/METADATA +3 -3
- {orca_python-0.7.4.dist-info → orca_python-0.7.6.dist-info}/RECORD +6 -6
- {orca_python-0.7.4.dist-info → orca_python-0.7.6.dist-info}/LICENSE +0 -0
- {orca_python-0.7.4.dist-info → orca_python-0.7.6.dist-info}/WHEEL +0 -0
orca_python/envs.py
CHANGED
@@ -4,21 +4,27 @@ from typing import Tuple
|
|
4
4
|
from orca_python.exceptions import MissingDependency
|
5
5
|
|
6
6
|
|
7
|
-
def getenvs() -> Tuple[str,
|
8
|
-
orcaserver = os.getenv("
|
7
|
+
def getenvs() -> Tuple[bool, str, str, str]:
|
8
|
+
orcaserver = os.getenv("ORCA_CORE", "")
|
9
9
|
if orcaserver == "":
|
10
|
-
MissingDependency("
|
10
|
+
raise MissingDependency("ORCA_CORE is required")
|
11
11
|
orcaserver = orcaserver.lstrip("grpc://")
|
12
12
|
|
13
|
-
port = os.getenv("
|
13
|
+
port = os.getenv("PROCESSOR_PORT", "")
|
14
14
|
if port == "":
|
15
|
-
MissingDependency("
|
15
|
+
raise MissingDependency("PROCESSOR_PORT required")
|
16
16
|
|
17
|
-
host = os.getenv("
|
17
|
+
host = os.getenv("PROCESSOR_ADDRESS", "")
|
18
18
|
if host == "":
|
19
|
-
MissingDependency("
|
19
|
+
raise MissingDependency("PROCESSOR_ADDRESS is required")
|
20
20
|
|
21
|
-
|
21
|
+
env = os.getenv("ENV", "")
|
22
|
+
if env == "production":
|
23
|
+
is_production = True
|
24
|
+
else:
|
25
|
+
is_production = False
|
22
26
|
|
27
|
+
return is_production, orcaserver, port, host
|
23
28
|
|
24
|
-
|
29
|
+
|
30
|
+
is_production, ORCASERVER, PORT, HOST = getenvs()
|
orca_python/main.py
CHANGED
@@ -209,10 +209,20 @@ def EmitWindow(window: Window) -> None:
|
|
209
209
|
json_format.ParseDict(window.metadata, struct_value)
|
210
210
|
window_pb.metadata = struct_value
|
211
211
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
212
|
+
if envs.is_production:
|
213
|
+
# secure channel with TLS
|
214
|
+
with grpc.secure_channel(
|
215
|
+
envs.ORCASERVER, grpc.ssl_channel_credentials()
|
216
|
+
) as channel:
|
217
|
+
stub = service_pb2_grpc.OrcaCoreStub(channel)
|
218
|
+
response = stub.EmitWindow(window_pb)
|
219
|
+
LOGGER.info(f"Window emitted: {response}")
|
220
|
+
else:
|
221
|
+
# insecure channel for local development
|
222
|
+
with grpc.insecure_channel(envs.ORCASERVER) as channel:
|
223
|
+
stub = service_pb2_grpc.OrcaCoreStub(channel)
|
224
|
+
response = stub.EmitWindow(window_pb)
|
225
|
+
LOGGER.info(f"Window emitted: {response}")
|
216
226
|
|
217
227
|
|
218
228
|
@dataclass
|
@@ -641,10 +651,20 @@ class Processor(OrcaProcessorServicer): # type: ignore
|
|
641
651
|
dep_msg.processor_name = dep.processor
|
642
652
|
dep_msg.processor_runtime = dep.runtime
|
643
653
|
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
654
|
+
if envs.is_production:
|
655
|
+
# secure channel with TLS
|
656
|
+
with grpc.secure_channel(
|
657
|
+
envs.ORCASERVER, grpc.ssl_channel_credentials()
|
658
|
+
) as channel:
|
659
|
+
stub = service_pb2_grpc.OrcaCoreStub(channel)
|
660
|
+
response = stub.RegisterProcessor(registration_request)
|
661
|
+
LOGGER.info(f"Algorithm registration response received: {response}")
|
662
|
+
else:
|
663
|
+
# insecure channel for local development
|
664
|
+
with grpc.insecure_channel(envs.ORCASERVER) as channel:
|
665
|
+
stub = service_pb2_grpc.OrcaCoreStub(channel)
|
666
|
+
response = stub.RegisterProcessor(registration_request)
|
667
|
+
LOGGER.info(f"Algorithm registration response received: {response}")
|
648
668
|
|
649
669
|
def Start(self) -> None:
|
650
670
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: orca-python
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.6
|
4
4
|
Summary: Python SDK for the Predixus Orca product
|
5
5
|
Author: Frederick Mannings
|
6
6
|
Author-email: contact@predixus.com
|
@@ -81,10 +81,10 @@ proc.Start()
|
|
81
81
|
Then run your python file to register it with orca-core:
|
82
82
|
|
83
83
|
```bash
|
84
|
-
|
84
|
+
ORCA_CORE=grpc://localhost:32770 PROCESSOR_ADDRESS=172.18.0.1 PROCESSOR_PORT=8080 python main.py
|
85
85
|
```
|
86
86
|
|
87
|
-
Replace the contents of `
|
87
|
+
Replace the contents of `ORCA_CORE`, `PROCESSOR_ADDRESS` and `PROCESSOR_PORT` with the output of `orca status`.
|
88
88
|
|
89
89
|
6. Emit a window to orcacore
|
90
90
|
TBD
|
@@ -7,11 +7,11 @@ vendor/validate_pb2.py,sha256=lyYYFtGDzHjs9ZHMUnQLcE_G5qYWfOluts0gm6m1D88,149437
|
|
7
7
|
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
|
-
orca_python/envs.py,sha256=
|
10
|
+
orca_python/envs.py,sha256=1xf5KCqNm9GLODNvJytvPy7ed0QXxCFAMiG-oaEUHBQ,792
|
11
11
|
orca_python/exceptions.py,sha256=el7a5VUd21nNCTSTgVn5T9gyULncrQgKyFQghWmApnw,629
|
12
|
-
orca_python/main.py,sha256=
|
12
|
+
orca_python/main.py,sha256=5pAlE2Xhr3sxtVnD-_JHwUr0W0VE81geqkeow4LdU-M,30178
|
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.6.dist-info/LICENSE,sha256=sxb8X8qhbZ_JaCBFmoIriJzA-jelKmh86sAKQsIRN_I,1062
|
15
|
+
orca_python-0.7.6.dist-info/METADATA,sha256=CTzgTqshwlo01k_o-qfoTe7YmboWjCO67yqCVTYyOaE,3081
|
16
|
+
orca_python-0.7.6.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
17
|
+
orca_python-0.7.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|