Docker Code Exec delete temp files #6211
Merged
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 introduces a new feature to the
DockerCommandLineCodeExecutorclass, which allows temporary files generated by code execution to be deleted after code execution. The most important changes include adding a new configuration option, updating the class to handle this option, and adding tests to verify the new functionality.New Feature: Temporary File Deletion
python/packages/autogen-ext/src/autogen_ext/code_executors/docker/_docker_code_executor.py: Addeddelete_tmp_filesattribute to theDockerCommandLineCodeExecutorConfigclass and updated theDockerCommandLineCodeExecutorclass to handle this attribute. This includes initializing the attribute, adding it to the configuration methods, and implementing the file deletion logic in the_execute_code_dont_check_setupmethod. [1] [2] [3] [4] [5] [6] [7] [8]Testing
python/packages/autogen-ext/tests/code_executors/test_docker_commandline_code_executor.py: Added a new testtest_delete_tmp_filesto verify the behavior of thedelete_tmp_filesattribute. This test checks that temporary files are correctly deleted or retained based on the configuration.