How dvorobiev/copeer works
Purpose and entry points
Copeer is a Python CLI for migrating large media archives across multiple destination disks. It copies files in parallel and packages detected image sequences (.dpx, .exr, .tif) into destination-side TAR archives. Primary entry points are copeer.py for the full migration workflow, copeer_lite.py for a reduced variant, and copeer_auditor.py for post-run recovery and verification.
Main migration orchestration
copeer.py owns the interactive end-to-end run: parse CLI options, load or create runtime configuration, build a copy plan, display it for confirmation, execute work, and persist operational records. It supports two input boundaries: a CSV manifest or recursive source-directory scanning. copeer.py is the authoritative full-featured execution path.
Planning and source normalization
The planner converts either manifest rows or discovered filesystem objects into transferable units. Regular files become copy tasks; recognized frame sequences are grouped and represented as TAR-producing tasks. This stage establishes source-relative paths and destination layout before any writes, allowing dry-run plan generation and operator approval. Relevant implementation: copeer.py, copeer_lite.py.
Multi-disk destination allocation
Destination mount points, destination root, capacity threshold, and worker count are configuration-driven. Tasks are assigned across disks using an improved round-robin strategy with a priority pool, while disk usage is monitored to avoid filling targets beyond the configured threshold. This is the principal infrastructure boundary: local or mounted source storage is read, while multiple mounted destination volumes receive copies and archives. Relevant implementation: copeer.py.
Concurrent transfer and archive execution
The execution engine uses ThreadPoolExecutor to process independent tasks concurrently. File transfer delegates to rsync, including per-file live progress parsing for the terminal dashboard. Sequence tasks create TAR archives directly at the chosen destination rather than first copying individual frames. Task failures are counted and recorded rather than repeatedly printed into the UI. Relevant implementation: copeer.py; external runtime dependency: rsync.
Interactive observability and resumability
The full runner provides a rich terminal UI showing the proposed plan, aggregate progress, per-transfer rsync progress, worker/disk association, disk fill state, and error counts. Persistent mapping and state CSVs form the resume boundary: already completed work can be skipped after interruption. Dry runs write their mapping to a separate dry_run_mapping.csv, avoiding contamination of production mapping records. Relevant implementation: copeer.py.
Audit and recovery pipeline
copeer_auditor.py consumes artifacts from migration runs rather than performing transfers. Its merge command consolidates multiple mapping CSVs and removes duplicates; analyze compares an original input list against copier state to generate a retry manifest; verify checks that mapped destination paths physically exist and emits a missing-path log. The generated retry CSV feeds back into copeer.py, closing the recovery loop. Relevant implementation: copeer_auditor.py, copeer.py.
Runtime and dependencies
The repository is a Python command-line tool managed with uv-style project metadata and requirements. It relies on terminal capabilities supplied by rich, OS filesystem/mount semantics, Python threading, and the external rsync executable. Dependency declarations are in requirements.txt; project metadata is in pvproject.toml.
Main entry points: copeer.py Concurrent executor · copeer_auditor.py Auditor CLI · copeer_lite.py Lite migration CLI
Components 21
CLI entry points
- Full migration CLI · Authoritative interactive migration workflow.
copeer.py - Lite migration CLI · Reduced planning and migration variant.
copeer_lite.py - Auditor CLI · Merge, analyze, and verify recovery artifacts.
copeer_auditor.py - Runtime dependencies · Declares Python dependencies including rich.
requirements.txt - Project metadata
pvproject.toml
Migration workflow
- Runtime configuration · Defines mounts, root, capacity threshold, and workers.
copeer.py - CSV manifest
copeer.py - Source directory scan
copeer.py - Copy planner · Normalizes inputs into destination-aware transferable tasks.
copeer.py - Copy and TAR tasks · Files copy directly; image sequences become TAR tasks.
copeer.py - Plan review and dry run · Displays the plan for approval before writes.
copeer.py
Storage and execution
- Multi-disk allocator · Assigns tasks using capacity-aware round robin.
copeer.py - Concurrent executor · Runs independent tasks across configured workers.
copeer.py - rsync · Copies files and supplies live transfer progress.
- Destination volumes · Multiple disks receive copied files and TAR archives.
- Rich terminal dashboard · Shows plan, progress, disk state, and failures.
copeer.py - Mapping and state CSVs · Resume boundary for completed work; dry runs use separate mapping.
copeer.py
Audit and recovery
- Merge mappings · Consolidates mapping CSVs and removes duplicates.
copeer_auditor.py - Analyze retry work · Compares original input against copier state.
copeer_auditor.py - Retry manifest · Feeds failed or incomplete work back to migration.
copeer_auditor.py - Verify destinations · Checks mapped destination paths and logs missing paths.
copeer_auditor.py
Connections 26
- Full migration CLI → Runtime configuration: loads or creates
- Full migration CLI → CSV manifest: accepts
- Full migration CLI → Source directory scan: scans
- Lite migration CLI → Copy planner: uses
- CSV manifest → Copy planner: normalizes
- Source directory scan → Copy planner: normalizes
- Copy planner → Copy and TAR tasks: builds
- Copy and TAR tasks → Plan review and dry run: proposes
- Plan review and dry run → Multi-disk allocator: approved tasks
- Runtime configuration → Multi-disk allocator: capacity and mounts
- Multi-disk allocator → Concurrent executor: assigned tasks
- Concurrent executor → rsync: file copies
- Concurrent executor → Destination volumes: writes TAR archives
- rsync → Destination volumes: writes files
- Concurrent executor → Mapping and state CSVs: records outcomes
- Mapping and state CSVs → Copy planner: skips completed work
- Concurrent executor → Rich terminal dashboard: reports progress
- Multi-disk allocator → Rich terminal dashboard: reports disk state
- Auditor CLI → Merge mappings: merge command
- Auditor CLI → Analyze retry work: analyze command
- Auditor CLI → Verify destinations: verify command
- Mapping and state CSVs → Merge mappings: mapping inputs
- Mapping and state CSVs → Analyze retry work: copier state
- Analyze retry work → Retry manifest: generates
- Retry manifest → Full migration CLI: retries through
- Mapping and state CSVs → Verify destinations: mapped paths