Skip to content

Use python to implement the cleanup directive#1625

Open
linsword13 wants to merge 1 commit into
GoogleCloudPlatform:developfrom
linsword13:better-cleanup
Open

Use python to implement the cleanup directive#1625
linsword13 wants to merge 1 commit into
GoogleCloudPlatform:developfrom
linsword13:better-cleanup

Conversation

@linsword13

Copy link
Copy Markdown
Member

Previously the cleanup directive was implemented using find with the posix-extended support. This makes it not very portable for various platforms. Piggybacking on the work done in #1559, it now uses python to implement the cleanup.

This assumes that python3 is more widely available, for the platforms we aim to support.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request replaces the platform-dependent find command used in cleanup directives with a cross-platform Python-based cleaner utility script (_ramble_cleaner.py). The feedback highlights a potential runtime failure where the cleaner script is incorrectly guarded by the generate_file_editing_scripts configuration, meaning it won't be written if that config is disabled. Additionally, suggestions were made to simplify the cleaner script by using re.fullmatch and removing an unused is_dir flag in the file deletion loop.

Comment thread lib/ramble/ramble/workspace/workspace.py
Comment thread lib/ramble/ramble/util/cleaner.py Outdated
Comment thread lib/ramble/ramble/util/cleaner.py
Previously the `cleanup` directive was implemented using `find` with the `posix-extended` support. This makes it not very portable for various platforms. Piggybacking on the work done in GoogleCloudPlatform#1559, it now uses python to implement the cleanup.

This assumes that `python3` is more widely available, for the platforms we aim to support.
@ramble-pr-bot

ramble-pr-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

Ramble Performance Test Metrics

Results produced with commit: a3432b1

Test Name Outcome Duration (s) Most Recent Run (s) Last 5 Avg (s)
test_analyze_large_file passed 2.9898 2.9922 (013099b) 2.9973
test_large_template_expansion passed 2.4079 2.1188 (013099b) 2.1363
test_many_experiments passed 36.1022 32.2892 (013099b) 33.2663
test_many_objects_defaults passed 20.0070 18.3797 (013099b) 18.4377
test_matrix_filter_perf passed 1.6943 1.5916 (013099b) 1.6218

@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.02%. Comparing base (013099b) to head (a3432b1).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1625   +/-   ##
========================================
  Coverage    93.02%   93.02%           
========================================
  Files          348      349    +1     
  Lines        33858    33862    +4     
========================================
+ Hits         31497    31501    +4     
  Misses        2361     2361           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant