Skip to main content

graphed-executors

Runners for graphed plans: the same analysis runs on your laptop's threads or processes, on a dask cluster, or on a parsl HTEX pool — you change the runner, not the analysis.

  • The answer doesn't depend on where you ran it. The order partial results are combined in is fixed up front, so your totals — even float histograms — come out bit-for-bit identical on 1 worker or 100, threads or a cluster.
  • One slow file can't stall the run. Every other part of the result keeps combining while a straggler finishes.
  • A failure on a worker comes back on your machine as the exception it was, pointing at the analysis line you wrote — not an opaque string from another process.

Install

pip install graphed-executors            # laptop runners; pulls graphed
pip install "graphed-executors[dask]"    # + the dask.distributed backend
pip install "graphed-executors[parsl]"   # + the parsl backend
pip install "graphed-executors[htcondor]" # + direct HTCondor pilot jobs (Linux)

Installing from source builds graphed's Rust core, so you need a Rust toolchain; a plain pip install from PyPI does not.

Your first run

A plan is your analysis packaged for a runner: process does one chunk's work, combine merges two partial results, empty is the starting value, and tasks lists the chunks. Here is a minimal hand-made plan so you can see the whole loop; the next block gets one from a real analysis instead:

import numpy as np
from graphed.core import Partition, Plan, Task
from graphed_executors import ProcessPoolExecutor

def count(partition, resources):          # module-level, so workers can import it
    return np.asarray([partition.entry_stop - partition.entry_start])

def add(a, b): return a + b
def zero():    return np.zeros(1, dtype=int)

parts = tuple(Partition("data", "", i * 100, (i + 1) * 100) for i in range(7))
plan  = Plan(process=count, combine=add, empty=zero,
             tasks=tuple(Task(i, p) for i, p in enumerate(parts)))

if __name__ == "__main__":
    result = ProcessPoolExecutor(workers=4).run(plan)
    print(result.value)                   # [700]

The same run, from a real analysis

You do not hand-build plans in practice. Fill a histogram with graphed-histogram and it exports one; the runner is the same call. Needs graphed-histogram and graphed[parquet]:

import awkward as ak
import boost_histogram as bh
import graphed_histogram as gh
from graphed import Session
from graphed.awkward import AwkwardBackend, from_parquet
from graphed_executors import ProcessPoolExecutor

if __name__ == "__main__":
    ak.to_parquet(ak.Array({"pt": [[40.0, 25.0], [55.0], [30.0, 60.0, 20.0],
                                   [80.0], [15.0, 45.0], [70.0, 10.0]]}), "events.parquet")

    session = Session(AwkwardBackend())
    events = from_parquet("events", "events.parquet", steps_per_file=3, session=session)

    h = gh.boost.Histogram(bh.axis.Regular(4, 0.0, 100.0), storage=bh.storage.Int64())
    h.fill(events.pt)                     # records the fill; nothing is read yet

    plan = gh.plan({"jet_pt": h})         # your analysis, packaged for a runner
    result = ProcessPoolExecutor(workers=4).run(plan)
    print(gh.unpack(result.value)["jet_pt"].values())   # [3 4 3 1]

Swap ProcessPoolExecutor for dask_runner(client) or parsl_runner(executor) and the rest of the program is untouched. If your output is not a histogram, graphed.aggregate_plan(*outputs, reduce=, combine=, empty=) exports a plan the same way from any deferred graphed arrays.

The one thing that's different

There is no .compute(). You build a plan (the Plan, Task, and Partition types live in graphed.core, not in this package) and hand it to a runner; run(plan) returns a result whose .value is the reduced answer. Plans from graphed_histogram.plan or graphed.aggregate_plan may use lambdas and functions from your script's __main__: they run on process pools and clusters as they are. A Plan you build yourself needs process/combine/empty the workers can import (module-level functions); a lambda there fails on a process pool with PicklingError and works on ThreadExecutor only.

Which runner do I want?

You are running on Use
One process, quick check, nothing picklable needed ThreadExecutor()
Your laptop, all cores ProcessPoolExecutor(workers=N)
A many-core machine where the worker count strains the open-file limit PinnedPoolExecutor
A dask cluster (local, dask-jobqueue, Kubernetes, …) dask_runner(client)
A parsl HTEX pool parsl_runner(executor)
An HTCondor pool (LPC, lxplus, your own) htcondor_runner(site=..., workers=N)

All of these, and graphed.core's SequentialRunner, import from the top level: from graphed_executors import ProcessPoolExecutor.

(import graphed_exec_local still works as a deprecated alias for graphed_executors.local; use graphed_executors in new code.)

TaskVine and direct Slurm submission aren't supported; use dask-jobqueue or parsl's providers to reach those batch systems.

On a dask cluster

Needs graphed-executors[dask]. Point it at any distributed.Client you already have and hand it the same plan from your first run:

from distributed import Client
from graphed_executors import dask_runner

if __name__ == "__main__":                    # needed when Client() spawns a local cluster
    client = Client(n_workers=2, dashboard_address=":0")  # or Client("tcp://scheduler:8786")
    runner = dask_runner(client)              # registers graphed's worker plugin on your client
    print(runner.run(plan).value)             # [700] — same plan, same answer
    runner.close()                            # your client stays open; close it yourself
    client.close()

An exception in your process runs once and reaches you straight away. For flaky I/O, opt in: dask_runner(client, retry_user_errors=2) gives each chunk two more tries in its worker. A worker that dies mid-task is retried by dask itself, up to its scheduler-wide distributed.scheduler.allowed-failures setting, and past that surfaces as an error naming the task and the worker address, not a hang.

On a parsl pool

Needs graphed-executors[parsl]. ParslRunner.local starts a pool on this machine and stops it when the block ends, however the block ends. Hand it the histogram h from the analysis above:

if __name__ == "__main__":
    from graphed_executors import ParslRunner

    with ParslRunner.local(workers=8) as runner:
        print(gh.unpack(runner.run(gh.plan({"jet_pt": h})).value)["jet_pt"].values())

A plan graphed builds carries its functions to the workers, so nothing needs to be on PYTHONPATH. A Plan you build yourself is different: HTEX workers are separate processes that do not inherit your sys.path, so its functions must live in a module they can import, not in your launch script:

# my_tasks.py — on the workers' PYTHONPATH, or part of an installed package
import numpy as np

def count(partition, resources):
    return np.asarray([partition.entry_stop - partition.entry_start])

def add(a, b):
    return a + b

def zero():
    return np.zeros(1, dtype=int)
from graphed.core import Partition, Plan, Task
import my_tasks

parts = tuple(Partition("data", "", i * 100, (i + 1) * 100) for i in range(7))
plan = Plan(process=my_tasks.count, combine=my_tasks.add, empty=my_tasks.zero,
            tasks=tuple(Task(i, p) for i, p in enumerate(parts)))

On a site, hand parsl_runner any started parsl HighThroughputExecutor (or ThreadPoolExecutor). You own that executor: closing the runner leaves it running. For a local pool with more settings, start_htex(workers=8, run_dir="runinfo", heartbeat_period=2) starts one and stop_htex stops its interchange, manager and worker processes within seconds:

if __name__ == "__main__":
    from graphed_executors import parsl_runner, start_htex, stop_htex

    htex = start_htex(workers=8, run_dir="runinfo", heartbeat_period=2)
    try:
        with parsl_runner(htex) as runner:
            print(runner.run(plan).value)
    finally:
        stop_htex(htex)

Two things bite people on HTEX:

  • Workers don't inherit your sys.path. For a hand-built Plan, export PYTHONPATH (or install your package) before starting the pool, so the workers can import my_tasks. A hand-built plan whose functions are defined in the launch script fails within seconds: AttributeError: count is defined in your launch script (__main__), which parsl workers cannot import.
  • A killed worker takes ~30 s to notice at parsl's default heartbeat. heartbeat_period=2 brings that to ~1.65 s, so a crash is reported (and the worker respawned) promptly.

Useful knobs

  • persistent=True keeps the process pool alive across run() calls — worth it in notebooks and parameter sweeps, where the spawn cost would otherwise repeat per plan. Use it as a context manager: with ProcessPoolExecutor(workers=4, persistent=True) as ex: and call ex.run(plan) once per plan inside.
  • Call resources.open_once(uri, opener) inside your process and the worker keeps that handle for its lifetime, so ten partitions of one file on one worker open it once instead of ten times. The dask backend gives you the same per-worker handle through its worker plugin.
  • run(plan, skip_failed=10) gives up only after 10 failed chunks. res.value merges the chunks that succeeded, res.failed lists the others, and the run warns with the count. One failure past the budget raises TooManyFailedChunksError. A plan with stop=StopCondition(max_errors=10) gets the same budget, through submit(plan) too. A lost worker ends the run with WorkerLostError despite the budget when the plan has next_tasks, or when dask blames a task that is no chunk (a combine, a broadcast, a service probe).
  • submit(plan), on every runner here, returns a concurrent.futures.Future straight away, so you can record and compile the next plan while this one runs; .result() is what run(plan) would have returned. Plans still run one at a time, in the order you submitted them.
  • A plan that calls a server (an inference server, say) declares it, and the cluster runners find it for each run: services={"triton": "grpc://host:8001"}, the site's, or one they start from the declared recipe and stop afterwards. See Services.
  • Every runner accepts monitor= — an observer that receives one event per task submitted, started, and finished, without changing the run — and a graphed.core.RunControl that pauses, resumes or cancels it. A cancelled run returns the merge of the tasks that finished.

graphed.debug.Dashboard gives you both in the browser: a live view of the run, and with control=True pause, resume and cancel buttons. It needs pip install "graphed[dashboard]". Using the plan from your first run:

from graphed.debug import Dashboard
from graphed_executors import ProcessPoolExecutor

if __name__ == "__main__":                    # a spawn pool re-imports this file
    with Dashboard(profile=True, control=True) as dash:
        print("open", dash.url)               # the page updates while the plan runs
        result = dash.attach(ProcessPoolExecutor(workers=4)).run(plan)
    print(result.value, result.stopped)       # [700] exhausted ("cancelled" after a cancel)

Next

  • How the executors work — why the answer is identical everywhere, what happens when a worker dies, and where your combines actually run on each runner.
  • The dask backend and the parsl backend in depth, including repartitioning and joins on a cluster.
  • graphed — build the analysis that produces a plan, and export it with graphed.aggregate_plan.
  • graphed-histogram — deferred histogram filling, and graphed_histogram.plan for the block above.
  • API reference.

Metadata

Release files for graphed-executors 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graphed-executors 0.0.8
File Size Uploaded Provenance Actions
graphed_executors-0.0.8.tar.gz 3.5 MB With provenance Details for graphed_executors-0.0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for graphed-executors 0.0.8
File Interpreter ABI Platform Actions
graphed_executors-0.0.8-py3-none-any.whl Python 3 none any Details for graphed_executors-0.0.8-py3-none-any.whl

Total release size: 3.8 MB

Release files / graphed_executors-0.0.8.tar.gz

Download URL graphed_executors-0.0.8.tar.gz
Size 3.5 MB
Tags Source
SHA-256 checksum
How to use checksums
1c8823417ba33cc48a343283dfcc3323ca320a40bab72d5bffd4e508ed441fef
BLAKE2b-256 checksum
How to use checksums
59b51fb26b0e7d4aa84c31ead7278738088e1c1626602db9664fd1e2e4601f60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / graphed_executors-0.0.8-py3-none-any.whl

Download URL graphed_executors-0.0.8-py3-none-any.whl
Size 266.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0892fc5733ad40cef9573001500de45f86e15613a3f5796688c4a708172ab9b
BLAKE2b-256 checksum
How to use checksums
a4570cae32b56d3232c5d079072fc97c1cfd1b503f74217059a22862d19d6973
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for graphed-executors 0.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for graphed_executors-0.0.8.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page