Skip to content

Conversation

@SFJohnson24
Copy link
Collaborator

This pull request refactors the run_validation function in scripts/run_validation.py to improve resource management and code readability. The main change is ensuring that the CacheManager is properly shut down after validation, even if an exception occurs, by wrapping the main logic in a try/finally block. Additionally, several lines are reformatted for better readability.

Resource management improvements:

  • Wrapped the main logic of run_validation in a try/finally block to guarantee that manager.shutdown() is called, ensuring proper cleanup of resources. [1] [2]

engine_logger.info(" Report generated, Cleaning up intermediate files")
for file in created_files:
engine_logger.info(f"Deleting file {file}")
os.remove(file)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should keep file parquet file deleting in final block because any exception that will occur before this part will leave the files undeleted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

moved, i also added it to a try/except to warn user if a file fails to delete

Copy link
Collaborator

@RamilCDISC RamilCDISC left a comment

Choose a reason for hiding this comment

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

The PR refactors the run validation code to ensure that the pool processes are closed properly once the validation completes. The Validation was done by:

  1. Reviewing the PR for any unwanted code or comments.
  2. Ensuring all unit and regression testing pass.
  3. Ensuring the refactored code fully covers the previous code.
  4. Running manual validations using CLI to ensure proper execution.
  5. Validation using large datasets to ensure compatibility.

@RamilCDISC RamilCDISC merged commit 94fb108 into main Dec 18, 2025
11 checks passed
@RamilCDISC RamilCDISC deleted the multiprocessing_pool branch December 18, 2025 22:01
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.

3 participants