Skip to main content

Python SDK for the Predixus Orca product

Project description

🐳 Orca Python SDK

The Orca Python SDK enables developers to define and register Python-based algorithms into the Orca framework.

Orca exists to make it seamless to build scalable, production-grade ML or analytics pipelines on timeseries data.

🚀 Getting Started

Before using this SDK, you should install the Orca CLI and start Orca Core.

  1. Install the Orca CLI Ensure that Docker is installed on your system.

Linux / macOS

curl -fsSL https://raw.githubusercontent.com/orc-analytics/orca/main/install-cli.sh | bash

Windows

Use WSL (Windows Subsystem for Linux) and run the above command inside your WSL shell.

Once installed, follow the instructions in the Orca documentation to start the Orca Core service.

  1. Start the Orca Server
orca start
  1. Print out the server details
orca status
  1. Install the Orca sdk into your python project:
pip install orca-python
  1. Start building out your algorithms

Write a file defining your algorithms and what windows trigger them:

# main.py
from orca_python import Processor

proc = Processor("ml")

@proc.algorithm("MyAlgo", "1.0.0", "MyWindow", "1.0.0")
def my_algorithm() -> dict:
return {"result": 42}

if __name__ == "__main__":
proc.Register()
proc.Start()

Then run your python file to register it with orca-core:

 ORCA_CORE=grpc://localhost:32770 PROCESSOR_ADDRESS=172.18.0.1:8080 python main.py

Replace the contents of ORCA_CORE and PROCESSOR_ADDRESS with the output of orca status.

  1. Emit a window to orcacore

Check out more examples here.

  1. Sync local registry of algorithms to Orca Core

When building algorithms that depend on the result of algorithms in other proccessors it's neccessary to reference these algorithms as python objects in the depends_on argument of the algorithm decorator function.

To do this, sync your python project with Orca Core:

orca sync

Run this command at the root level of your python project. This will generate a .orca folder that contains type stubs for the algorithms stored in other processors.

Then, configure the settings of your language server and/or linter to include these type stubs. E.g. for pyright, you would include these settings in your pyrightconfig.json file at the root of your python project:

{
  "stubPath": ".orca",
}

Now, when importing modules from orca_python.registry.algorithms you will see algorithms configured by remote processors.

For example:

from orca_python.registry.algorithms import <my_remote_algorithm>

This stubbed algorithm can be used as an algorithm in the depends_on argument of the algorithm decorator function.

from orca_python import Processor
from orca_python.registry.window_types import every_30_seconds
from orca_python.registry.algorithms import my_remote_algorithm

proc = Processor("ml")

@proc.algorithm(
    "MyAlgo",
    "1.0.0",
    every_30_seconds,
    depends_on=[my_remote_algorithm]
)
def my_algorithm(params: ExecutionParams) -> StructResult:
    ...

Configuration

Some configuration is required to register a process then start accepting processing requests. If using the internal orca stack for development (via orca start), then simply initialise the repository with an orca.json file:

orca init

You can additionally provide these environment variables to override, or set, certain configurations:

  • 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.
  • ENV - when set to production the processor will serve using TLS

🧱 Key Concepts

Checkout the Orca docs for info on how Orca works.

👥 Community

GitHub Issues: https://github.com/orc-analytics/orca-python/issues

Discussions: Coming soon!

📄 License

This SDK is part of the Orca ecosystem, but licensed under the MIT License.

See the full license terms (here)[./LICENSE].

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

orca_python-0.12.0.tar.gz (39.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

orca_python-0.12.0-py3-none-any.whl (40.9 kB view details)

Uploaded Python 3

File details

Details for the file orca_python-0.12.0.tar.gz.

File metadata

  • Download URL: orca_python-0.12.0.tar.gz
  • Upload date:
  • Size: 39.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.11 Linux/6.11.0-1018-azure

File hashes

Hashes for orca_python-0.12.0.tar.gz
Algorithm Hash digest
SHA256 2d19a656a847bb1cb7af10677bccaf58af6e47e9a4199c335171186a1dbd99b0
MD5 ec33487389256f829ec4d337bfeddec3
BLAKE2b-256 89b222d80c093da2c60bbf9003261bcea74056041c3f038a8aa74f55cac4584a

See more details on using hashes here.

File details

Details for the file orca_python-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: orca_python-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 40.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.11 Linux/6.11.0-1018-azure

File hashes

Hashes for orca_python-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 672679e7c333b354f35a2e2e1050fc409dd244d2b9353e23e328b5d73d350ffa
MD5 cd4b44615f652d6e7e6c3e97e6f05373
BLAKE2b-256 34bf7733f866a89adb1acd1b24754d11e2a0bc267534cab0e6abb6dc3693fda8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page