Docker Module

class ablinfer.docker.DispatchDocker(config=None)[source]

Class for dispatching to a Docker container.

A docker key is added to config, which should contain all of the keyword arguments to pass to docker.DockerClient, excepting version. If not present, docker.from_env is used (so either docker should be present or you should properly set environment variables, the latter being preferred).

This implementation expects the model configuration values to be the path to the appropriate files on the host machine, which it will then put into/get from the container during the run.

The module also contains some convenience functions for working with Docker containers.

ablinfer.docker.get_file(container: <sphinx.ext.autodoc.importer._MockObject object at 0x7f2551318ba8>, path: str, dest: str = '.') → None[source]

Get a single file from a container.

Parameters:
  • path – The path to retrieve.
  • dest – The filename to extract to. If it is an existing directory, the filename from the tar file will be used.
ablinfer.docker.put_file(container: <sphinx.ext.autodoc.importer._MockObject object at 0x7f2551318da0>, path: str, fname: str, name: str = None, mode: int = 416) → None[source]

Put a single file into a container.

Only works on single regular files and ignores all metadata.

Parameters:
  • path – The directory in the container to extract to.
  • fname – The filename of the local file.
  • name – The name to store in the tar file; defaults to the basename of the file.
  • mode – The mode for the stored file (3-digit octal number).