-
Notifications
You must be signed in to change notification settings - Fork 3
Feature: Add built-in network test #874
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
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughA new internal self-test function is added to verify executor functionality immediately after initialization. The function submits a task, polls for completion with timeout, and raises an error with guidance if the task does not complete within the specified interval. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/executorlib/executor/single.py (2)
459-463: Consider a more diagnostic error message.The error message prescriptively suggests
hostname_localhost=Trueas the solution, but timeout could occur for other reasons (network issues, resource contention, worker failures). Consider providing a more diagnostic message that describes what failed and suggestshostname_localhost=Trueas one possible solution rather than the definitive fix.🔎 Suggested improvement
if not f.done(): exe.shutdown(wait=False, cancel_futures=False) raise TimeoutError( - 'Plase try "hostname_localhost=True" in the initialization of the SingleNodeExecutor(hostname_localhost=True).' + 'Executor self-test timed out after 1 second. This may indicate network connectivity issues. ' + 'Try setting hostname_localhost=True in SingleNodeExecutor initialization if running on macOS or in HPC environments.' )
453-464: Consider optional refinements.Two minor refinements to consider:
The function returns
Truebut this value is never used (line 192 doesn't capture it). Consider removing the return statement or documenting why it returns a value.The static analysis tool suggests avoiding long exception messages outside the exception class (TRY003). While this is a style preference, you could consider defining a custom exception class if this pattern is repeated elsewhere.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/executorlib/executor/single.py
🧰 Additional context used
🧬 Code graph analysis (1)
src/executorlib/executor/single.py (2)
src/executorlib/executor/base.py (2)
submit(71-108)shutdown(110-126)src/executorlib/task_scheduler/file/shared.py (1)
done(40-48)
🪛 Ruff (0.14.10)
src/executorlib/executor/single.py
461-463: Avoid specifying long messages outside the exception class
(TRY003)
⏰ 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). (20)
- GitHub Check: unittest_openmpi (ubuntu-latest, 3.13)
- GitHub Check: unittest_flux_openmpi
- GitHub Check: unittest_openmpi (macos-latest, 3.13)
- GitHub Check: unittest_openmpi (ubuntu-latest, 3.12)
- GitHub Check: unittest_mpich (ubuntu-latest, 3.13)
- GitHub Check: unittest_openmpi (ubuntu-latest, 3.11)
- GitHub Check: unittest_openmpi (ubuntu-24.04-arm, 3.13)
- GitHub Check: unittest_mpich (macos-latest, 3.13)
- GitHub Check: unittest_openmpi (ubuntu-22.04-arm, 3.13)
- GitHub Check: unittest_mpich (ubuntu-22.04-arm, 3.13)
- GitHub Check: unittest_mpich (ubuntu-24.04-arm, 3.13)
- GitHub Check: unittest_mpich (ubuntu-latest, 3.11)
- GitHub Check: unittest_slurm_mpich
- GitHub Check: unittest_flux_mpich
- GitHub Check: notebooks
- GitHub Check: notebooks_integration
- GitHub Check: benchmark (ubuntu-latest, 3.13, .ci_support/environment-mpich.yml)
- GitHub Check: unittest_win
- GitHub Check: unittest_old
- GitHub Check: benchmark (ubuntu-latest, 3.13, .ci_support/environment-openmpi.yml)
🔇 Additional comments (2)
src/executorlib/executor/single.py (2)
1-1: LGTM!The import of
sleepis necessary for the polling mechanism in the self-test function.
456-458: Verify the timeout duration is sufficient.The self-test uses a 1-second timeout (10 iterations × 0.1s). Ensure this duration is sufficient for various environments, including slower systems, busy clusters, or CI/CD environments where resources may be constrained.
| log_obj_size=log_obj_size, | ||
| ) | ||
| ) | ||
| _executor_self_test(exe=self._task_scheduler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# First, find the file and check its size
find . -name "single.py" -path "*/executor/*" | head -5Repository: pyiron/executorlib
Length of output: 98
🏁 Script executed:
# Examine the file around line 192 and the TestClusterExecutor area
sed -n '185,300p' src/executorlib/executor/single.pyRepository: pyiron/executorlib
Length of output: 8212
🏁 Script executed:
# Continue reading to see TestClusterExecutor.__init__ implementation body
sed -n '289,370p' src/executorlib/executor/single.pyRepository: pyiron/executorlib
Length of output: 4316
🏁 Script executed:
# Search for _executor_self_test definition
rg -n "def _executor_self_test" src/executorlib/Repository: pyiron/executorlib
Length of output: 130
🏁 Script executed:
# View the _executor_self_test function
sed -n '453,500p' src/executorlib/executor/single.pyRepository: pyiron/executorlib
Length of output: 474
🏁 Script executed:
# Check the structure of both __init__ methods to see if they both expose _task_scheduler
sed -n '100,200p' src/executorlib/executor/single.pyRepository: pyiron/executorlib
Length of output: 6781
Add self-test validation to TestClusterExecutor for consistency.
TestClusterExecutor initialization lacks the _executor_self_test() call present in SingleNodeExecutor, despite both having similar executor setup patterns. Consider adding _executor_self_test(exe=self._task_scheduler) after the super().__init__() call to validate executor initialization and catch connection issues early, consistent with SingleNodeExecutor's approach.
🤖 Prompt for AI Agents
In src/executorlib/executor/single.py around line 192, TestClusterExecutor's
initializer is missing the self-test call used in SingleNodeExecutor; add a call
to _executor_self_test(exe=self._task_scheduler) immediately after the
super().__init__(...) return so the TaskScheduler/connection is validated during
initialization, mirroring SingleNodeExecutor and allowing early failure
detection.
| def _executor_self_test(exe): | ||
| f = exe.submit(sum, [1, 1]) | ||
| counter = 0 | ||
| while not f.done() and counter < 10: | ||
| sleep(0.1) | ||
| counter += 1 | ||
| if not f.done(): | ||
| exe.shutdown(wait=False, cancel_futures=False) | ||
| raise TimeoutError( | ||
| 'Plase try "hostname_localhost=True" in the initialization of the SingleNodeExecutor(hostname_localhost=True).' | ||
| ) | ||
| return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typo in error message.
Line 462 contains a typo: "Plase" should be "Please".
🔎 Proposed fix
raise TimeoutError(
- 'Plase try "hostname_localhost=True" in the initialization of the SingleNodeExecutor(hostname_localhost=True).'
+ 'Please try "hostname_localhost=True" in the initialization of the SingleNodeExecutor(hostname_localhost=True).'
)🧰 Tools
🪛 Ruff (0.14.10)
461-463: Avoid specifying long messages outside the exception class
(TRY003)
🤖 Prompt for AI Agents
In src/executorlib/executor/single.py around lines 453 to 464, the error message
raised on timeout contains a typo ("Plase"). Update the string to correct the
spelling to "Please" so the message reads: 'Please try "hostname_localhost=True"
in the initialization of the SingleNodeExecutor(hostname_localhost=True).'
Ensure only the typo is fixed and preserve punctuation and quoting exactly as in
the original message.
|
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.