Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
35 changes: 13 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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**
Expand All @@ -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
Expand All @@ -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 `<address>:<port>`
- `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!

Expand All @@ -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
22 changes: 19 additions & 3 deletions orca_python/envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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()
)
2 changes: 1 addition & 1 deletion orca_python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <contact@predixus.com>"
Expand Down