-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: add default params to run_tasks #563
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
Conversation
WalkthroughThis update modifies the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant run_tasks
participant run_tasks_base
participant Logger
participant Telemetry
Client->>run_tasks: call run_tasks(tasks, [optional parameters])
run_tasks->>run_tasks: assign default values if parameters are missing
run_tasks->>run_tasks: generate pipeline_id using uuid5
run_tasks->>Logger: log event
run_tasks->>Telemetry: record telemetry
run_tasks->>run_tasks_base: delegate execution with parameters
run_tasks_base-->>run_tasks: return results
run_tasks-->>Client: return final outcome
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
⏰ Context from checks skipped due to timeout of 90000ms (27)
🔇 Additional comments (5)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
cognee/modules/pipelines/operations/run_tasks.py(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (18)
- GitHub Check: run_notebook_test / test
- GitHub Check: run_notebook_test / test
- GitHub Check: Test on macos-15
- GitHub Check: Test on macos-15
- GitHub Check: Test on macos-13
- GitHub Check: Test on macos-13
- GitHub Check: Test on ubuntu-22.04
- GitHub Check: Test on ubuntu-22.04
- GitHub Check: Test on macos-15
- GitHub Check: run_notebook_test / test
- GitHub Check: Test on macos-13
- GitHub Check: Test on ubuntu-22.04
- GitHub Check: run_notebook_test / test
- GitHub Check: test
- GitHub Check: test
- GitHub Check: test
- GitHub Check: windows-latest
- GitHub Check: docker-compose-test
🔇 Additional comments (1)
cognee/modules/pipelines/operations/run_tasks.py (1)
4-4: LGTM!The addition of
uuid4import is necessary and correctly placed to support the default value for thedataset_idparameter.
| async def run_tasks( | ||
| tasks: list[Task], | ||
| dataset_id: UUID = uuid4(), | ||
| data: Any = None, | ||
| pipeline_name: str = "unknown_pipeline", | ||
| ): |
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.
Fix the default value for dataset_id to avoid shared UUIDs.
While adding default parameters aligns with the PR objectives and improves usability, there's a potential issue with the dataset_id default value. Using uuid4() directly will evaluate at module import time, causing all calls without an explicit dataset_id to share the same UUID.
Apply this diff to use a factory pattern instead:
async def run_tasks(
tasks: list[Task],
- dataset_id: UUID = uuid4(),
+ dataset_id: UUID | None = None,
data: Any = None,
pipeline_name: str = "unknown_pipeline",
):
+ if dataset_id is None:
+ dataset_id = uuid4()This ensures that each call gets a unique UUID when dataset_id is not provided.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| async def run_tasks( | |
| tasks: list[Task], | |
| dataset_id: UUID = uuid4(), | |
| data: Any = None, | |
| pipeline_name: str = "unknown_pipeline", | |
| ): | |
| async def run_tasks( | |
| tasks: list[Task], | |
| dataset_id: UUID | None = None, | |
| data: Any = None, | |
| pipeline_name: str = "unknown_pipeline", | |
| ): | |
| if dataset_id is None: | |
| dataset_id = uuid4() | |
| # ... (rest of the function body) |
Description
DCO Affirmation
I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin
Summary by CodeRabbit
New Features
Bug Fixes
retrieved_edges_to_stringfunction to ensure proper execution flow in various components.Documentation