diff --git a/CHANGELOG.md b/CHANGELOG.md index 612d586..9581249 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +## [v0.9.0] - 27-09-2025 + ### Changed -- How the processor address is provided, with a robust regex handling of the address +- How the processor address is provided to combine address and port, with a robust regex handling of the address. + +### Added + +- Additional optional env var to register with Orca core a different port to what is exposed internally + ## [v0.8.0] - 23-09-2025 @@ -136,7 +143,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed -[unreleased]: https://github.com/Predixus/Orca/compare/v0.8.0...HEAD +[unreleased]: https://github.com/Predixus/Orca/compare/v0.9.0...HEAD +[v0.9.0]: https://github.com/Predixus/Orca/compare/v0.8.0...v0.9.0 [v0.8.0]: https://github.com/Predixus/Orca/compare/v0.7.14...v0.8.0 [v0.7.14]: https://github.com/Predixus/Orca/compare/v0.7.13...v0.7.14 [v0.7.13]: https://github.com/Predixus/Orca/compare/v0.7.12...v0.7.13 diff --git a/README.md b/README.md index df22311..2628561 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # 🐳 Orca Python SDK The Orca Python SDK enables developers to define and register Python-based algorithms into the -[Orca](https://www.github.com/Predixus/orca) framework. +[Orca](https://www.github.com/orc-analytics/orca) framework. Orca exists to make it seamless to build scalable, production-grade ML or analytics pipelines on timeseries data. @@ -16,7 +16,7 @@ Before using this SDK, you should install the Orca CLI and start Orca Core. **Linux / macOS** ```bash -curl -fsSL https://raw.githubusercontent.com/Predixus/orca/main/install-cli.sh | bash +curl -fsSL https://raw.githubusercontent.com/orc-analytics/orca/main/install-cli.sh | bash ``` **Windows** @@ -40,7 +40,7 @@ orca status 4. Install the Orca sdk into your python project: ```bash -pip install orca-time +pip install orca-python ``` 5. Start building out your algorithms @@ -65,37 +65,30 @@ proc.Start() Then run your python file to register it with orca-core: ```bash - ORCA_CORE=grpc://localhost:32770 PROCESSOR_ADDRESS=172.18.0.1 PROCESSOR_PORT=8080 python main.py + ORCA_CORE=grpc://localhost:32770 PROCESSOR_ADDRESS=172.18.0.1:8080 python main.py ``` -Replace the contents of `ORCA_CORE`, `PROCESSOR_ADDRESS` and `PROCESSOR_PORT` with the output of `orca status`. +Replace the contents of `ORCA_CORE` and `PROCESSOR_ADDRESS` with the output of `orca status`. 6. Emit a window to orcacore - TBD Check out more examples [here](./examples/). -## 🧱 Key Concepts - -Processor: A container for algorithms, exposing them to the Orca Core service. - -Algorithm: A Python function decorated and registered for DAG execution. - -Window: A temporal trigger used to activate algorithms. +## Environment Variables -## ⚠️ Naming Rules +Several environment variables are require to register an Orca Processor: -Algorithm and Window names must be in PascalCase. +- `ORCA_CORE` - the address to reach the Orca-core service +- `PROCESSOR_ADDRESS` - the address needed by Orca-core to reach the processor, of format `
:` +- `PROCESSOR_EXTERNAL_PORT` - an optional alternative port that should be used by Orca-core to contact the processor. Useful in scenarios like deploying the processor behind a managed service. -Versions must follow semantic versioning (e.g., 1.0.0). - -Dependencies must be declared only after their algorithm is registered. +## 🧱 Key Concepts -Algorithms cannot depend on others from a different window type (enforced by Orca Core). +Checkout the Orca [docs](https://app.orc-a.io/docs) for info on how Orca works. ## 👥 Community -GitHub Issues: https://github.com/predixus/orca-python/issues +GitHub Issues: https://github.com/orc-analytics/orca-python/issues Discussions: Coming soon! @@ -104,5 +97,3 @@ Discussions: Coming soon! This SDK is part of the Orca ecosystem, but licensed under the MIT License. See the full license terms (here)[./LICENSE]. - -Built with ❤️ by Predixus diff --git a/orca_python/envs.py b/orca_python/envs.py index 510a731..15bb0e0 100644 --- a/orca_python/envs.py +++ b/orca_python/envs.py @@ -33,7 +33,7 @@ def _parse_connection_string(connection_string: str) -> Optional[Tuple[str, int] return (address, port) -def getenvs() -> Tuple[bool, str, str, int]: +def getenvs() -> Tuple[bool, str, str, int, int]: orca_core = os.getenv("ORCA_CORE", "") if orca_core == "": raise MissingEnvVar("ORCA_CORE is required") @@ -50,13 +50,29 @@ def getenvs() -> Tuple[bool, str, str, int]: ) processor_address, processor_port = res + _processor_external_port = os.getenv("PROCESSOR_EXTERNAL_PORT", "") + if _processor_external_port != "": + if not _processor_external_port.isdigit(): + raise BadEnvVar("PROCESSOR_EXTERNAL_PORT is not a valid number") + processor_external_port = int(_processor_external_port) + else: + processor_external_port = processor_port + env = os.getenv("ENV", "") if env == "production": is_production = True else: is_production = False - return is_production, orca_core, processor_address, processor_port + return ( + is_production, + orca_core, + processor_address, + processor_port, + processor_external_port, + ) -is_production, ORCA_CORE, PROCESSOR_HOST, PROCESSOR_PORT = getenvs() +is_production, ORCA_CORE, PROCESSOR_HOST, PROCESSOR_PORT, PROCESSOR_EXTERNAL_PORT = ( + getenvs() +) diff --git a/orca_python/main.py b/orca_python/main.py index cec58c4..49e5bc4 100644 --- a/orca_python/main.py +++ b/orca_python/main.py @@ -392,7 +392,7 @@ def __init__(self, name: str, max_workers: int = 10): super().__init__() self._name = name self._processorConnStr = f"[::]:{envs.PROCESSOR_PORT}" # attach the processor to all network interfaces when launching the gRPC service. - self._orcaProcessorConnStr = f"{envs.PROCESSOR_HOST}:{envs.PROCESSOR_PORT}" # tell orca-core to reference this processor by this address. + self._orcaProcessorConnStr = f"{envs.PROCESSOR_HOST}:{envs.PROCESSOR_EXTERNAL_PORT}" # tell orca-core to reference this processor by this address. self._runtime = sys.version self._max_workers = max_workers self._algorithmsSingleton: Algorithms = Algorithms() diff --git a/pyproject.toml b/pyproject.toml index ae5ac66..2d9c8e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "orca-python" -version = "0.8.0" +version = "0.9.0" description = "Python SDK for the Predixus Orca product" authors = [ "Frederick Mannings "