Skip to content

Fix regex in benchmarks cpu/disk_on_idle (BugFix)#2487

Open
bladernr wants to merge 6 commits intomainfrom
2477-invalid-escape-char-in-benchmarks_idle_tests
Open

Fix regex in benchmarks cpu/disk_on_idle (BugFix)#2487
bladernr wants to merge 6 commits intomainfrom
2477-invalid-escape-char-in-benchmarks_idle_tests

Conversation

@bladernr
Copy link
Copy Markdown
Collaborator

@bladernr bladernr commented Apr 21, 2026

Description

Resolved issues

Resolves #2477
Resolves CHECKBOX-2238

Documentation

NA

Tests

Tested on a fresh Bionic install to verify rawstrings does work back that far:

u@bionic-tester:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04 LTS
Release:        18.04
Codename:       bionic
u@bionic-tester:~$ python3 --version
Python 3.6.5
u@bionic-tester:~$ iostat -x -m 1 10 | python3 -c 'import sys, re; lines="".join(sys.stdin.readlines()); l=[float(n) for n in (re.findall(r"idle\n.*?(\S+)\n", lines))]; print(sum(l)/len(l),"%")'
99.787 %
u@bionic-tester:~$ iostat -x -m 1 10 | python3 -c 'import sys, re; lines="".join(sys.stdin.readlines()); l=[float(n) for n in (re.findall(r"util\n.*?(\S+)\n", lines))]; print(sum(l)/len(l),"%")'
0.013000000000000001 %

For comparison, this is Resolute where the initial warnings appeared for me, showing before and after:

bladernr@resolute-test:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu Resolute Raccoon (development branch)
Release:        26.04
Codename:       resolute
bladernr@resolute-test:~$ python3 --version
Python 3.14.4
bladernr@resolute-test:~$ iostat -x -m 1 10 | python3 -c 'import sys, re; lines="".join(sys.stdin.readlines()); l=[float(n) for n in (re.findall("idle\n.*?(\S+)\n", lines))]; print(sum(l)/len(l),"%")'
<string>:1: SyntaxWarning: "\S" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\S"? A raw string is also an option.
98.978 %
bladernr@resolute-test:~$ iostat -x -m 1 10 | python3 -c 'import sys, re; lines="".join(sys.stdin.readlines()); l=[float(n) for n in (re.findall(r"idle\n.*?(\S+)\n", lines))]; print(sum(l)/len(l),"%")'
98.829 %
bladernr@resolute-test:~$ iostat -x -m 1 10 | python3 -c 'import sys, re; lines="".join(sys.stdin.readlines()); l=[float(n) for n in (re.findall("util\n.*?(\S+)\n", lines))]; print(sum(l)/len(l),"%")'
<string>:1: SyntaxWarning: "\S" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\S"? A raw string is also an option.
0.0 %
bladernr@resolute-test:~$ iostat -x -m 1 10 | python3 -c 'import sys, re; lines="".join(sys.stdin.readlines()); l=[float(n) for n in (re.findall(r"util\n.*?(\S+)\n", lines))]; print(sum(l)/len(l),"%")'
0.0 %

 * for disk_on_idle and cpu_on_idle, fix regex to resolve warning about invalid escape char in newer python3 versions.
   (older Python3 just silently passed it)
 * Also added CLAUDE.md to gitignore to avoid accidentally pulling in Claude instructions when making commits. Fixes #2477
@bladernr bladernr linked an issue Apr 21, 2026 that may be closed by this pull request
1 task
@bladernr bladernr requested review from Copilot and gntzio and removed request for Copilot April 21, 2026 13:53
@bladernr bladernr changed the title (BugFix) fix regex in benchmarks cpu/disk_on_idle Fix regex in benchmarks cpu/disk_on_idle (BugFix) Apr 21, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes Python SyntaxWarning noise in benchmark jobs by making the regex patterns raw strings (so \S is treated as a regex escape rather than an invalid Python string escape), and prevents accidental commits of local Claude instruction files.

Changes:

  • Update benchmarks/system/cpu_on_idle and benchmarks/system/disk_on_idle commands to use raw-string regex patterns in re.findall(...).
  • Add CLAUDE.md to .gitignore.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
providers/base/units/benchmarks/jobs.pxu Uses raw-string regex literals in two benchmark job commands to eliminate invalid-escape warnings on newer Python versions.
.gitignore Ignores CLAUDE.md to avoid committing local tooling instructions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.93%. Comparing base (12822cf) to head (766b01a).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2487      +/-   ##
==========================================
+ Coverage   58.91%   58.93%   +0.01%     
==========================================
  Files         476      477       +1     
  Lines       48011    48034      +23     
  Branches     8569     8571       +2     
==========================================
+ Hits        28286    28309      +23     
+ Misses      18833    18830       -3     
- Partials      892      895       +3     
Flag Coverage Δ
provider-base 34.19% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

Comment thread providers/base/units/benchmarks/jobs.pxu Outdated
…pt, add unit tests, and update the job descriptions accordingly
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread providers/base/tests/test_iostat_benchmark.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fernando79513 fernando79513 self-assigned this Apr 27, 2026
@bladernr bladernr requested a review from fernando79513 April 27, 2026 19:03
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.

Invalid escape char in benchmarks/system/disk_on_idle and cpu_on_idle

3 participants