Enhance code and tackle weaknesses found in testing #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes aimed at improving error handling, validation, and logging across multiple utility functions in the codebase. The most important changes include enhancing path validation, adding error checks and logging, and ensuring proper handling of configuration data.
Enhancements to path validation and error handling:
lib/core_utils/common.py
: Improved theget_path
function to validate paths more rigorously, including checks for absolute paths and directory traversal attempts. Added logging for various error scenarios.lib/core_utils/common.py
: Enhancedsave_last_processed_seq
to include error handling when writing to the sequence file, with appropriate logging for failures.Improvements to configuration data handling:
lib/core_utils/config_loader.py
: Updated_load_config
to set the configuration to an empty immutable mapping before raising exceptions, ensuring a consistent state.Additional error checks and logging:
lib/module_utils/report_transfer.py
: Added validation to ensure thereport_transfer
configuration is a dictionary and included logging for invalid configurations.lib/module_utils/slurm_utils.py
: Introduced type checks fortemplate_fpath
andoutput_fpath
ingenerate_slurm_script
to ensure they are either strings orPath
objects.