Skip to main content

Dynamic MapReduce framework for data processing

Project description

DDR - Dynamic MapReduce Framework

A flexible framework for distributed data processing using MapReduce patterns.

Installation

Prerequisites

This project requires Python 3.13+ and uses conda for dependency management. We recommend using the provided environment.yml file to create a consistent development environment.

Setting up the Conda Environment

The project includes an environment.yml file with the following dependencies:

name: ddr
channels:
  - conda-forge
dependencies:
  - coffea=>2025.3.0
  - fsspec-xrootd=>0.5.1
  - ndcctools>=7.15.8
  - python=>3.12
  - rich=>13.9.4
  - uproot=>5.6.0
  - xrootd=>5.8.1
  - setuptools<81
  1. Create the conda environment from the provided environment.yml file:

    conda env create -f environment.yml
    
  2. Activate the environment:

    conda activate ddr
    
  3. Verify the installation:

    python --version  # Should show Python 3.13.2
    conda list | grep -E "(coffea|ndcctools)"  # Should show the installed packages
    

From PyPI

pip install dynamic_data_reduction

Installing from Source

Once you have the conda environment set up:

# Clone the repository
git clone https://github.com/cooperative-computing-lab/dynamic_data_reduction.git
cd dynamic_data_reduction

# Activate the conda environment (if not already active)
conda activate ddr

# Install the package in development mode
pip install -e .

Quick Start

Minimal toy example to get started:

from dynamic_data_reduction import DynamicDataReduction
import ndcctools.taskvine as vine
import getpass

# Simple data: process two datasets
data = {
    "datasets": {
        "numbers": {"values": [1, 2, 3, 4, 5]},
        "more_numbers": {"values": [10, 20, 30]}
    }
}

# Define functions
def preprocess(dataset_info, **kwargs):
    for val in dataset_info["values"]:
        yield (val, 1)

def postprocess(val, **kwargs):
    return val  # Just return the value

def processor(x):
    return x * 2  # Double each number

def reducer(a, b):
    return a + b  # Sum the results

# Run
mgr = vine.Manager(port=[9123, 9129], name=f"{getpass.getuser()}-quick-start-ddr")
print(f"Manager started on port {mgr.port}")
ddr = DynamicDataReduction(mgr,
                           data=data,
                           source_preprocess=preprocess, 
                           source_postprocess=postprocess,
                           processors=processor, 
                           accumulator=reducer)

# Use local workers, condor, slurm, or sge for scale
workers = vine.Factory("local", manager=mgr)
workers.max_workers = 2
workers.min_workers = 0
workers.cores = 4
workers.memory = 2000
workers.disk = 8000
with workers:
    result = ddr.compute()

print(f"Result: {result}")  # Expected: (1+2+3+4+5)*2 + (10+20+30)*2 = 150

Usage

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dynamic_data_reduction-2025.12.1.tar.gz (34.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dynamic_data_reduction-2025.12.1-py3-none-any.whl (32.2 kB view details)

Uploaded Python 3

File details

Details for the file dynamic_data_reduction-2025.12.1.tar.gz.

File metadata

File hashes

Hashes for dynamic_data_reduction-2025.12.1.tar.gz
Algorithm Hash digest
SHA256 f2c085afa2284a6527ece2d64b8d2bd12696668117808a02d2e33c554ebdbac8
MD5 caa3b8d479336e2d08b501b166907bed
BLAKE2b-256 7a1e93a85da16f1b5744380eb126bb00bbe4593e96bfcbbf97267b0808498345

See more details on using hashes here.

File details

Details for the file dynamic_data_reduction-2025.12.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dynamic_data_reduction-2025.12.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e008ed90f37f7b31e5a7cb1ba5b8d0a416b73cfb50cf13393c81a7456042b433
MD5 1b83b076646b58567ba24166401daeba
BLAKE2b-256 99b8b8812463b9d6be848c9fe372324ad8d1d50c1b383fac882ec924b00fa598

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page