Skip to content
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

Addresses issue #199 #200

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions autogen/code_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def execute_code(
timeout: Optional[int] = None,
filename: Optional[str] = None,
work_dir: Optional[str] = None,
use_docker: Optional[Union[List[str], str, bool]] = True,
use_docker: Optional[Union[List[str], str, bool]] = None,
lang: Optional[str] = "python",
) -> Tuple[int, str, str]:
"""Execute code in a docker container.
Expand Down Expand Up @@ -260,11 +260,15 @@ def execute_code(
# Warn if docker was requested but cannot be provided. In this case
sonichi marked this conversation as resolved.
Show resolved Hide resolved
# the current behavior is to fall back to run natively, but this behavior
# is subject to change.
if use_docker and docker is None:
use_docker = False
logger.warning(
"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"
)
if use_docker is None:
if docker is None:
use_docker = False
logger.warning(
"execute_code was called without specifying a value for use_docker. Since the python docker package is not available, code will be run natively. Note: this fallback behavior is subject to change"
)
else:
# Default to true
use_docker = True

timeout = timeout or DEFAULT_TIMEOUT
original_filename = filename
Expand Down
Loading