-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
[Core] check if docker is installed if user_docker is specified. #1145
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1145 +/- ##
==========================================
+ Coverage 30.74% 40.35% +9.60%
==========================================
Files 30 30
Lines 4043 4047 +4
Branches 915 965 +50
==========================================
+ Hits 1243 1633 +390
+ Misses 2721 2302 -419
- Partials 79 112 +33
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this PR addresses the same issue that was meant to be addressed by the lines 280 - 291 in your code below. Issues #172 and #200 are where they were introduced.
At the time, the warning was added because we wanted to highlight the risk, but not change default behavior due to the installed user base. Perhaps it is now time to change this, and @sonichi can weigh in on this.
But, if we decide now to throw an error, we should remove lines 280-291, and we should update the docstring to mention that the error is thrown, and also update the description of the use_docker field, which now reads:
use_docker (Optional, list, str or bool): The docker image to use for code execution.
If a list or a str of image name(s) is provided, the code will be executed in a docker container
with the first image successfully pulled.
If None, False or empty, the code will be executed in the current environment.
Default is None, which will be converted into an empty list when docker package is available.
Expected behaviour:
- If `use_docker` is explicitly set to True and the docker package is available, the code will run in a Docker container.
- If `use_docker` is explicitly set to True but the Docker package is missing, an error will be raised.
- If `use_docker` is not set (i.e., left default to None) and the Docker package is not available, a warning will be displayed, but the code will run natively.
If the code is executed in the current environment,
the code must be trusted.
And I believe that description is correct (though the language about an "empty" list is confusing)
Currently line 280-291 doesn't address the case when docker is not installed but use_docker is set to True. So technically the changes in this PR should address that case. |
Oh, ok. I see. Indeed you have provided a nicer error message. Previously, If use docker was set to True, but Docker was not installed, then the code would throw an error here: Line 350 in 871e9e2
|
Why are these changes needed?
Check if docker is installed if
use_docker
is specified. This is to adhere to the documentation ofexecute_code
.Related issue number
Address #498
Checks