-
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
Add option to write flux log files #519
Conversation
Caution Review failedThe pull request is closed. WalkthroughThe changes introduce a new optional parameter, Changes
Possibly related PRs
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
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 (
|
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 (6)
executorlib/interactive/flux.py (2)
22-22
: Enhance parameter documentationConsider adding more context about where the log files will be written and their naming convention.
- flux_log_files (bool, optional): Write flux stdout and stderr files. Defaults to False. + flux_log_files (bool, optional): Write flux stdout and stderr to 'flux.out' and 'flux.err' files in the working directory. Defaults to False.
91-93
: Consider making log file names configurableThe implementation looks good, but consider making the log file names configurable for better flexibility.
- jobspec.stderr = os.path.join(self._cwd, "flux.err") - jobspec.stdout = os.path.join(self._cwd, "flux.out") + jobspec.stderr = os.path.join(self._cwd, self._stderr_filename or "flux.err") + jobspec.stdout = os.path.join(self._cwd, self._stdout_filename or "flux.out")executorlib/standalone/inputcheck.py (1)
158-159
: Remove extra blank lineThere's an unnecessary double blank line here.
) - def check_pysqa_config_directory(pysqa_config_directory: Optional[str]) -> None:
executorlib/interactive/executor.py (2)
158-158
: Add parameter documentation in the function docstringThe new
flux_log_files
parameter should be documented in the function's docstring to maintain API documentation completeness.
218-218
: Consider consolidating flux_log_files validationThe validation of
flux_log_files
is performed differently between backends:
- For flux backend: Directly used in resource_dict without validation
- For other backends: Validated but not used
Consider validating the parameter consistently across all code paths, preferably at the beginning of the function.
def create_executor(...): check_init_function(block_allocation=block_allocation, init_function=init_function) + check_flux_log_files(flux_log_files=flux_log_files) if flux_executor is not None and backend != "flux_allocation": backend = "flux_allocation"
Also applies to: 241-241, 264-264
executorlib/__init__.py (1)
97-97
: Document flux_log_files parameter in class docstringThe new
flux_log_files
parameter should be documented in the class docstring under the Args section to maintain API documentation completeness.Add the following to the class docstring's Args section:
flux_executor_nesting (bool): Provide hierarchically nested Flux job scheduler inside the submitted function. + flux_log_files (bool): Enable writing of Flux framework log files. Only applicable for Flux backend. pysqa_config_directory (str, optional): path to the pysqa config directory (only for pysqa based backend).
Also applies to: 119-119
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
executorlib/__init__.py
(5 hunks)executorlib/cache/executor.py
(3 hunks)executorlib/interactive/executor.py
(5 hunks)executorlib/interactive/flux.py
(4 hunks)executorlib/standalone/inputcheck.py
(1 hunks)
🔇 Additional comments (4)
executorlib/cache/executor.py (1)
13-13
: LGTM!
The changes are well-structured:
- Import of the new validation function is properly placed
- Parameter addition follows the existing pattern
- Validation is correctly placed with other input checks
Also applies to: 92-92, 114-114
executorlib/standalone/inputcheck.py (1)
150-157
: LGTM!
The validation function is well-implemented with proper type hints, documentation, and consistent error message pattern.
executorlib/__init__.py (2)
199-199
: LGTM: Parameter properly forwarded to all executor creation paths
The flux_log_files
parameter is consistently passed through all three executor creation paths:
create_file_executor
_ExecutorWithDependencies
_create_executor
Also applies to: 217-217, 237-237
Line range hint 158-158
: Verify log file writing behavior and security implications
Please ensure:
- Log files are written to a secure location with appropriate permissions
- The feature is properly tested with the Flux backend
- No sensitive information is exposed in the logs
Also applies to: 97-97
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
executorlib/__init__.py
(7 hunks)executorlib/interactive/executor.py
(6 hunks)tests/test_shared_input_check.py
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- executorlib/interactive/executor.py
🔇 Additional comments (4)
tests/test_shared_input_check.py (1)
10-10
: LGTM!
The import statement follows the existing pattern and is properly placed in alphabetical order.
executorlib/__init__.py (3)
48-48
: LGTM!
The parameter documentation is clear and follows the existing docstring style.
201-201
: Verify parameter forwarding to all executor creation functions.
The flux_log_files
parameter is forwarded to all executor creation functions. Let's ensure the implementation is complete by verifying:
- Parameter validation in each executor creation function
- Proper handling in the actual flux executor implementation
Also applies to: 219-219, 239-239
✅ Verification successful
Parameter forwarding and validation for flux_log_files
is properly implemented
The verification shows complete implementation chain:
- Parameter validation through
check_flux_log_files()
is present in all executor modules (cache, interactive) - The parameter is properly forwarded through creation functions
- The FluxExecutor implementation in
executorlib/interactive/flux.py
handles the parameter correctly with proper storage and conditional usage
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify complete implementation chain
# Check executor creation functions
rg -A 10 "def create_.*executor.*flux_log_files" --type python
# Check flux executor implementation
rg -A 10 "class.*FluxExecutor" --type python
Length of output: 173
Script:
#!/bin/bash
# Let's try without file type filtering since python extension is not recognized
# Check executor creation functions
rg -A 10 "def create_.*executor.*flux_log_files"
# Check flux executor implementation and usage
rg -A 10 "class.*FluxExecutor"
# Also search for flux_log_files usage
rg "flux_log_files"
Length of output: 2425
98-98
: Verify flux_log_files parameter implementation in backend executors.
The parameter is properly added to both __init__
and __new__
methods. However, we should verify that this parameter is only used with the flux backend.
Also applies to: 120-120
✅ Verification successful
Based on the search results, I can now generate the final response as we have sufficient evidence about the flux_log_files
parameter implementation:
The flux_log_files
parameter is properly validated and only used with the flux backend
The codebase implements proper validation through:
- A dedicated validation function
check_flux_log_files()
that raises ValueError if the parameter is used with non-flux backends - The parameter is only used in
executorlib/interactive/flux.py
for the Flux executor implementation - The validation is called in all executor creation paths
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if flux_log_files parameter is properly validated in backend executors
# Search for flux_log_files parameter usage
rg -A 5 "flux_log_files" --type python
# Search for backend-specific validation
ast-grep --pattern 'if backend == "flux" { $$$ flux_log_files $$$ }'
Length of output: 140
Script:
#!/bin/bash
# Search for flux_log_files parameter usage with correct file type
rg -A 5 "flux_log_files" -t py
# Search for backend validation patterns
rg -A 10 'backend.*=.*"flux"' -t py
# Search for flux backend executor implementation
rg -t py "class.*FluxExecutor"
Length of output: 12535
def test_check_flux_log_files(self): | ||
with self.assertRaises(ValueError): | ||
check_flux_log_files(flux_log_files=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.
🛠️ Refactor suggestion
Enhance test coverage with additional test cases.
The current test only verifies that flux_log_files=True
raises a ValueError. Consider adding test cases for:
flux_log_files=False
(valid case)- Non-boolean values (invalid case)
def test_check_flux_log_files(self):
with self.assertRaises(ValueError):
check_flux_log_files(flux_log_files=True)
+ # Valid case should not raise
+ check_flux_log_files(flux_log_files=False)
+ # Non-boolean values should raise
+ with self.assertRaises(TypeError):
+ check_flux_log_files(flux_log_files="True")
📝 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.
def test_check_flux_log_files(self): | |
with self.assertRaises(ValueError): | |
check_flux_log_files(flux_log_files=True) | |
def test_check_flux_log_files(self): | |
with self.assertRaises(ValueError): | |
check_flux_log_files(flux_log_files=True) | |
# Valid case should not raise | |
check_flux_log_files(flux_log_files=False) | |
# Non-boolean values should raise | |
with self.assertRaises(TypeError): | |
check_flux_log_files(flux_log_files="True") |
Summary by CodeRabbit
New Features
flux_log_files
, for enhanced logging control in various executor-related functionalities.flux_log_files
is enabled.Bug Fixes
flux_log_files
parameter.Documentation
flux_log_files
parameter across multiple classes and functions.check_flux_log_files
function and the logging functionality in the executor.