-
Notifications
You must be signed in to change notification settings - Fork 6.6k
autogen-ext test is too slow...! #6376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Let's first figure out why the docker tests are so slow. Then, for docker code executor tests (both DockerCommandLineCodeExecutor and DockerJupyterCodeExecutor), I think we should create separate autogen/.github/workflows/checks.yml Lines 152 to 153 in b6935f9
|
@ekzhu Cool. In
I’m testing sharing Docker containers between tests instead of creating a new one for each test. autogen/python/packages/autogen-ext/tests/code_executors/test_docker_commandline_code_executor.py Lines 35 to 44 in 0c9fd64
This results in Docker being rebuilt for each test. @pytest_asyncio.fixture(scope="session") # type: ignore
async def executor_and_temp_dir() -> AsyncGenerator[tuple[DockerCommandLineCodeExecutor, str], None]:
if not docker_tests_enabled():
pytest.skip("Docker tests are disabled")
with tempfile.TemporaryDirectory() as temp_dir:
async with DockerCommandLineCodeExecutor(work_dir=temp_dir) as executor:
yield executor, temp_dir At Yup, it still needs a clean-up routine for the shared work_dir between tests. But I plan to implement it like this: @pytest_asyncio.fixture(scope="function")
async def cleanup_after_test(executor_and_temp_dir, request):
_, work_dir = executor_and_temp_dir
def cleanup():
reset_temp_dir(work_dir)
request.addfinalizer(cleanup)
yield And change test usage like this: @pytest.mark.asyncio
async def test_example(executor_and_temp_dir, cleanup_after_test):
executor, tmp_dir = executor_and_temp_dir
....
.... (Yes, It routine is same as before) Just sharing my ongoing experiment :) I welcome any suggestions or help from others. |
What happened?
Describe the bug
Check each tests at autogen-ext
autogen-ext/cache_store : 0.15s
autogen-ext/code_executors : 203.89s
autogen-ext/memory : 12s
autogen-ext/models : 37s
autogen-ext/tools: 14s
autogen_ext/*.py : 146.02s
I could find out slow tests
packages/autogen-ext/tests/code_executors/test_docker_commandline_code_executor.py : 161.66s
packages/autogen-ext/tests/test_openai_assistant_agent.py : 92.66s
To Reproduce
poe test
pytest python/packages/autogen-ext/tests
Expected behavior
More fast...!
Which packages was the bug in?
Python Extensions (autogen-ext)
AutoGen library version.
Python dev (main branch)
Other library version.
No response
Model used
No response
Model provider
None
Other model provider
No response
Python version
None
.NET version
None
Operating system
None
The text was updated successfully, but these errors were encountered: