Skip to content

Simulator setup / init inconsistency #993#1057

Merged
PhilipDeegan merged 1 commit intoPHAREHUB:masterfrom
PhilipDeegan:simpy
Jul 22, 2025
Merged

Simulator setup / init inconsistency #993#1057
PhilipDeegan merged 1 commit intoPHAREHUB:masterfrom
PhilipDeegan:simpy

Conversation

@PhilipDeegan
Copy link
Member

closes #993

@coderabbitai
Copy link

coderabbitai bot commented Jul 21, 2025

Warning

Rate limit exceeded

@PhilipDeegan has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 37 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 2c6242d and 9269ee7.

📒 Files selected for processing (1)
  • pyphare/pyphare/simulator/simulator.py (5 hunks)
📝 Walkthrough

Walkthrough

The initialization logic of the Simulator class was refactored to introduce an initialized boolean attribute. The initialize method now checks this flag to ensure idempotency, returning early if already initialized, rather than raising an error. Related checks in _check_init were updated to use this flag, and redundant imports of sys were removed.

Changes

File(s) Change Summary
pyphare/pyphare/simulator/simulator.py Moved sys import to top-level, added initialized attribute to Simulator, refactored initialization logic for idempotency, updated _check_init to use new flag, and cleaned up redundant imports.

Estimated code review effort

2 (10–30 minutes)

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 956a1ec and 2c6242d.

📒 Files selected for processing (1)
  • pyphare/pyphare/simulator/simulator.py (4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: PhilipDeegan
PR: PHAREHUB/PHARE#888
File: src/hdf5/detail/h5/h5_file.hpp:78-79
Timestamp: 2024-09-05T17:02:58.784Z
Learning: Avoid commenting on draft PRs for the user PhilipDeegan.
Learnt from: PhilipDeegan
PR: PHAREHUB/PHARE#888
File: src/hdf5/detail/h5/h5_file.hpp:78-79
Timestamp: 2024-10-09T08:32:15.667Z
Learning: Avoid commenting on draft PRs for the user PhilipDeegan.
Learnt from: PhilipDeegan
PR: PHAREHUB/PHARE#888
File: pyphare/pyphare/pharesee/hierarchy/hierarchy_utils.py:566-568
Timestamp: 2024-09-09T13:57:02.285Z
Learning: Avoid commenting on draft PRs for PhilipDeegan unless explicitly requested.
Learnt from: PhilipDeegan
PR: PHAREHUB/PHARE#784
File: tests/simulator/test_restarts.py:333-339
Timestamp: 2024-10-09T08:32:15.667Z
Learning: PhilipDeegan has indicated a preference for minimal and efficient code, even after making changes to get a function working. There may be opportunities to remove or optimize parts of the code such as sleep/wait/advances.
Learnt from: PhilipDeegan
PR: PHAREHUB/PHARE#784
File: tests/simulator/test_restarts.py:333-339
Timestamp: 2024-07-26T22:04:34.160Z
Learning: PhilipDeegan has indicated a preference for minimal and efficient code, even after making changes to get a function working. There may be opportunities to remove or optimize parts of the code such as sleep/wait/advances.
🔇 Additional comments (3)
pyphare/pyphare/simulator/simulator.py (3)

6-6: Good refactoring: Moving sys import to top level.

This eliminates redundant imports inside methods and follows Python best practices.


95-95: Good addition: Explicit initialization tracking.

The initialized flag provides clearer state tracking than checking if cpp_sim is None.


144-146: No dependencies on initialize() exceptions detected — idempotent change is safe

A search for any exception handling around .initialize() (in tests and library code) returned no catches or logic relying on a thrown error. All calls to initialize() occur on fresh Simulator instances or within _check_init, which now correctly returns early when already initialized without breaking existing flows.

No further action required.

@PhilipDeegan PhilipDeegan merged commit d59c7fc into PHAREHUB:master Jul 22, 2025
13 checks passed
@PhilipDeegan PhilipDeegan deleted the simpy branch July 22, 2025 14:19
UCaromel pushed a commit to UCaromel/PHARE that referenced this pull request Aug 1, 2025
PhilipDeegan added a commit to PhilipDeegan/PHARE that referenced this pull request Aug 7, 2025
PhilipDeegan added a commit to PhilipDeegan/PHARE that referenced this pull request Oct 8, 2025
UCaromel pushed a commit to UCaromel/PHARE that referenced this pull request Oct 14, 2025
UCaromel pushed a commit to UCaromel/PHARE that referenced this pull request Feb 6, 2026
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.

python Simulator setup / init inconsistency

2 participants