Add host_config_options to allow configuration of DockerTask for GPU resources #3234
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This adds a new
host_config_options
property toDockerTask
that gives access to the underlying Docker API for things like gpu requests or increased shared memory. I've also added references to the docker documentation and a few small examples.Motivation and Context
I need to grant GPU access to a few docker tasks, but the current API interface of the DockerTask doesn't allow any sort of access to the underlying Docker API to be able to make the necessary requests. I've modeled this change after the
container_options
property which allows broad underlying access to the relevant Docker API calls.Have you tested this? If so, how?
I have tested this with some code that I'm working with on a Telsa T4: https://github.com/dsgt-birdclef/birdclef-2023/blob/22c8bcb53c297e68298be5fb41933d59e11f55cd/workflows/mixit/docker.py
In particular, I added the following:
This seems to work as expected with my workflow.