Skip to content

Add progress indicator for long-running model methods #705

@bixu

Description

@bixu

Problem

When a model method iterates over many resources (e.g., 60 VMs), the CLI shows no output until the entire method completes. With sequential execution at ~6s per item, this means waiting several minutes with no feedback. Even with batched concurrency (PR #29), methods that touch dozens of resources still take 30-60s with zero visibility.

Proposed Solution

Add a progress indicator that surfaces method execution progress in real-time. Two complementary approaches:

  1. Stream context.logger output during execution — model methods already log per-item progress (e.g., "checking VM 15/60"), but these logs are only shown after the method completes in --json mode. Streaming them to stderr in real-time would give immediate feedback.

  2. Built-in progress API — provide a context.progress(current, total, message?) method that models can call to report progress. The CLI would render this as a progress bar or counter (e.g., [15/60] Checking VMs...).

Alternatives Considered

  • Models could write partial results incrementally, but writeResource is per-item and the CLI still waits for the method to return.
  • Users can watch swamp data list in another terminal, but this is awkward.

Implementation Notes

  • Streaming logs to stderr would be a quick win and backward-compatible
  • The progress API would need a new method on the execution context
  • Both should work in --json mode (stderr for progress, stdout for final JSON)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestexternalAn issue raised by an external contributor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions