Add an option to auto-delete temp files created by LocalCommandLineExecutor
What feature would you like to be added?
LocalCommandLineExecutor leaves a lot of debris on disk like:
tmp_code_84c00a94989f5048ee254cb2e583fc8e75b66c0afef4a7a76c8901a4eb2f5bc5.py
tmp_code_95c44f5140612045a5fb8c5ccad956a2ae4afb4a028201cf836fbb55c09c72f1.py
These files are executed once, and never referred to again.
Please add an (on by default) option to automatically clean up temporary files.
Why is this needed?
Explained above.
We don't need to do this work in the framework, using standard python tempdir tooling should work fine: https://github.com/microsoft/autogen/blob/prefix_sub/python/packages/autogen-core/tests/execution/test_commandline_code_executor.py#L92-L93
@afourney & @jackgerrits Should this issue be closed or is there still work? If there is work, does this have to do with the functions in autogen_ext/code_exectors/init.py (ln https://github.com/microsoft/autogen/blob/c76a68c780da4ec5f838c88a29a8e6f1ff31a2c0/python/packages/autogen-ext/src/autogen_ext/code_executors/local/init.py#L246) and not the tests?
Hi @ekzhu & @jackgerrits , is this issue still in progress, or would it be okay if I picked it up? 🚀
@jackgerrits I wanted to follow up on https://github.com/microsoft/autogen/pull/6556#discussion_r2094628477 where I indicated that we can reduce the code duplication in CodeExecutors. It may make sense to open a new issue but I'm not able to this. I was thinking about two approaches, and need some input from your side;
- Implementing this behaviour in the
CodeExecutorparent, where it may not be implemented by all children (Refused Bequest). - Introducing a new
TemporaryFileCleanupMixinclass that someCodeExecutors (e.g.,LocalCommandLineCodeExecutor,DockerCommandLineCodeExecutor) can inherit from and encapsulates the behaviour. But this may be overkill given the rather simple functionality it provides.
What do you think?
CC @ekzhu