-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User interface for @batched
#2065
Conversation
…dal-client into cathy/batching-integration
…dal-client into cathy/batching-integration
…dal-client into cathy/batch_user_interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a drive-by review with a few comments. There's a lot going on in this PR! Could potentially be easier to discuss with more atomic changes, although I appreciate that this is a complex feature and that it's helpful to test the live code on your branch!
modal/partial_function.py
Outdated
max_batch_size: int, | ||
max_wait_ms: int, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it ever make sense to leave this unset? e.g. to say "I always want batches of size n
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case the function might block forever. Now we have a upper limit of 10 minutes, would it be better to just let the user set it to 10 minutes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the thorough tests. This looks great!
Describe your changes
Enable batching in modal functions and class methods.
Backward/forward compatibility checks
Check these boxes or delete any item (or this section) if not relevant for this PR.
Note on protobuf: protobuf message changes in one place may have impact to
multiple entities (client, server, worker, database). See points above.
Changelog
Added support for dynamic batching. Functions or class methods decorated with
@modal.batched
will now automatically batch their invocations together, up to a specifiedmax_batch_size
. The batch will wait for a maximum ofwait_ms
for more invocations after the first invocation is made. See guide for more details.The batched function is called with individual inputs: