Skip to content

Callback for progress updates when batching #1430

@alexreg

Description

@alexreg

What is your feature request?

Any function that takes performs batching on results and automatically aggregates them (i.e., one that takes the container_size parameter) could benefit from firing a caller-specified callback function, which can be used for example to display progress updates to the user. This is particularly useful for calling e.g. section.searchTracks() and similar, which could potentially return many thousands of results.

Are there any workarounds?

None that I'm aware of.

Code Snippets

def show_progress(n_received: int: n_total: Optional[int]) -> None:
    # Note: `n_total` may not always be available (sometimes `None`)
    print(f"Received {n_received} / {n_total} items so far")

section.searchTracks(batch_callback=show_progress)

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions