Skip to content
Launch Platform

Distributed Python on a GPU cluster

To run Python across an Eugo GPU cluster, connect your EugoLab notebook to the cluster, then decorate plain functions and classes with @eugo.hpc.distribute: functions become tasks and classes become actors, and both run on the cluster's nodes. To scale pandas or NumPy data, pass it through eugo.hpc.data (Ray Data), which splits it into batches and processes them in parallel. This page walks through all three, with a pandas DataFrame as the worked example.

Applies to: the EugoLab image, November 2026.

A notebook that sends work to your cluster in five steps: connect, run a function as many parallel tasks, keep state in an actor, process a pandas DataFrame batch by batch with Ray Data, and, optionally, reserve a GPU for a task. A last section reads data from cloud storage.

  • A workspace in EugoLab.
  • A running cluster in the Eugo HPC Clusters panel. For the optional GPU step, the cluster needs a General Purpose GPUs (ECU-G) worker pool; Cluster settings lists each size's CPUs, memory and GPUs.

pandas, NumPy, PyTorch and CuPy are installed in the image, so the examples need no installs.

Step 1: Connect the notebook to the cluster

Section titled “Step 1: Connect the notebook to the cluster”

Connect first. Without Connect, the first call that runs work (.remote(...), eugo.hpc.put, eugo.hpc.get or a Ray Data call) starts a private local Ray inside the notebook instead of using the cluster.

  1. In EugoLab, open a new notebook.

  2. In the Eugo HPC Clusters panel, on your cluster's card, in the Notebook tab, select Connect this notebook. EugoLab gives the notebook's kernel the cluster's token without showing it, then adds and runs this cell:

    import eugo.hpc
    eugo.hpc.init(address="ray://<head>:10001");

    The card now offers Disconnect where Connect this notebook was.

The notebook is now a Ray Client driver. Your Python code runs in EugoLab, and only tasks, actors and Ray Data work run on the cluster. In a notebook cell, localhost is the EugoLab container, not a cluster node.

@eugo.hpc.distribute turns a function into a task. Call it with .remote(...) to get a reference at once, and use eugo.hpc.get to wait for one reference or a list of them.

  1. Define the function and submit it over a list:

    import numpy as np
    @eugo.hpc.distribute
    def norm_of_random(seed, n=1_000_000):
    rng = np.random.default_rng(seed)
    return float(np.linalg.norm(rng.standard_normal(n)))
    refs = [norm_of_random.remote(seed) for seed in range(32)]
    results = eugo.hpc.get(refs) # waits once; results in the same order as refs
    print([round(r) for r in results[:4]])
    [1001, 998, 1000, 1000]

Submit every task before you call eugo.hpc.get. A get inside the loop makes the tasks run one at a time; Running tasks in parallel explains why.

To change a task's options for one call, use .options(...), for example norm_of_random.options(num_cpus=2).remote(0).

@eugo.hpc.distribute on a class makes an actor: one process on the cluster that keeps its state between calls.

  1. Define the class, create one actor, and call its methods:

    @eugo.hpc.distribute
    class RunningStats:
    def __init__(self):
    self.count = 0
    self.total = 0.0
    def add(self, values):
    self.count += len(values)
    self.total += float(np.sum(values))
    return self.count
    def mean(self):
    return self.total / self.count
    stats = RunningStats.remote()
    eugo.hpc.get([stats.add.remote(np.arange(i, i + 10)) for i in range(0, 100, 10)])
    print(eugo.hpc.get(stats.mean.remote()))
    49.5

Step 4: Process a pandas DataFrame with Ray Data

Section titled “Step 4: Process a pandas DataFrame with Ray Data”

Ray Data is eugo.hpc.data. It is an attribute of eugo.hpc, not a module, so write import eugo.hpc and use eugo.hpc.data; import eugo.hpc.data raises ModuleNotFoundError.

The round trip is eugo.hpc.data.from_pandas(df), then map_batches(...) for vectorised pandas or NumPy work (or map(...) for row by row), then to_pandas().

Over a connected notebook, run the Ray Data pipeline inside a task, not directly in the notebook: some Ray Data calls, such as .take() and .to_pandas(), fail when made straight from a connected notebook. Tasks and actors themselves are fine to call from the notebook.

  1. Define the batch function and a task that runs the pipeline:

    import pandas as pd
    def add_total(batch: pd.DataFrame) -> pd.DataFrame:
    batch["total"] = batch["price"] * batch["quantity"]
    return batch
    @eugo.hpc.distribute
    def run_pipeline(df):
    ds = eugo.hpc.data.from_pandas(df)
    ds = ds.map_batches(add_total, batch_format="pandas")
    return ds.to_pandas()
  2. Build a DataFrame in the notebook and run the task:

    df = pd.DataFrame({
    "price": np.random.uniform(1, 100, 100_000),
    "quantity": np.random.randint(1, 10, 100_000),
    })
    result = eugo.hpc.get(run_pipeline.remote(df))
    print(result.shape, list(result.columns))
    (100000, 3) ['price', 'quantity', 'total']

batch_format sets what your function receives:

  • "default" or "numpy": Dict[str, numpy.ndarray].
  • "pandas": pandas.DataFrame.
  • "pyarrow": pyarrow.Table.
  • None: the block's own format.

By default (zero_copy_batch=True) a batch may be a read-only view. If your function must change a batch in place and cannot copy it, pass zero_copy_batch=False and Ray Data copies the whole batch for you.

For how much memory a Ray Data job uses, and what happens when data does not fit, see Memory for distributed jobs.

Step 5 (optional): Reserve a GPU for a task

Section titled “Step 5 (optional): Reserve a GPU for a task”

num_gpus=1 reserves one GPU for a task or actor, and the task sees that GPU as device 0. Inside the task, do the GPU work with a GPU library such as PyTorch or CuPy.

  1. Ask a GPU task which GPU it got:

    @eugo.hpc.distribute(num_gpus=1)
    def gpu_name():
    import torch
    return torch.cuda.get_device_name(0)
    print(eugo.hpc.get(gpu_name.remote()))

    The cell prints the name of the GPU on the node the task ran on. If no GPU is free, the task waits until one is.

Leave accelerator_type unset. Some upstream examples set accelerator_type="A10G", a GPU that Eugo's worker pools do not have, so work that asks for it never starts.

Running PyTorch on the GPU in Eugo covers PyTorch itself.

Reading data from S3, Google Cloud Storage or Azure

Section titled “Reading data from S3, Google Cloud Storage or Azure”

Ray Data reads s3:// paths directly. For Google Cloud Storage and Azure Blob Storage, create an fsspec filesystem, gcsfs.GCSFileSystem or adlfs.AzureBlobFileSystem (both installed in the image), and pass it to the read call's filesystem= argument. As with every Ray Data call from a connected notebook, do the read inside a task.

  1. Read from S3:

    @eugo.hpc.distribute
    def read_s3():
    ds = eugo.hpc.data.read_csv("s3://anonymous@ray-example-data/iris.csv")
    return ds.take(1)
    print(eugo.hpc.get(read_s3.remote()))
    [{'sepal length (cm)': 5.1, 'sepal width (cm)': 3.5, 'petal length (cm)': 1.4, 'petal width (cm)': 0.2, 'target': 0}]
  2. Read from Google Cloud Storage, passing a gcsfs filesystem:

    @eugo.hpc.distribute
    def read_gcs():
    import gcsfs
    fs = gcsfs.GCSFileSystem(token="anon") # a public bucket; see below for your own
    ds = eugo.hpc.data.read_csv(
    "gs://cloud-samples-data/bigquery/us-states/us-states.csv",
    filesystem=fs,
    )
    return ds.take(2)
    print(eugo.hpc.get(read_gcs.remote()))
    [{'name': 'Alabama', 'post_abbr': 'AL'}, {'name': 'Alaska', 'post_abbr': 'AK'}]
  3. Read from Azure Blob Storage, passing an adlfs filesystem and an abfs://<container>/<path> path:

    @eugo.hpc.distribute
    def read_azure():
    import adlfs
    fs = adlfs.AzureBlobFileSystem(account_name="<storage account>", anon=True)
    ds = eugo.hpc.data.read_parquet("abfs://<container>/<path>/", filesystem=fs)
    return ds.take(1)
    print(eugo.hpc.get(read_azure.remote()))

For a private bucket or container, give the filesystem your credentials instead of the anonymous settings: for example gcsfs.GCSFileSystem(token="<path to a service account key file>"), or adlfs.AzureBlobFileSystem(account_name=..., sas_token=...). The gcsfs and adlfs documentation lists every way to sign in. Ray Data's Loading Data guide lists the formats it reads.

Error: TypeError: Remote functions cannot be called directly

Section titled “Error: TypeError: Remote functions cannot be called directly”

The full message reads: Remote functions cannot be called directly. Instead of running '__main__.square()', try '__main__.square.remote()'., with your function's name in place of square.

Cause: you called a function decorated with @eugo.hpc.distribute like a plain function.

Fix:

  1. Call it with .remote(...).
  2. Pass the result to eugo.hpc.get to wait for the value.

Reading a gs:// or abfs:// path fails with ArrowNotImplementedError

Section titled “Reading a gs:// or abfs:// path fails with ArrowNotImplementedError”

Cause: a gs:// or abfs:// path was read with no filesystem= argument.

Fix:

  1. Create a gcsfs.GCSFileSystem or adlfs.AzureBlobFileSystem.
  2. Pass it to the read call as filesystem=, as in Reading data from S3, Google Cloud Storage or Azure.

This notebook is already running Ray, started by a cell rather than through Connect

Section titled “This notebook is already running Ray, started by a cell rather than through Connect”

Cause: a cell ran work before you connected, so the notebook started its own Ray. The cluster card offers Disconnect instead of Connect this notebook, with this message as its tooltip.

Fix:

  1. Stop the notebook's own Ray: on the cluster card, select Disconnect, or restart the notebook's kernel.
  2. On the cluster card, in the Notebook tab, select Connect this notebook.
  3. Run your cells again.

My work ran in the notebook, not on the cluster

Section titled “My work ran in the notebook, not on the cluster”

Cause: the notebook was not connected, so the first call that ran work started a private local Ray.

Fix:

  1. Stop the notebook's own Ray: on the cluster card, select Disconnect, or restart the notebook's kernel.
  2. On the cluster card, in the Notebook tab, select Connect this notebook.
  3. Run your cells again.

Error: eugo.hpc.use_auth_token_file: cannot use the Ray token file

Section titled “Error: eugo.hpc.use_auth_token_file: cannot use the Ray token file”

The full message names the file and ends in "it does not exist", "it is a folder, not a file" or "this process is not allowed to read it".

Cause: the connect code was copied before an update, or before the lab restarted.

Fix:

  1. On the cluster card, in the Notebook tab, select Copy code.
  2. Paste the code into the notebook and run it. If the notebook is already connected, run eugo.hpc.shutdown() first.
  • Connect the notebook first, so work runs on the cluster.
  • @eugo.hpc.distribute makes functions into tasks and classes into actors; submit everything, then call eugo.hpc.get once.
  • eugo.hpc.data scales pandas and NumPy work with from_pandas, map_batches and to_pandas; from a connected notebook, run it inside a task.
  • num_gpus=1 reserves one GPU for a task or actor.
  • Read Google Cloud Storage and Azure by passing a gcsfs or adlfs filesystem as filesystem=.

© 2026 Eugo Inc. · Third-party licenses · LinkedIn (opens in new tab) · YouTube (opens in new tab) · GitHub (opens in new tab)