Skip to main content

Batch Runner

BatchRunner is a client-side orchestration helper for submitting many energy model runs and waiting for all of them to complete. It wraps client.energy_models.create() for submission and client.tasks.get() for lightweight status polling.

When to Use

Use BatchRunner when you need to run multiple energy models (e.g. different sites, tracker vs fixed comparisons, sensitivity sweeps) and want to avoid writing your own submit/poll loop. For a single run, use client.energy_models.create() and client.tasks.get() directly — see Usage Patterns.

Quick Start

Constructor

Methods

submit

Submit a single async energy model run. Returns the API response dict containing task_id, energy_model_id, and run_index.

submit_many

Submit multiple runs at once. Returns the number of successfully submitted runs. Failed submissions are logged and skipped.

poll

Poll GET /tasks/{task_id} for each non-terminal run and update statuses in-place. Returns a tuple of (completed, failed, pending) counts.

wait

Block until all runs reach a terminal status or timeout elapses. Returns True if all runs finished, False if timed out.

summary

Returns a summary dict with the current batch state:

results

Fetches full energy model data via GET /energymodels/{id} for every completed run. Returns a list of dicts:
results() makes one API call per completed run. Call it after wait() completes to avoid fetching partial results.

Properties

Logging

BatchRunner uses Python’s logging module (logger name: dalysdk.batch). To see progress output: