Skip to content

Quickstart

griot-cloud.github.io • November 24, 2026

In this example, you will create a Parquet dataset of 500,000 product reviews, write a function that gives each review a score, and run it inside a 1 GiB memory budget. Moruna reads the reviews in pieces, runs your function on each, and writes the scored reviews to a new dataset.

You need Python 3.14 on Linux (x86-64) or macOS (Apple silicon). The example takes a minute.

This also installs pyarrow , which Moruna uses to pass data to your functions. Check that it works:

Moruna runs Python functions in parallel on the free-threaded build of Python 3.14, often installed as python3.14t . On the standard build, Python runs one thread at a time, and Moruna asks you to confirm by passing allow_gil=True to moruna.run . The example works on either build.

2. Create some data #

Create an empty directory and move into it. Save the following as make_data.py :

3. Write a function and run it #

A function receives a batch of rows as a pyarrow.RecordBatch and returns a batch. This one counts the positive words in each review and adds the result as a new score column. Save the following as score.py :

If you are using the standard build of Python, add allow_gil=True after budget="1GiB", . Then run the job:

moruna.run returns when the job is finished, and printing the report gives a summary:

The job completed in under a second. At its highest, the whole Python process used 52% of its 1 GiB budget. Moruna divided the data into 20 morsels and chose their size by measuring how much memory score used on the first one. Your figures will differ with your machine.

The same values are available as attributes, for example report.peak_fraction_of_ceiling and report.tasks[1]["rows_out"] . See The run report for every field.

5. Check the output #

The scored reviews are Parquet files in reviews-scored/ :

To run this job over your own data, change the source and sink paths. Moruna also reads and writes s3:// , gs:// and az:// URLs; see Object storage for the storage argument they need. The budget can stay the same whatever the size of the input: a larger dataset takes longer, not more memory.

Extracted Entities

Platforms (2)

Tools (2)