autogen icon indicating copy to clipboard operation
autogen copied to clipboard

Docker based code execution slow - reuse container / be able to specify requirements.txt up front

Open bbence84 opened this issue 3 years ago • 5 comments

I am relying heavily on the docker based code execution, which works pretty well, however it seems to be pretty slow, likely because of the fact that each time it instantiates a new container. This is very slow. Additionally it would be nice if there would be a way to influence the docker container be initialized with packages we already know would be likely used. This would also speed up code execution. Thanks!

bbence84 avatar Nov 22 '23 16:11 bbence84

It looks like docker file implementation could be optimized a bit.

LarHope avatar Nov 23 '23 04:11 LarHope

Yes, a new container (not image) is spun up for every message that has code, and it is much slower than native code execution. A more viable option is to create one Docker container, and run everything in it (in which case, it acts as if running natively, yet is still sandboxed). This is what many of us do anyways, but it would be good if somehow it could be achieved via configuration.

afourney avatar Nov 25 '23 04:11 afourney

I second this, metagpt and others will work in a group sharing file workspace to create a project with tests and usually have a requirements.txt to install so tester can install code and run it with tests.. its probably useful to have a way to install.. I have been using subprocess but i think requirements is a better way.

sidhujag avatar Nov 25 '23 04:11 sidhujag

One can specify the docker image name with use_docker in code_execution_config. Is that already considered?

sonichi avatar Dec 03 '23 17:12 sonichi

was resolved when #2444 was closed.

rysweet avatar Oct 18 '24 16:10 rysweet