Add script to export unique local_run_dir values to CSV#53
Conversation
- Add test for CLI argument handling - Add test for config file + CLI arg override - Add test for OpenSearch aggregation query - Add test for CSV export with unique local_run_dir values - Add test for empty results handling - Add test for connection error handling Part of manual work: export local_run_dir values to CSV
- Implement script to extract unique local_run_dir values from OpenSearch - Use terms aggregation for efficient querying without scanning all docs - Support both CLI args and config/export_config.yml - Export results to CSV with local_run_dir and doc_count columns - Handle connection errors and empty results gracefully - Follow same CLI pattern as opensearch_backup.py for consistency Implements manual work: export local_run_dir values to CSV
|
Warning Review limit reached
More reviews will be available in 41 minutes and 32 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
grdumas
left a comment
There was a problem hiding this comment.
PR Review: Add script to export unique local_run_dir values to CSV
Summary
This PR introduces a very useful utility script (export_local_run_dirs.py) to query the OpenSearch index and extract unique local_run_dir configurations into a CSV. It uses aggregations efficiently and follows established CLI patterns.
Critical Issues (MUST FIX)
None found.
Security Delta
None found.
Major Issues (SHOULD FIX)
None found.
Minor Issues (NICE TO HAVE)
None found.
Nitpicks (OPTIONAL)
- File: scripts/export_local_run_dirs.py:31
Usingsys.path.insert(0, str(Path(__file__).parent))is a bit brittle, but it is acceptable for scripts in this type of directory layout and matches howopensearch_backup.pylikely behaves. No action needed.
Positive Notes
- Query Efficiency: Using the terms aggregation
aggs.unique_local_run_dirs.termswithsize: 0is the perfect way to extract this data efficiently without pulling down actual document hits. - Consistent CLI: Matching the CLI argument structure of
opensearch_backup.pyensures a cohesive user experience across tools. - Comprehensive Testing: The 7 new tests do an excellent job covering the configuration resolution logic (CLI vs config file) and the query/export process, including connection errors and empty states.
Overall Assessment
- Status: APPROVE
- Reasoning: The script fulfills all acceptance criteria perfectly. The code is well-structured, error handling is robust, and the test suite verifies all critical paths. All tests pass successfully.
- Next Steps: Ready to merge.
Reviewed by: Gemini Pro via automated code review
Summary
Implements a script to extract all unique test_configuration.parameters.local_run_dir values from the production OpenSearch instance and export them to a CSV file.
Acceptance Criteria
test_configuration.parameters.local_run_dirvaluesTechnical Approach
Changes
scripts/export_local_run_dirs.py- Main script with CLI interfacetests/test_export_local_run_dirs.py- Unit tests for CLI and export functionalityTesting
Usage Examples
Using config file:
Using CLI arguments:
./scripts/export_local_run_dirs.py --url https://osv3.app.intlab.redhat.com \ --username user --password pass --no-verify-ssl --output local_run_dirs.csvWith custom index:
./scripts/export_local_run_dirs.py --config config/export_config.yml \ --index custom-index --output results.csv