Multinode - Rapidly build distributed cloud applications in Python | Product Hunt

Cloud compute made simple

Asynchronous workflows, distributed processing and APIs - all in a single Python codebase

or our Discord

Introduction

Introduction

Multinode lets you rapidly build distributed cloud applications of arbitrary complexity with an experience equivalent to working in a local Python environment.

No more complex AWS infrastructure. No more redundant IAM roles and security groups. No more splitting code across Docker images at the expense of its logical integrity.

Teaser

Suppose you want to calculate sum of the squares of all the integers from 1 to 10. A simple implementation would look like this:

def square(x):
    return x ** 2

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

squares = [square(x) for x in numbers]
sum_of_squares = sum(squares)
print(sum_of_squares)  # 385

But what if you want to distribute this calculation across 10 machines? This would be a nightmare! You would have to write Kubernetes manifests, split the code across several Docker images, and get into the weeds of cloud permissions.

In multinode, all you need to do is add an annotation to the square function.

import multinode as mn

@mn.function(cpu=1, memory="1GiB")
def square(x):
    # Runs on the cloud
    return x ** 2

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

# Distributed across 10 workers, which are provisioned on demand
squares = square.map(numbers)

# Runs locally
sum_of_squares = sum(squares)
print(sum_of_squares)  # 385

And what if you want to serve this calculation as an API? No problem!

# main.py

import multinode as mn
from fastapi import FastAPI
import uvicorn

@mn.function(cpu=1, memory="1GiB")
def square(x):
    return x ** 2

app = FastAPI()

@app.get("/sum_of_squares")
def get_sum_of_squares(upper_bound: int):
    # Distributed across separate dynamically-provisioned workers
    squares = square.map(range(upper_bound))
    sum_of_squares = sum(squares)
    return {"answer": sum_of_squares}

# Serves API on the cloud, with resiliency and autoscaling
@mn.service(max_replicas=4, target_cpu_utilization=0.5)
def serve_api():
    uvicorn.run(app)

With a single command, you can deploy your API into multinode's hosted cloud environment.

multinode deploy main.py

A distributed application, served to the internet, in just 15 lines of code!

Features

That was a very basic example of multinode's capabilities. Using the full power of the framework, you can:

  • Distribute your code across multiple machines with a single annotation.
  • Spawn long-running jobs, and monitor their progress in real-time.
  • Run scheduled tasks and background processes that keep the state of your application up to date.
  • Expose your distributed application via an API, with security and resiliency taken care of.
  • Request the right resources for your compute, and manage the autoscaling.
  • Deploy your application into multinode's hosted cloud environment without setting up any infrastructure.
  • Manage the lifecycle of your deployed application in production.