Skip to content

Commit 99fbd94

Browse files
authored
Merge branch 'main' into ver0.1.9
2 parents 4e3a812 + 9571b7f commit 99fbd94

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

autogen/code_utils.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def execute_code(
218218
timeout: Optional[int] = None,
219219
filename: Optional[str] = None,
220220
work_dir: Optional[str] = None,
221-
use_docker: Optional[Union[List[str], str, bool]] = docker is not None,
221+
use_docker: Optional[Union[List[str], str, bool]] = True,
222222
lang: Optional[str] = "python",
223223
) -> Tuple[int, str, str]:
224224
"""Execute code in a docker container.
@@ -257,6 +257,15 @@ def execute_code(
257257
logger.error(error_msg)
258258
raise AssertionError(error_msg)
259259

260+
# Warn if docker was requested but cannot be provided. In this case
261+
# the current behavior is to fall back to run natively, but this behavior
262+
# is subject to change.
263+
if use_docker and docker is None:
264+
use_docker = False
265+
logger.warning(
266+
"execute_code was called with use_docker evaluating to True, but the python docker package is not available. Falling back to native code execution. Note: this fallback behavior is subject to change"
267+
)
268+
260269
timeout = timeout or DEFAULT_TIMEOUT
261270
original_filename = filename
262271
if WIN32 and lang in ["sh", "shell"] and (not use_docker):

0 commit comments

Comments
 (0)