benchbuild.container module

Container construction tool.

This tool assists in the creation of customized uchroot containers. You can define strategies and apply them on a given container base-image to have a fixed way of creating a user-space environment.

class benchbuild.container.BashStrategy[source]

Bases: benchbuild.container.ContainerStrategy

The user interface for setting up a bash inside the container.

run(context)[source]

Execute a container strategy.

Parameters:context – A context object with attributes used for the strategy.
class benchbuild.container.Container(executable)[source]

Bases: plumbum.cli.application.Application

Manage uchroot containers.

VERSION = '3.4.2.dev3+g0712eee'
builddir(tmpdir)[source]

Set the current builddir of the container.

input_file(_container)[source]

Find the input path of a uchroot container.

main(*args)[source]

Implement me (no need to call super)

mounts(user_mount)[source]

Save the current mount of the container into the settings.

output_file(_container)[source]

Find and writes the output path of a chroot container.

shell(custom_shell)[source]

The command to run inside the container.

verbosity

Sets an attribute

class benchbuild.container.ContainerBootstrap(executable)[source]

Bases: plumbum.cli.application.Application

Check for the needed files.

install_cmake_and_exit()[source]

Tell the user to install cmake and aborts the current process.

main(*args)[source]

Implement me (no need to call super)

class benchbuild.container.ContainerCreate(executable)[source]

Bases: plumbum.cli.application.Application

Create a new container with a predefined strategy.

We offer a variety of creation policies for a new container. By default a basic ‘spawn a bash’ policy is used. This just leaves you inside a bash that is started in the extracted container. After customization you can exit the bash and pack up the result.

main(*args)[source]

Implement me (no need to call super)

strategy(strategy)[source]

Select strategy based on key.

Parameters:strategy (str) – The strategy to select.
Returns:A strategy object.
class benchbuild.container.ContainerList(executable)[source]

Bases: plumbum.cli.application.Application

Prints a list of the known containers.

main(*args)[source]

Implement me (no need to call super)

class benchbuild.container.ContainerRun(executable)[source]

Bases: plumbum.cli.application.Application

Execute commannds inside a prebuilt container.

main(*args)[source]

Implement me (no need to call super)

class benchbuild.container.ContainerStrategy[source]

Bases: object

Interfaces for the different containers chosen by the experiment.

run(context)[source]

Execute a container strategy.

Parameters:context – A context object with attributes used for the strategy.
class benchbuild.container.MockObj(**kwargs)[source]

Bases: object

Context object to be used in strategies.

This object’s attributes are initialized on construction.

class benchbuild.container.SetupPolyJITGentooStrategy[source]

Bases: benchbuild.container.ContainerStrategy

Interface of using gentoo as a container for an experiment.

run(context)[source]

Setup a gentoo container suitable for PolyJIT.

benchbuild.container.clean_directories(builddir, in_dir=True, out_dir=True)[source]

Remove the in and out of the container if confirmed by the user.

benchbuild.container.find_hash(container_db, key)[source]

Find the first container in the database with the given key.

benchbuild.container.main(*args)[source]

Main entry point for the container tool.

benchbuild.container.pack_container(in_container, out_file)[source]

Pack a container image into a .tar.bz2 archive.

Parameters:
  • in_container (str) – Path string to the container image.
  • out_file (str) – Output file name.
benchbuild.container.run_in_container(command, container_dir)[source]

Run a given command inside a container.

Mounts a directory as a container at the given mountpoint and tries to run the given command inside the new container.

benchbuild.container.set_input_container(_container, cfg)[source]

Save the input for the container in the configurations.

benchbuild.container.setup_bash_in_container(builddir, _container, outfile, shell)[source]

Setup a bash environment inside a container.

Creates a new chroot, which the user can use as a bash to run the wanted projects inside the mounted container, that also gets returned afterwards.

benchbuild.container.setup_container(builddir, _container)[source]

Prepare the container and returns the path where it can be found.

benchbuild.container.setup_directories(builddir)[source]

Create the in and out directories of the container.