Skip to content

feat: Add max concurrency limit, create shared GentraceWarning abstraction#335

Merged
viveknair merged 5 commits intonextfrom
vivek/gt-1799-implement-concurrent-execution-in-eval_dataset-tests
Jul 8, 2025
Merged

feat: Add max concurrency limit, create shared GentraceWarning abstraction#335
viveknair merged 5 commits intonextfrom
vivek/gt-1799-implement-concurrent-execution-in-eval_dataset-tests

Conversation

@viveknair
Copy link
Copy Markdown
Contributor

@viveknair viveknair commented Jul 7, 2025

TLDR

Adds max concurrency control for parallel execution in eval_dataset tests

Summary

This PR introduces concurrency limiting functionality to control the number of parallel tasks that can run simultaneously during dataset evaluation. It adds a new max_concurrency parameter and implements a thread pool singleton for managing both async and sync task execution.

Key Changes

  • Added max_concurrency parameter to eval_dataset() function
  • Created new concurrency.py module with ThreadPoolSingleton class
  • Implemented thread pool management with configurable worker limits
  • Added support for dynamic thread pool resizing
  • Set up proper cleanup with thread pool shutdown

Impact

  • eval_dataset function signature modified to accept concurrency limit
  • New concurrency utilities module added to the library
  • Example code updated to demonstrate usage with max_concurrency=1

Testing Considerations

  • Test concurrent execution with various max_concurrency values
  • Verify thread pool properly limits concurrent executions
  • Ensure thread pool cleanup on shutdown/exit
  • Test thread pool resizing when max_workers is changed
  • Validate context propagation in threaded execution

@linear
Copy link
Copy Markdown

linear bot commented Jul 7, 2025

@viveknair viveknair changed the title chore: Add thread pool cleanup on exit feat: Add max concurrency limit Jul 7, 2025
@viveknair viveknair force-pushed the vivek/gt-1799-implement-concurrent-execution-in-eval_dataset-tests branch from ce152bb to 6bc2a05 Compare July 8, 2025 01:10
@viveknair viveknair changed the title feat: Add max concurrency limit feat: Add max concurrency limit, create shared GentraceWarning abstraction Jul 8, 2025
@viveknair viveknair marked this pull request as ready for review July 8, 2025 01:51
@viveknair viveknair requested a review from joshlebed July 8, 2025 01:52
Copy link
Copy Markdown
Collaborator

@joshlebed joshlebed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@viveknair viveknair merged commit 821e852 into next Jul 8, 2025
8 checks passed
@stainless-app stainless-app bot mentioned this pull request Jul 8, 2025
viveknair pushed a commit that referenced this pull request Jul 8, 2025
* feat: Add max concurrency limit, create shared GentraceWarning abstraction (#335)

* feat: Add concurrency management for eval_dataset

* fix: Update max_concurrency to 30 in eval_dataset_simple file

* feat: Add async concurrency control for interaction functions

* chore: refactor warning display for better readability

* chore: Add line break before warning panel

* release: 1.0.0-alpha.12

---------

Co-authored-by: Vivek Nair <vivek@gentrace.ai>
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
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.

2 participants