sweetpea.core.generate.tools.docker_utility module

This module provides simple Docker command-line functionality. It is generally discouraged to use this functionality, as we prefer using the bundled executables from sweetpea-org/unigen-exe. However, these executables may lag behind their respective repositories, so we provide the Docker functionality to stay on the cutting edge.

sweetpea.core.generate.tools.docker_utility.DEFAULT_DOCKER_MODE_ON = False

Whether Docker should be used by default.

class sweetpea.core.generate.tools.docker_utility.DockerRunReturnCode(value)

Bases: sweetpea.core.generate.tools.return_code.ReturnCodeEnum

Invocation of the docker run command can result in one of the following special return codes. Any other return code is the result of invoking the indicated command in the container.

Based on this reference information.

DockerDaemonError = 125

There was an error executing the Docker daemon itself.

ContainedCommandCannotBeInvokedError = 126

The command produced an error in the container.

ContainedCommandCannotBeFoundError = 127

The command specified could not be found in the container.

exception sweetpea.core.generate.tools.docker_utility.DockerRunError(returncode, stderr)

Bases: Exception

An error raised when something fails while invoking Docker.

Parameters
sweetpea.core.generate.tools.docker_utility.docker_run(container, args=None, input_bytes=None)

Runs a Docker container, with the optional arguments and input if provided.

If the execution produces an error, a DockerRunError will be raised.

Parameters
  • container (str) –

  • args (Optional[List[str]]) –

  • input_bytes (Optional[bytes]) –

Return type

subprocess.CompletedProcess