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

Improve message error when docker isn't running (#3816) #4600

Merged
merged 4 commits into from
Dec 10, 2024

Conversation

gziz
Copy link
Contributor

@gziz gziz commented Dec 7, 2024

Why are these changes needed?

When docker is not running and the user tries to use DockerCommandLineCodeExecutort he displayed error is:

“Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory’))”

which is indeed not very helpful.

I initially searched for a built-in method in the docker library to determine whether the Docker daemon is running, but unfortunately, there’s none.

The next issue is that there isn’t a specific exception that exclusively covers the scenario where the daemon is not running. Hence, we rely on catching the DockerException, which seems to encompass this case and potentially others.

Because of this, I’m raising the custom message “Please ensure Docker is installed and running” only if the string “FileNotFoundError” is in the error message.

If this string is not in e, then I raise the error as usual, ensuring the user receives appropriate feedback based on the specific scenario.

Related issue number

#3816

Checks

@ekzhu ekzhu requested a review from Copilot December 8, 2024 00:57

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no suggestions.

Comments skipped due to low confidence (2)

python/packages/autogen-ext/src/autogen_ext/code_executors/docker/_docker_code_executor.py:335

  • The word 'dependecies' is misspelled. It should be 'dependencies'.
"Missing dependecies for DockerCommandLineCodeExecutor. Please ensure the autogen-ext package was installed with the 'docker' extra."

python/packages/autogen-ext/src/autogen_ext/code_executors/docker/_docker_code_executor.py:343

  • [nitpick] The error message could be more specific. Consider changing it to 'Failed to connect to Docker daemon. Please ensure Docker is installed and running.'
raise RuntimeError("Failed to connect to Docker. Please ensure Docker is installed and running.") from e
@jackgerrits jackgerrits merged commit 3e5e12b into microsoft:main Dec 10, 2024
45 checks passed
ekzhu pushed a commit that referenced this pull request Dec 10, 2024
@gziz gziz deleted the docker_not_running_message branch December 10, 2024 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants