-
Notifications
You must be signed in to change notification settings - Fork 89
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
fix: Fixes faulty logging format and sets up error logging in dynamic… #412
Conversation
WalkthroughThe pull request introduces logging functionality to the Changes
Sequence DiagramsequenceDiagram
participant Code as Application Code
participant Logging as Logging Module
participant Handler as Stream Handler
Code->>Logging: Call setup_logging()
Logging->>Logging: Configure log level
Logging->>Handler: Create stream handler
Logging->>Handler: Set log format
Logging-->>Code: Logging configured
Poem
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: 2
🔭 Outside diff range comments (1)
examples/python/dynamic_steps_example.py (1)
Formatting issues confirmed in the example file
The following formatting issues need to be addressed:
- Remove consecutive blank lines between job definitions (e.g., lines 71-72)
- Fix indentation in the main block after line 190
- Remove trailing whitespace at line 192
- Maintain consistent spacing between code blocks
🔗 Analysis chain
Line range hint
1-192
: Fix formatting issues.The pipeline reports that files need to be reformatted according to Ruff standards.
Run the following command to fix the formatting:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check which files in the current PR need reformatting rg -l '(def setup_logging|if __name__ == "__main__")' | xargs ruff format --diffLength of output: 121
Script:
#!/bin/bash # Check the formatting of the specific file echo "=== File content with line numbers ===" cat -n examples/python/dynamic_steps_example.py echo -e "\n=== Function definitions and spacing ===" ast-grep --pattern 'def $_($$$) { $$$ }'Length of output: 8123
🧹 Nitpick comments (1)
examples/python/dynamic_steps_example.py (1)
Line range hint
173-190
: Add logging statements to track step execution.The main function performs multiple steps but lacks logging statements to track their execution and potential failures.
async def main(enable_steps): + logger = logging.getLogger(__name__) + # Step 1: Reset data and system state if enable_steps.get("prune_data"): + logger.info("Starting data pruning...") await cognee.prune.prune_data() - print("Data pruned.") + logger.info("Data pruning completed.") if enable_steps.get("prune_system"): + logger.info("Starting system pruning...") await cognee.prune.prune_system(metadata=True) - print("System pruned.") + logger.info("System pruning completed.") # Step 2: Add text if enable_steps.get("add_text"): + logger.info("Starting text addition...") text_list = [job_1, job_2, job_3, job_4, job_5] for text in text_list: + logger.debug(f"Adding text: {text[:35]}...") await cognee.add(text) - print(f"Added text: {text[:35]}...") + logger.info("Text addition completed.") # Step 3: Create knowledge graph if enable_steps.get("cognify"): + logger.info("Starting knowledge graph creation...") await cognee.cognify() - print("Knowledge graph created.") + logger.info("Knowledge graph creation completed.") # Step 4: Query insights if enable_steps.get("retriever"): + logger.info("Starting insight retrieval...") results = await brute_force_triplet_search('Who has the most experience with graphic design?') + logger.info("Insight retrieval completed.") print(format_triplets(results))
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
cognee/shared/utils.py
(2 hunks)examples/python/dynamic_steps_example.py
(2 hunks)
🧰 Additional context used
🪛 GitHub Actions: ruff format
cognee/shared/utils.py
[error] 308 files require reformatting according to Ruff standards. Run Ruff formatter to fix formatting issues.
🔇 Additional comments (2)
cognee/shared/utils.py (1)
15-16
: LGTM!The imports are correctly placed and necessary for the logging functionality.
🧰 Tools
🪛 GitHub Actions: ruff format
[error] 308 files require reformatting according to Ruff standards. Run Ruff formatter to fix formatting issues.
examples/python/dynamic_steps_example.py (1)
3-3
: LGTM!The imports are correctly placed and necessary for the logging functionality.
Also applies to: 6-6
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.
works on my side!
… steps example
Summary by CodeRabbit
New Features
Documentation