Skip to content

Add script to export unique local_run_dir values to CSV#53

Merged
grdumas merged 2 commits into
mainfrom
feat/export-local-run-dirs
Jun 16, 2026
Merged

Add script to export unique local_run_dir values to CSV#53
grdumas merged 2 commits into
mainfrom
feat/export-local-run-dirs

Conversation

@grdumas

@grdumas grdumas commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

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

  • Script successfully connects to production OpenSearch
  • Script extracts all unique test_configuration.parameters.local_run_dir values
  • Script outputs results to a CSV file
  • Script handles errors gracefully (connection failures, missing fields, etc.)

Technical Approach

  • Uses OpenSearch terms aggregation API for efficient querying without scanning all documents
  • Supports both CLI arguments (--url, --username, --password) and config file (config/export_config.yml)
  • Follows the same CLI pattern as opensearch_backup.py for consistency
  • Exports to CSV with two columns: local_run_dir and doc_count
  • Includes comprehensive error handling for connection failures and empty results

Changes

  • Added scripts/export_local_run_dirs.py - Main script with CLI interface
  • Added tests/test_export_local_run_dirs.py - Unit tests for CLI and export functionality
  • 7 new tests covering CLI args, config file handling, query execution, and error cases

Testing

  • Unit tests added/updated (7 new tests)
  • All tests passing (313 total tests)
  • Manual testing completed against OpenSearch instance

Usage Examples

Using config file:

./scripts/export_local_run_dirs.py --config config/export_config.yml --output local_run_dirs.csv

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.csv

With custom index:

./scripts/export_local_run_dirs.py --config config/export_config.yml \
    --index custom-index --output results.csv

Agent VM added 2 commits June 16, 2026 00:41
- 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
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@grdumas, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 0c724b0d-9bb3-4c4d-9b70-ce7fb6427074

📥 Commits

Reviewing files that changed from the base of the PR and between 5d5fa22 and 2d7367a.

📒 Files selected for processing (2)
  • scripts/export_local_run_dirs.py
  • tests/test_export_local_run_dirs.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@grdumas grdumas self-assigned this Jun 16, 2026
@grdumas grdumas added the enhancement New feature or request label Jun 16, 2026

@grdumas grdumas left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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
    Using sys.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 how opensearch_backup.py likely behaves. No action needed.

Positive Notes

  • Query Efficiency: Using the terms aggregation aggs.unique_local_run_dirs.terms with size: 0 is the perfect way to extract this data efficiently without pulling down actual document hits.
  • Consistent CLI: Matching the CLI argument structure of opensearch_backup.py ensures 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

@grdumas grdumas merged commit d4c9790 into main Jun 16, 2026
2 checks passed
@grdumas grdumas deleted the feat/export-local-run-dirs branch June 16, 2026 04:48
@grdumas grdumas restored the feat/export-local-run-dirs branch June 16, 2026 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant