luigi.contrib.docker_runner module¶
Docker container wrapper for Luigi.
Enables running a docker container as a task in luigi. This wrapper uses the Docker Python SDK to communicate directly with the Docker API avoiding the common pattern to invoke the docker client from the command line. Using the SDK it is possible to detect and properly handle errors occurring when pulling, starting or running the containers. On top of this, it is possible to mount a single file in the container and a temporary directory is created on the host and mounted allowing the handling of files bigger than the container limit.
Requires:
- docker:
pip install docker
Written and maintained by Andrea Pierleoni (@apierleoni). Contributions by Eliseo Papa (@elipapa).
-
class
luigi.contrib.docker_runner.
DockerTask
(*args, **kwargs)[source]¶ Bases:
luigi.task.Task
When a new instance of the DockerTask class gets created: - call the parent class __init__ method - start the logger - init an instance of the docker client - create a tmp dir - add the temp dir to the volume binds specified in the task
-
image
¶
-
command
¶
-
name
¶
-
container_options
¶
-
environment
¶
-
container_tmp_dir
¶
-
binds
¶ Override this to mount local volumes, in addition to the /tmp/luigi which gets defined by default. This should return a list of strings. e.g. [‘/hostpath1:/containerpath1’, ‘/hostpath2:/containerpath2’]
-
network_mode
¶
-
docker_url
¶
-
auto_remove
¶
-
force_pull
¶
-
mount_tmp
¶
-