Skip to content

Add bounded preprocessing capacity and task identity - #22

Merged
Tanmaypatil123 merged 2 commits into
ModelsLab:mainfrom
RohanGudur:bounded-preprocessing
Nov 5, 2026
Merged

Tanmaypatil123 merged 2 commits into
ModelsLab:mainfrom
RohanGudur:bounded-preprocessing

Conversation

@RohanGudur

@RohanGudur RohanGudur commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

When preprocessing runs ahead of execution, prepared jobs can accumulate in the queue. This PR adds an optional max_prepared_tasks setting to cap the combined number of jobs being prepared and jobs ready for execution.

ModelQ checks capacity and claims a job in a single Redis operation so concurrent preprocessors enforce the same limit. When capacity is full, jobs wait in the preprocessing queue until a slot opens. Jobs already executing are excluded from the count. Callers that omit the setting keep the existing behavior.

This PR also exposes get_task_id() during preprocessing and execution. Applications can use it to associate prepared resources with the same queue task across both stages.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@Tanmaypatil123
Tanmaypatil123 merged commit bf5a1b7 into ModelsLab:main Nov 5, 2026
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