update resource monitoring for multilib#1150
Conversation
📝 WalkthroughWalkthroughRefactored monitoring functions to remove Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pyphare/pyphare/simulator/monitoring.py (1)
64-69:⚠️ Potential issue | 🟡 Minor
FileNotFoundErroris unlikely fromPath.mkdir(parents=True, exist_ok=True).With
parents=Trueandexist_ok=True,mkdirwon't raiseFileNotFoundError. The realistic failure modes here arePermissionErrororOSError(e.g., read-only filesystem). Consider catching a broaderOSErrorinstead.Proposed fix
try: Path(".phare/timings").mkdir(parents=True, exist_ok=True) - except FileNotFoundError: + except OSError: logger.error(f"Couldn't find timing dir from {os.getcwd() }")
🤖 Fix all issues with AI agents
In `@pyphare/pyphare/simulator/simulator.py`:
- Around line 202-203: The current check uses isinstance(monitoring, int) which
treats True as an int (1); change the logic so boolean True/False are not
treated as numeric intervals: explicitly detect and skip booleans (e.g., if
isinstance(monitoring, int) and not isinstance(monitoring, bool) or
alternatively check isinstance(monitoring, bool) first), then set interval =
monitoring only for real ints, otherwise default to 100; update the line that
assigns interval and keep the subsequent mon.setup_monitoring(interval) call
unchanged so mon.setup_monitoring gets the correct default when monitoring is
True.
fix some oversights