Skip to content

Add TestClusterExecutor to simplify debugging of SlurmClusterExecutor and FluxClusterExecutor #714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 12, 2025

Conversation

jan-janssen
Copy link
Member

@jan-janssen jan-janssen commented Jul 12, 2025

Based on #708 and the discussion in pyiron/pyiron_workflow#678

Summary by CodeRabbit

  • New Features
    • Introduced a new executor, TestClusterExecutor, for local testing of file-based cluster execution mechanisms.
  • Tests
    • Added tests to verify correct caching behavior and functionality of TestClusterExecutor.

Copy link
Contributor

coderabbitai bot commented Jul 12, 2025

Warning

Rate limit exceeded

@jan-janssen has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 7 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 545f738 and 38e96e8.

📒 Files selected for processing (1)
  • tests/test_testclusterexecutor.py (1 hunks)

Walkthrough

A new executor class, TestClusterExecutor, was introduced for local testing of file-based communication in cluster-like environments. The class was added to the public API. A corresponding test module was created to verify its caching behavior, particularly ensuring correct usage of cache directories during task execution.

Changes

File(s) Change Summary
executorlib/api.py Imported TestClusterExecutor and added it to the __all__ list for public API exposure.
executorlib/executor/single.py Added the TestClusterExecutor class for local testing of file-based cluster executor mechanisms.
tests/test_testclusterexecutor.py Introduced a new test class and method to validate cache directory behavior of TestClusterExecutor.

Sequence Diagram(s)

sequenceDiagram
    participant Tester
    participant TestClusterExecutor
    participant CacheDirectory

    Tester->>TestClusterExecutor: Create instance with custom cache_directory
    Tester->>TestClusterExecutor: Submit task foo(x)
    TestClusterExecutor->>CacheDirectory: Store task result in specified cache dir
    CacheDirectory-->>TestClusterExecutor: Confirm cache entry
    TestClusterExecutor-->>Tester: Return task result
    Tester->>CacheDirectory: Check cache data presence/absence
Loading

Possibly related PRs

Poem

In the warren of code, a new path appears,
TestClusterExecutor hops in, allaying cache fears.
With tests that inspect where data should go,
The carrots of logic in neat rows now grow.
Hooray for the cache, and the tests that ensure,
Our fluffy new feature is stable and pure! 🥕

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

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

codecov bot commented Jul 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.93%. Comparing base (4458c86) to head (38e96e8).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #714      +/-   ##
==========================================
+ Coverage   96.89%   96.93%   +0.04%     
==========================================
  Files          29       30       +1     
  Lines        1320     1338      +18     
==========================================
+ Hits         1279     1297      +18     
  Misses         41       41              

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

Base automatically changed from create_file_executor to main July 12, 2025 09:02
Copy link
Contributor

@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

🧹 Nitpick comments (1)
tests/test_testclusterexecutor.py (1)

7-13: Use importlib.util.find_spec for cleaner availability check.

The static analysis correctly identifies that h5py is imported but unused. Consider using the recommended approach for checking module availability.

-try:
-    import h5py
-
-    skip_h5py_test = False
-except ImportError:
-    skip_h5py_test = True
+import importlib.util
+
+skip_h5py_test = importlib.util.find_spec("h5py") is None
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4458c86 and ad2e5de.

📒 Files selected for processing (3)
  • executorlib/api.py (2 hunks)
  • executorlib/executor/single.py (1 hunks)
  • tests/test_testclusterexecutor.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
executorlib/api.py (1)
executorlib/executor/single.py (1)
  • TestClusterExecutor (187-353)
🪛 Ruff (0.11.9)
tests/test_testclusterexecutor.py

8-8: h5py imported but unused; consider using importlib.util.find_spec to test for availability

(F401)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: unittest_win
  • GitHub Check: unittest_mpich (ubuntu-latest, 3.12)
  • GitHub Check: unittest_openmpi (ubuntu-latest, 3.12)
  • GitHub Check: notebooks
  • GitHub Check: minimal
🔇 Additional comments (3)
executorlib/api.py (1)

8-8: LGTM!

The import and export of TestClusterExecutor are correctly implemented, making the new class available through the public API.

Also applies to: 23-23

tests/test_testclusterexecutor.py (1)

23-53: Well-structured test for cache directory override behavior.

The test effectively verifies that the cache_directory specified in the task's resource_dict takes precedence over the executor's default cache directory. Running the test twice ensures consistent behavior.

executorlib/executor/single.py (1)

296-354: Implementation looks good!

The TestClusterExecutor implementation correctly provides two execution modes:

  • File-based execution using create_file_executor for testing cluster-like communication
  • Dependency graph plotting mode using DependencyTaskScheduler for debugging

The resource dictionary setup and parameter handling are well-structured.

jan-janssen and others added 3 commits July 12, 2025 11:07
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@jan-janssen jan-janssen requested a review from liamhuber July 12, 2025 09:23
Copy link
Member

@liamhuber liamhuber left a comment

Choose a reason for hiding this comment

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

LGTM. I like the submit-time directory update being included in the test suite here too 👍

@jan-janssen jan-janssen merged commit 51a33eb into main Jul 12, 2025
30 checks passed
@jan-janssen jan-janssen deleted the testclusterexecutor branch July 12, 2025 16:30
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.

2 participants