-
Notifications
You must be signed in to change notification settings - Fork 3
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
Update readme #506
Update readme #506
Conversation
WalkthroughThe changes in this pull request focus on enhancing the documentation for the Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 1
🧹 Outside diff range and nitpick comments (4)
README.md (1)
26-31
: Improve text formatting around hyperlinksThe text formatting around the hyperlinks could be improved for better readability. There are unnecessary spaces and dashes around some links.
Apply this diff:
-submitting each function as individual job to the HPC job scheduler - [HPC Submission Mode](https://executorlib.readthedocs.io/en/latest/2-hpc-submission.html) - +submitting each function as individual job to the HPC job scheduler ([HPC Submission Mode](https://executorlib.readthedocs.io/en/latest/2-hpc-submission.html)) -or by requesting a compute allocation of multiple nodes and then distribute the Python functions within this - allocation - -[HPC Allocation Mode](https://executorlib.readthedocs.io/en/latest/3-hpc-allocation.html). Finally, to accelerate the +or by requesting a compute allocation of multiple nodes and then distribute the Python functions within this allocation +([HPC Allocation Mode](https://executorlib.readthedocs.io/en/latest/3-hpc-allocation.html)). Finally, to accelerate the -development process executorlib also provides a - [Local Mode](https://executorlib.readthedocs.io/en/latest/1-local.html) - +development process executorlib also provides a [Local Mode](https://executorlib.readthedocs.io/en/latest/1-local.html)docs/installation.md (3)
36-42
: Consider reducing redundant hyperlinksThe hyperlink to [HPC Submission Mode] is repeated in consecutive sentences (lines 38-39). Consider combining these sentences to improve readability while maintaining the same information.
-This is required as in [HPC Submission Mode](https://executorlib.readthedocs.io/en/latest/2-hpc-submission.html) the -Python function is stored on the file system until the requested computing resources become available. +The Python function is stored on the file system until the requested computing resources become available.
71-75
: Reduce repetitive references to flux frameworkThe text mentions "flux framework" with its hyperlink 4 times in 5 lines. Consider restructuring to maintain readability while reducing repetition.
-For optimal performance in [HPC Allocation Mode](https://executorlib.readthedocs.io/en/latest/3-hpc-allocation.html) the -[flux framework](https://flux-framework.org) is recommended as job scheduler. Even when the [Simple Linux Utility for Resource Management (SLURM)](https://slurm.schedmd.com) -or any other job scheduler is already installed on the HPC cluster. [flux framework](https://flux-framework.org) can be -installed as a secondary job scheduler to leverage [flux framework](https://flux-framework.org) for the distribution of -resources within a given allocation of the primary scheduler. +For optimal performance in [HPC Allocation Mode](https://executorlib.readthedocs.io/en/latest/3-hpc-allocation.html) the +[flux framework](https://flux-framework.org) is recommended as job scheduler. Even when [SLURM](https://slurm.schedmd.com) +or any other job scheduler is already installed on the HPC cluster, flux can be installed as a secondary scheduler to +leverage its capabilities for resource distribution within a given allocation of the primary scheduler.
77-81
: Enhance clarity and add documentation linksConsider improving the technical explanation and adding relevant documentation links:
- Add hyperlinks to
libhwloc
andpmi
documentation- Clarify the relationship between MPI implementation and PMI compatibility
-The [flux framework](https://flux-framework.org) uses `libhwloc` and `pmi` to understand the hardware it is running on -and to booststrap MPI. `libhwloc` not only assigns CPU cores but also GPUs. This requires `libhwloc` to be compiled with -support for GPUs from your vendor. In the same way the version of `pmi` for your queuing system has to be compatible -with the version installed via conda. As `pmi` is typically distributed with the implementation of the Message Passing -Interface (MPI), it is required to install the compatible MPI library in your conda environment as well. +The [flux framework](https://flux-framework.org) uses [libhwloc](https://www.open-mpi.org/projects/hwloc/) for hardware +topology discovery and [PMI](https://www.mpich.org/documentation/guides/pmi/) for MPI bootstrapping. While libhwloc handles +both CPU cores and GPU assignments, it requires vendor-specific GPU support during compilation. Similarly, the PMI version +must be compatible between your queuing system and conda installation. Since PMI typically comes with your MPI +implementation, you'll need to install the corresponding MPI library in your conda environment.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
README.md
(4 hunks)docs/installation.md
(2 hunks)
🧰 Additional context used
🪛 Markdownlint
README.md
64-64: null
Bare URL used
(MD034, no-bare-urls)
🪛 LanguageTool
README.md
[duplication] ~139-~139: Possible typo: you repeated a word
Context: ...o/en/latest/3-hpc-allocation.html) * SLURM * [SLURM with Flux](https://executorlib.readthed...
(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~140-~140: Possible typo: you repeated a word
Context: ...-allocation.html#slurm) * SLURM with Flux * [Flux](https://executorlib.readthedocs.io/en/...
(ENGLISH_WORD_REPEAT_RULE)
🔇 Additional comments (1)
README.md (1)
124-154
: Documentation structure looks good!
The new documentation structure with detailed sections and proper hyperlinks improves navigation and accessibility. The hierarchy is well-organized and covers all important aspects of the library.
🧰 Tools
🪛 LanguageTool
[duplication] ~139-~139: Possible typo: you repeated a word
Context: ...o/en/latest/3-hpc-allocation.html) * SLURM * [SLURM with Flux](https://executorlib.readthed...
(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~140-~140: Possible typo: you repeated a word
Context: ...-allocation.html#slurm) * SLURM with Flux * [Flux](https://executorlib.readthedocs.io/en/...
(ENGLISH_WORD_REPEAT_RULE)
@@ -60,8 +61,7 @@ Python function. In addition to the compute cores `cores`, the resource dictiona | |||
as `threads_per_core`, the GPUs per core as `gpus_per_core`, the working directory with `cwd`, the option to use the | |||
OpenMPI oversubscribe feature with `openmpi_oversubscribe` and finally for the [Simple Linux Utility for Resource | |||
Management (SLURM)](https://slurm.schedmd.com) queuing system the option to provide additional command line arguments | |||
with the `slurm_cmd_args` parameter - [resource dictionary](). | |||
|
|||
with the `slurm_cmd_args` parameter - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary |
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 incomplete URL
There's an incomplete URL that's missing a closing parenthesis.
Apply this diff:
-with the `slurm_cmd_args` parameter - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary
+with the `slurm_cmd_args` parameter - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary).
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
with the `slurm_cmd_args` parameter - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary | |
with the `slurm_cmd_args` parameter - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary). |
🧰 Tools
🪛 Markdownlint
64-64: null
Bare URL used
(MD034, no-bare-urls)
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
for more information, see https://pre-commit.ci
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: 0
🧹 Outside diff range and nitpick comments (11)
docs/trouble_shooting.md (2)
23-25
: Consider minor text refinement for better flow.The links are well-placed and valuable. Consider this minor refinement for better readability:
-Additional features like [caching](https://executorlib.readthedocs.io/en/latest/installation.html#caching), [HPC submission mode](https://executorlib.readthedocs.io/en/latest/installation.html#hpc-submission-mode) -and [HPC allocation mode](https://executorlib.readthedocs.io/en/latest/installation.html#hpc-allocation-mode) require additional dependencies. The dependencies are explained in more detail in the -[installation section](https://executorlib.readthedocs.io/en/latest/installation.html#). +Additional features such as [caching](https://executorlib.readthedocs.io/en/latest/installation.html#caching), [HPC submission mode](https://executorlib.readthedocs.io/en/latest/installation.html#hpc-submission-mode), +and [HPC allocation mode](https://executorlib.readthedocs.io/en/latest/installation.html#hpc-allocation-mode) require additional dependencies. These dependencies are explained in detail in the +[installation section](https://executorlib.readthedocs.io/en/latest/installation.html#).
41-43
: Fix typo in parameter description.The added context and link are helpful. There's a minor typo to fix:
-the resource dictionary parameter `resource_dict` can also include additional parameters define in the submission script +the resource dictionary parameter `resource_dict` can also include additional parameters defined in the submission scriptnotebooks/4-developer.ipynb (6)
Line range hint
1-24
: Consider enhancing the documentation headerThe documentation is well-structured, but consider:
- Making the warning about unofficial support more prominent, perhaps in a separate "Warning" or "Note" block
- Adding brief explanations for technical terms like "thread based parallelism" and "MPI based parallelism" for developers who might be new to these concepts
Line range hint
47-54
: Add error handling to execute_shell_command()The function should handle subprocess failures gracefully. Consider adding try-except blocks to catch
subprocess.CalledProcessError
and other potential exceptions.def execute_shell_command( command: list, universal_newlines: bool = True, shell: bool = False ): import subprocess - - return subprocess.check_output( - command, universal_newlines=universal_newlines, shell=shell - ) + try: + return subprocess.check_output( + command, universal_newlines=universal_newlines, shell=shell + ) + except subprocess.CalledProcessError as e: + raise RuntimeError(f"Command failed with exit status {e.returncode}: {e.output}") + except Exception as e: + raise RuntimeError(f"Failed to execute command: {str(e)}")
Line range hint
147-157
: Enhance process initialization with proper error handlingThe
init_process()
function should handle process creation failures and implement proper resource cleanup.def init_process(): import subprocess + import atexit - return { - "process": subprocess.Popen( - ["python", "count.py"], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - universal_newlines=True, - shell=False, - ) - } + try: + process = subprocess.Popen( + ["python", "count.py"], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + universal_newlines=True, + shell=False, + ) + + def cleanup(): + if process.poll() is None: + process.terminate() + process.wait(timeout=5) + + atexit.register(cleanup) + return {"process": process} + except Exception as e: + raise RuntimeError(f"Failed to initialize process: {str(e)}")
Line range hint
176-191
: Add timeout mechanism to interact()The
interact()
function could potentially hang if the expected output is never received. Consider adding a timeout parameter.-def interact(shell_input, process, lines_to_read=None, stop_read_pattern=None): +def interact(shell_input, process, lines_to_read=None, stop_read_pattern=None, timeout=30): + import time + + start_time = time.time() process.stdin.write(shell_input) process.stdin.flush() lines_count = 0 output = "" while True: + if time.time() - start_time > timeout: + raise TimeoutError("Process interaction timed out") + output_current = process.stdout.readline() output += output_current lines_count += 1 if stop_read_pattern is not None and stop_read_pattern in output_current: break elif lines_to_read is not None and lines_to_read == lines_count: break return output
Line range hint
211-214
: Enhance shutdown() with verificationThe
shutdown()
function should verify successful process termination and handle hanging processes.-def shutdown(process): +def shutdown(process, timeout=5): process.stdin.write("shutdown\n") process.stdin.flush() + try: + process.wait(timeout=timeout) + except subprocess.TimeoutExpired: + process.terminate() + try: + process.wait(timeout=timeout) + except subprocess.TimeoutExpired: + process.kill() + process.wait()
314-316
: Enhance module documentation with version informationConsider adding:
- Version requirements for external dependencies (h5py, cloudpickle, etc.)
- More specific guidance on which standalone components are considered stable for external use
notebooks/1-local.ipynb (3)
233-233
: Fix formatting in markdown textThere's a missing space in "Resource \nManagement".
-Management (SLURM)](https://slurm.schedmd.com) +Management (SLURM)](https://slurm.schedmd.com)
Line range hint
19-19
: Improve error handling specificityThe bare try-except block could be more specific about which exceptions it catches. Consider catching specific exceptions like
PermissionError
orFileNotFoundError
instead of the generalOSError
.- except OSError: + except (PermissionError, FileNotFoundError) as e: + print(f"Failed to remove cache directory: {e}")
328-328
: Comprehensive performance optimization guidanceThe documentation provides excellent coverage of performance optimization strategies, including block allocation, caching, and resource management. The warnings about cache usage in production environments are particularly valuable.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (6)
docs/development.md
(0 hunks)docs/trouble_shooting.md
(2 hunks)notebooks/1-local.ipynb
(2 hunks)notebooks/2-hpc-submission.ipynb
(6 hunks)notebooks/3-hpc-allocation.ipynb
(7 hunks)notebooks/4-developer.ipynb
(1 hunks)
💤 Files with no reviewable changes (1)
- docs/development.md
✅ Files skipped from review due to trivial changes (1)
- notebooks/2-hpc-submission.ipynb
🔇 Additional comments (8)
docs/trouble_shooting.md (1)
19-19
: LGTM! Good addition of installation link.
The link to the MPI installation section provides helpful navigation for users seeking setup instructions.
notebooks/3-hpc-allocation.ipynb (6)
9-14
: Documentation enhancement looks good!
The added hyperlinks improve navigation and provide clear references to related documentation sections. The links are well-organized and contextually relevant.
25-25
: Clear and informative SLURM documentation!
The added explanation about SLURM and flux integration provides valuable context and properly references the documentation.
71-71
: Well-documented resource assignment explanation!
The explanation clearly outlines how resource assignment works consistently across different modes, with appropriate links to relevant documentation sections.
125-125
: Clear block allocation documentation!
The explanation effectively describes the block allocation functionality and properly references the local mode documentation.
192-192
: Well-explained dependencies handling!
The documentation clearly explains how dependencies are handled across different backends, with appropriate reference to the local mode documentation.
234-234
: Comprehensive caching documentation!
The explanation effectively describes the caching functionality, includes important performance considerations, and properly references the local mode documentation.
notebooks/1-local.ipynb (1)
Line range hint 1-700
: Well-structured and comprehensive code examples
The code examples effectively demonstrate the library's features with a clear progression from basic to advanced concepts. They include proper error handling and resource cleanup.
Summary by CodeRabbit
README.md
with added hyperlinks to key sections.docs/installation.md
with updated installation instructions and links to relevant documentation.