Skip to content

Dev v0.1.3#2

Merged
sibocw merged 18 commits into
mainfrom
dev-v0.1.3
Jun 19, 2026
Merged

Dev v0.1.3#2
sibocw merged 18 commits into
mainfrom
dev-v0.1.3

Conversation

@sibocw

@sibocw sibocw commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator
  • More efficient frame drawing: get rid of PNG layer and use raw buffer (no PNG encoding/decoding)
  • CI workflows
  • Doc site

sibocw and others added 18 commits June 18, 2026 22:40
The example scripts were relocated from src/parallel_animate/examples/ to a
top-level examples/ directory, but test_examples.py still imported them as a
subpackage, breaking test collection. Import them by module name from the
examples/ dir instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The producer filled a bounded task queue and only checked worker exit codes
after the enqueue loop finished. If a worker died mid-run (e.g. update() raised),
it stopped draining the queue; once full, task_queue.put() blocked forever and
the error was never surfaced. Real workloads (more frames than queue capacity)
would hang indefinitely on any worker exception.

Enqueue via _put_or_abort, which puts with a timeout and, whenever the queue
stays full, checks worker liveness — tearing down survivors and raising
RuntimeError instead of blocking. Add a watchdog-guarded regression test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Previously each frame was savefig'd to a PNG (zlib compression), written to
disk, then read back and decoded by pvio before H.264 encoding — a full
compress/disk/decompress cycle per frame purely to hand frames between
processes. PNG encoding is CPU-heavy and often dominates render time.

Grab pixels straight from the Agg canvas buffer as raw RGB, persist them as
uncompressed .npy frames, and stream them lazily to pvio.write_frames_to_video,
eliminating the PNG encode/decode entirely. Frames are loaded on demand so peak
memory stays bounded. savefig_params now meaningfully supports only dpi (the
buffer grab can't honour e.g. bbox_inches); documented accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Clarify in the Animator docstring that every frame is fully rasterised and that
matplotlib blitting is deliberately not used (frames render independently, in
separate processes under parallel mode), so speedups come from concurrency, not
incremental redraws. Guides users to push frame-invariant work into setup().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Frame validation only tracked IndexedFrameParams ids, so a positional
(enumerate) index colliding with an explicit frame_id — or any repeated index —
silently overwrote an earlier frame's file. Validate the final index of every
frame (positional or explicit) against a seen-set and raise ValueError on any
duplicate.

Also wrap the parallel producer loop so any error raised once workers are
running (the new validation error, or a worker crash) tears the workers down via
_abort_workers rather than leaving them blocked on the queue as orphans.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add guidance to the Animator docstring (and a pointer from the worker) that
instance attributes are serialised once per worker in parallel mode, so heavy
per-frame data should travel via param_by_frame or be built lazily in setup()
rather than stashed on self.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Extract the IndexedFrameParams unwrap + duplicate-index validation, which was
  copy-pasted between the serial and parallel render loops, into a shared
  _resolved_frames generator so the two paths can't drift.
- Resolve disable_progress_bar=None to a concrete bool via stderr TTY detection
  up front, so tqdm and pvio agree: off a TTY both stay quiet, instead of pvio
  always printing progress into non-interactive logs. Update the affected test.
- Replace the stale 'Convert param_by_frame to list' comment (the code only
  probes len()) and note preload_factor's memory tradeoff in the docstring.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add parallel and serial tests for VideoFrameAnimation, exercising the
IndexedFrameParams out-of-order path and generator-based param_by_frame
with explicit n_frames, which the other example tests do not cover.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The usage snippet used a {"phase": ...} key, but the referenced
nondeterministic_video_loader.py example passes {"frame": ...}. Match
the example so the docs and code tell the same story.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sibocw sibocw merged commit 84db767 into main Jun 19, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant