Skip to main content

Simple Remote Function Calling Framework

Project description

harmoney

Distributed Function Caller Framework for Python

Installation:

pip install harmoney

Dependencies:

  • websockets
  • fastapi
  • requests
  • uvicorn
  • pydantic

Usage:

Requires 3 scripts: Client, Broker and Runner

  • Broker will mediate load balancing and connection handling, so this should start first. One port should be open.

Let broker's IP be 192.168.0.110 and port be 7732

from harmoney import router as rou

ro.startRouter("0.0.0.0", 7732)
  • Runner performs the calculations, should contain function definitions. Connects to broker using broker's IP.
from harmoney import runners as run

def customFunction(arg1: int, arg2: str) -> str:
    return arg2*arg1

funcs = {"custFn": customFunction}

run.startRunner(funcs, "192.168.0.110", 7732)
  • Client is the main caller of functions. Will contain your main code.
from harmoney import client as cli

cli.Client("192.168.0.110", 7732)

retVal = cli.runSingle("custFn", arg1=10, arg2="arst")

print(retVal)

TODO:

  • Error catching, keeping the connection to the broker
  • Error info should return to the client

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

harmoney-0.2.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

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

harmoney-0.2.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file harmoney-0.2.0.tar.gz.

File metadata

  • Download URL: harmoney-0.2.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for harmoney-0.2.0.tar.gz
Algorithm Hash digest
SHA256 67fa0078054ec23a7f166cf00ee67e70b2e2a728c5e6a442dab0c38630024faf
MD5 c5a67b76ee2833d8b46d05f5b20ee2ce
BLAKE2b-256 4c488055e994b58be10383aae8e74087f3738cd8656f79f74f3bf85b1d9bd574

See more details on using hashes here.

File details

Details for the file harmoney-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: harmoney-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for harmoney-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d9fc15592658e2a4df2c3e384f979a028c56df3c6ab01786130d68937551aa8
MD5 68e165b03d85e28dcd825b2a60343f32
BLAKE2b-256 60f929cea7af1b0b8545db3646cb66743b4b6fb79399ff53b1461efb963c328a

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