mirror of
https://github.com/microsoft/autogen.git
synced 2025-11-18 02:54:03 +00:00
Display a warning if use_docker evlauates to True but the python docker package is not available. (#172)
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
This commit is contained in:
parent
4522900487
commit
9571b7fbe7
@ -218,7 +218,7 @@ def execute_code(
|
|||||||
timeout: Optional[int] = None,
|
timeout: Optional[int] = None,
|
||||||
filename: Optional[str] = None,
|
filename: Optional[str] = None,
|
||||||
work_dir: Optional[str] = None,
|
work_dir: Optional[str] = None,
|
||||||
use_docker: Optional[Union[List[str], str, bool]] = docker is not None,
|
use_docker: Optional[Union[List[str], str, bool]] = True,
|
||||||
lang: Optional[str] = "python",
|
lang: Optional[str] = "python",
|
||||||
) -> Tuple[int, str, str]:
|
) -> Tuple[int, str, str]:
|
||||||
"""Execute code in a docker container.
|
"""Execute code in a docker container.
|
||||||
@ -257,6 +257,15 @@ def execute_code(
|
|||||||
logger.error(error_msg)
|
logger.error(error_msg)
|
||||||
raise AssertionError(error_msg)
|
raise AssertionError(error_msg)
|
||||||
|
|
||||||
|
# Warn if docker was requested but cannot be provided. In this case
|
||||||
|
# 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"
|
||||||
|
)
|
||||||
|
|
||||||
timeout = timeout or DEFAULT_TIMEOUT
|
timeout = timeout or DEFAULT_TIMEOUT
|
||||||
original_filename = filename
|
original_filename = filename
|
||||||
if WIN32 and lang in ["sh", "shell"] and (not use_docker):
|
if WIN32 and lang in ["sh", "shell"] and (not use_docker):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user