Documentation

Architecture

Lithops is designed to provide a unified interface for executing functions across different cloud providers. The architecture consists of the following components:

Client

The client is responsible for orchestrating the execution of functions. It handles the serialization of functions and data, scheduling, and result collection.

Executor

The executor is the main interface for users. It provides methods for executing functions synchronously or asynchronously, and for collecting results.

Worker

Workers are the compute units that execute the functions. They can be serverless functions, containers, or virtual machines, depending on the backend.

Function Executor

The FunctionExecutor is the main interface for executing functions with Lithops. It provides methods for executing functions synchronously or asynchronously, and for collecting results.

from lithops import FunctionExecutor

def my_function(x):
    return x * x

# Create a FunctionExecutor
with FunctionExecutor() as executor:
    # Execute the function asynchronously
    future = executor.call_async(my_function, 4)
    # Get the result
    result = future.result()
    print(result)  # Prints: 16
    
    # Execute the function in parallel
    futures = executor.map(my_function, range(10))
    # Get all results
    results = executor.get_result()
    print(results)  # Prints: [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

For the complete documentation, please visit our GitHub repository:

View on GitHub