Skip to content
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

feat(agents-api): Add async boto client #911

Merged
merged 12 commits into from
Nov 29, 2024
Merged

feat(agents-api): Add async boto client #911

merged 12 commits into from
Nov 29, 2024

Conversation

Ahmad-mtos
Copy link
Contributor

@Ahmad-mtos Ahmad-mtos commented Nov 29, 2024

Important

Introduces async S3 client using aiobotocore, updates task execution workflows, and refines integration services in agents-api.

  • Async S3 Client:
    • Adds async_s3.py for async S3 operations using aiobotocore.
    • Replaces sync S3 operations with async in create_file.py, delete_file.py, and get_file.py.
    • Updates store_in_blob_store_if_large() and load_from_blob_store_if_remote() to async in storage_handler.py.
  • Task Execution:
    • Modifies TaskExecutionWorkflow in task_execution/__init__.py for async blob storage operations.
    • Updates prepare_for_step() in tasks.py for async input loading.
  • Integration Services:
    • Updates execute_integration.py and integration modules for async operations.
    • Removes unused Cloudinary and Ffmpeg integration definitions from Tools.py.
  • Dependencies:
    • Adds aiobotocore and async-lru to pyproject.toml.
    • Removes boto3 dependency from pyproject.toml.

This description was created by Ellipsis for c095f09. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to b82d159 in 1 minute and 17 seconds

More details
  • Looked at 1495 lines of code in 35 files
  • Skipped 1 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. integrations-service/gunicorn_conf.py:40
  • Draft comment:
    Duplicate import of os and redundant TESTING and DEBUG variable definitions. Remove the duplicate import and redundant variable definitions.
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.
2. integrations-service/integrations/utils/integrations/browserbase.py:25
  • Draft comment:
    Redundant comment: # Import env to access environment variables is repeated. Remove the duplicate comment.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR introduces async operations for S3 interactions, which is a good improvement. However, there are some redundant imports and duplicate code blocks that need to be addressed.
3. integrations-service/integrations/utils/integrations/llama_parse.py:10
  • Draft comment:
    Redundant comment: # Import env to access environment variables is repeated. Remove the duplicate comment.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR introduces async operations for S3 interactions, which is a good improvement. However, there are some redundant imports and duplicate code blocks that need to be addressed.
4. integrations-service/integrations/utils/integrations/spider.py:11
  • Draft comment:
    Redundant comment: # Import env to access environment variables is repeated. Remove the duplicate comment.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR introduces async operations for S3 interactions, which is a good improvement. However, there are some redundant imports and duplicate code blocks that need to be addressed.

Workflow ID: wflow_gvwgEBvR1huKJI6C


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Signed-off-by: Diwank Singh Tomer <[email protected]>
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on f6bf839 in 1 minute and 7 seconds

More details
  • Looked at 575 lines of code in 8 files
  • Skipped 1 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. agents-api/agents_api/common/protocol/remote.py:3
  • Draft comment:
    The RemoteList class has been removed, but there are still references to it in the codebase. Ensure all instances of RemoteList are replaced with standard Python lists and that the new implementation handles all previous use cases correctly.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. agents-api/agents_api/common/storage_handler.py:192
  • Draft comment:
    Ensure unload_return_value is awaited in async_wrapper to handle asynchronous operations correctly.
  • Reason this comment was not posted:
    Comment did not seem useful.
3. agents-api/pyproject.toml:55
  • Draft comment:
    Ensure all functionalities previously dependent on boto3 are now correctly handled by aiobotocore.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_YHDHl9UKdnMRmelU


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

agents-api/agents_api/common/storage_handler.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 14e4c3c in 1 minute and 12 seconds

More details
  • Looked at 221 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. agents-api/gunicorn_conf.py:4
  • Draft comment:
    Consider using the environs library for consistency in environment variable management.
from environs import Env

env = Env()
debug = env.bool("AGENTS_API_DEBUG", default=False)
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The change in gunicorn_conf.py to set workers to 1 in debug mode is a good practice for development environments. However, the use of os.getenv directly here is inconsistent with the rest of the codebase, which uses the environs library for environment variable management. This inconsistency can lead to confusion and potential errors if the environment variable management strategy changes in the future.
2. agents-api/agents_api/common/storage_handler.py:115
  • Draft comment:
    Remove the redundant await inside asyncio.gather.
                                            load_from_blob_store_if_remote(item)
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
3. agents-api/agents_api/env.py:36
  • Draft comment:
    Consider uncommenting and using environment variables for use_blob_store_for_temporal and blob_store_cutoff_kb to allow configurability.
use_blob_store_for_temporal: bool = env.bool("USE_BLOB_STORE_FOR_TEMPORAL", default=False) if not testing else False
blob_store_cutoff_kb: int = env.int("BLOB_STORE_CUTOFF_KB", default=64)
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The author has intentionally commented out the environment variable usage, which suggests they have a reason for using fixed values instead. The comment is suggesting a change that the author might have already considered and decided against. Without strong evidence that the change is necessary, the comment seems speculative.
    I might be missing the context of why the author commented out the environment variable usage. There could be a specific reason for this change that the comment does not address.
    The comment does not provide strong evidence or reasoning for why the environment variables should be used instead of the current implementation. It seems speculative and not actionable without further context.
    The comment should be deleted as it suggests a speculative change without strong evidence or reasoning. The author likely has a reason for the current implementation.

Workflow ID: wflow_wKDD1Pk0gH2gUS6h


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on a0ce527 in 34 seconds

More details
  • Looked at 48 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. integrations-service/gunicorn_conf.py:2
  • Draft comment:
    The import statement for os is duplicated. Please remove the redundant import on line 2.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The import statement for 'os' is duplicated, which is unnecessary and should be removed.

Workflow ID: wflow_k96VZKNk2emN5KDs


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 73b9321 in 26 seconds

More details
  • Looked at 55 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. agents-api/agents_api/common/storage_handler.py:70
  • Draft comment:
    Consider using kwargs.keys() and kwargs.values() directly instead of list(zip(*kwargs.items())) or ([], []) for better readability and efficiency.
kwargs_keys, kwargs_values = kwargs.keys(), kwargs.values()
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of list(zip(*kwargs.items())) or ([], []) is a workaround to handle empty dictionaries. However, it can be simplified by using kwargs.keys() and kwargs.values() directly, which are more readable and efficient.
2. agents-api/agents_api/common/storage_handler.py:90
  • Draft comment:
    Consider using arg.keys() and arg.values() directly instead of list(zip(*arg.items())) or ([], []) for better readability and efficiency.
keys, values = arg.keys(), arg.values()
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The same issue with list(zip(*arg.items())) or ([], []) appears multiple times in the code. It should be addressed in all instances for consistency and efficiency.
3. agents-api/agents_api/common/storage_handler.py:141
  • Draft comment:
    Consider using v.keys() and v.values() directly instead of list(zip(*v.items())) or ([], []) for better readability and efficiency.
keys, values = v.keys(), v.values()
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The same issue with list(zip(*v.items())) or ([], []) appears multiple times in the code. It should be addressed in all instances for consistency and efficiency.

Workflow ID: wflow_CAY1HUFt7dAatVS1


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Signed-off-by: Diwank Singh Tomer <[email protected]>
@creatorrr creatorrr merged commit b72c3f0 into dev Nov 29, 2024
13 of 17 checks passed
@creatorrr creatorrr deleted the f/async_boto3 branch November 29, 2024 11:51
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on c095f09 in 32 seconds

More details
  • Looked at 140 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. integrations-service/integrations/autogen/Tools.py:12
  • Draft comment:
    The PR description mentions removing unused Cloudinary and Ffmpeg integration definitions from Tools.py, but these changes are not visible in the diff. Please ensure these definitions are removed if they are indeed unused.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_p2L2lmQItQEIddr9


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

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