-
Notifications
You must be signed in to change notification settings - Fork 315
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
Add resource limiter #366
base: main
Are you sure you want to change the base?
Add resource limiter #366
Conversation
The above feature has been implemented. |
return result | ||
|
||
|
||
if __name__ == "__main__": |
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.
It is better to move this into examples
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.
It is better to move this into
examples
It looks like the examples only contain the multi-agent application instead of the function utils example.
queue_key = f"resources_queue_for_{class_name}" | ||
|
||
request_id = str(uuid.uuid4()) # Use UUID for unique request IDs | ||
redis_client.lpush(queue_key, request_id) |
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.
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.
Add resource limiter module
Description
This PR adds a resource limiter module that limits the number of concurrent executions of a function based on available resources using Redis.
Changes
resource_limiter.py
which includes theresources_limit
decorator and helper functions.How to test
REDIS_HOST
,REDIS_PORT
, andREDIS_DB
environment variables.Notes
redis
libraries, ensure they are installed in your environment.Checklist
Please check the following items before code is ready to be reviewed.