Skip to content

Add optional progress reporting via ProgressQueue#14

Merged
PaulDL-RS merged 6 commits intoPaulDL-RS:mainfrom
zfsguy:feature/progress-queue
Mar 16, 2026
Merged

Add optional progress reporting via ProgressQueue#14
PaulDL-RS merged 6 commits intoPaulDL-RS:mainfrom
zfsguy:feature/progress-queue

Conversation

@zfsguy
Copy link
Copy Markdown
Contributor

@zfsguy zfsguy commented Mar 10, 2026

Exposes sparrow's existing SolutionListener mechanism to Python via a new ProgressQueue class and ReportType enum.

When passed to solve(), the queue collects (ReportType, strip_width, density) tuples that can be drained from another thread for progress bars, logging, or monitoring. ReportType mirrors sparrow's 5 report variants (ExplFeas, ExplInfeas, ExplImproving, CmprFeas, Final), with a phase_name() convenience method for grouped labels.

solve() works exactly as before when no queue is passed.

queue = spyrrow.ProgressQueue()
result = [None]

def run():
    result[0] = instance.solve(config, progress=queue)

thread = threading.Thread(target=run)
thread.start()
while thread.is_alive():
    for report_type, strip_width, density in queue.drain():
        print(f"{report_type.phase_name()}: width={strip_width:.1f}, density={density:.1%}")
    thread.join(timeout=0.5)

solution = result[0]

@PaulDL-RS
Copy link
Copy Markdown
Owner

I can't look at your Pull Request today, i will looked into it tommorow.
Due to some unrelated issue, I need to release a fix as 0.8.4 today. I guess your PR will be 0.8.5

@zfsguy
Copy link
Copy Markdown
Contributor Author

zfsguy commented Mar 11, 2026 via email

@zfsguy zfsguy force-pushed the feature/progress-queue branch from 6fcd5cf to 7cb2ff0 Compare March 11, 2026 08:51
@JeroenGar
Copy link
Copy Markdown
Contributor

Hi @zfsguy,

I like the idea and think this is a value contribution.
Is there a specific reason you do not also include a full solution into your progress messages?

When I look at the custom ProgressListener you wrote, it seems you almost have everything in place to support this.
You already export a solution out of jagua-rs, so passing it along should not be to hard?

@PaulDL-RS
Copy link
Copy Markdown
Owner

I reviewed was is now implemented. It's good. I will wait until you decide about Jeroen suggestion by either implementing it or postponing it and then I will merge.

@zfsguy
Copy link
Copy Markdown
Contributor Author

zfsguy commented Mar 14, 2026

@JeroenGar - Good suggestion. drain() now returns (ReportType, StripPackingSolution) tuples with the full solution including placed items.

@PaulDL-RS PaulDL-RS merged commit b7675b8 into PaulDL-RS:main Mar 16, 2026
18 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.

3 participants