SciDx Remote Execution

Rexec is a broker-mediated framework for executing Python code from Jupyter Notebooks or scripts on remote HPC and cloud compute resources, without requiring users to manage the remote environment.

Overview

SciDx Remote Execution (Rexec) is a broker-mediated remote code execution system built on ZeroMQ. It allows end users to submit Python workloads from a local Jupyter Notebook or script, route them through a central broker, and have them executed on dedicated per-user server pods running in a remote Kubernetes cluster.

Rexec integrates with the National Data Platform (NDP) Endpoint, which provides dataset discovery, authentication, and the address of the Server Deploy API. They provide a remote computation platform for scientific workflows.

How It Works
Client
ndp_ep[rexec] Python library
Transport
ZeroMQ, through a central broker
Execution
Dedicated per-user server pods on Kubernetes
Provisioning
Server Deploy API (FastAPI)
Integration
NDP Endpoint API (FastAPI)
Authentication
Bearer token through Keycloak
Rexec system architecture diagram

The architecture diagram could not be loaded. See the Architecture page.

Figure 1. Rexec system architecture. The client library obtains the Server Deploy API address from the NDP Endpoint API, requests a per-user server pod and the broker address from the Deploy API, and then exchanges function calls and results with that pod through the broker. A detailed description is available on the Architecture page.

Documentation by Role

The documentation is organized for three audiences. Select the guide that corresponds to your role.

RoleWho it's forWhat the guide covers
End User
User Guide
Researchers and data scientists who execute Python workloads on remote clusters through an NDP Endpoint, without managing the underlying infrastructure.
  • Installation of ndp_ep[rexec]
  • Authentication with a Bearer token
  • Job submission from a local Jupyter environment
NDP Provider / Sysadmin
Sysadmin Guide
Operators of Kubernetes clusters who provide remote execution capability to the users of an NDP Endpoint.
  • Deployment of the broker, Deploy API, and EP API
  • Installation of all three services with a single Helm chart
  • Configuration of authentication and group-based access control
Developer
Developer Guide
Contributors who study the system internals, modify existing components, or extend Rexec with new capabilities.
  • Local development with editable installs
  • Overview of the source repositories
  • ZeroMQ broker and FastAPI service architecture

Server-Side Components

The following three services are deployed together with a single Helm chart and together implement the remote execution pipeline. See the Helm Chart reference for configuration details.

ComponentRoleRepository
Rexec Broker
ZeroMQ
A stateless ZeroMQ proxy that routes messages between many clients and many server pods. Exposes a client-facing NodePort (30001) and an internal ClusterIP for server pods. sci-ndp/SciDx-rexec-broker ↗
Rexec Server Deploy API
FastAPI
A FastAPI service that provisions and tears down per-user rexec-server pods in Kubernetes. Accepts Bearer token auth and supports group-based access control. sci-ndp/rexec-server-k8s-deployment-api ↗
NDP Endpoint API
FastAPI
The NDP Endpoint API providing dataset search, authentication, and the Rexec spawn API address to clients. Supports CKAN, MongoDB, Kafka, S3, Pelican, and JupyterLab integrations. national-data-platform/ep-api ↗

Quick Start

The following example assumes access to an NDP Endpoint with remote execution enabled. Install the client library, connect to the endpoint, and submit a function for remote execution.

pip install ndp_ep[rexec]
from ndp_ep import APIClient, remote_func

client = APIClient(
    base_url="https://ndp-endpoint.example.org/api",
    token="<your-bearer-token>"
)

client.setup_rexec_environment(requirements="input_requirements.txt")

@remote_func
def collatz_steps(n: int) -> int:
    steps = 0
    while n != 1:
        n = n // 2 if n % 2 == 0 else 3 * n + 1
        steps += 1
    return steps

result = collatz_steps(27)
print(f"collatz_steps(27) = {result}")
  1. Installs the NDP Endpoint library with Rexec support.
  2. Connects to an NDP Endpoint.
  3. Provisions the remote environment with your requirements.
  4. Runs the function on your Rexec server and returns 111.