Skip to content

container support: decoupled - #293

Merged
simbuerg merged 72 commits into
masterfrom
f/container-support
Sep 29, 2020
Merged

simbuerg merged 72 commits into
masterfrom
f/container-support

Conversation

@simbuerg

@simbuerg simbuerg commented Aug 18, 2020

Copy link
Copy Markdown
Member

Support use of OCI Containers in Projects

This PR introduces support for OCI (and Docker) containers in Projects and Experiments. Running an experiment inside an OCI
compliant container removes the need to take care about dependencies on the host-machine and provides stability between system upgrades.
This brings BenchBuild one step closer to reproducability of experiments.

Design

The user has to be concerned with 3 types of container images.

  1. Project images -
  2. Experiment images -
  3. Base images - BenchBuild provides a hook (hard-coded for now) that declares a set of base images we can build a new
    image from. These images need to be able to install and run benchbuild. It is not required to use these, but recommended.

Requirements

  1. buildah https://buildah.io/
  2. podman https://podman.io/

Configuration

Benchbuild uses buildah to build container images. All images are stored in an isolated container registry. The location of this
registry can be controlled by Benchbuild's settings. The following settings are the defaults:

# Persistent storage for container images
BB_CONTAINER_ROOT=./containers/lib
# Temporary runtime data for container images
BB_CONTAINER_RUNROOT=./containers/run
# The container runtime to use.
BB_CONTAINER_RUNTIME=/usr/bin/crun
# Benchbuild's source directory to do a source-based install.
BB_CONTAINER_SOURCE=./

There are more options, but these are unused and/or deprecated.

Try it out

The following aliases help during testing. As long as you stay in the same directory as you run benchbuild from, these will always run against benchbuild's registry.

alias bpodman='podman --root ./containers/lib --runroot ./containers/run'
alias bbuildah='buildah --root ./containers/lib --runroot ./containers/run'

Both tools have access to the same local container registry. Buildah is used for container image construction and Podman is a drop-in replacement for docker (without the daemon).

Example:

In the current state of this PR, you can prepare images that are able to run the selected projects.

benchbuild container -E raw x264/benchbuild@538f09b5b9

This should result in the following images being committed to your container registry. Note that, podman and buildah share
the same registry.

❯ bbuildah images
REPOSITORY                      TAG                            IMAGE ID       CREATED        SIZE
localhost/raw/x264/benchbuild   538f09b5b9-tbbt-small-sintel   654da99bfbc8   9 hours ago    1.18 GB
localhost/x264/benchbuild       538f09b5b9-tbbt-small-sintel   2445d5af67f7   9 hours ago    1.18 GB
localhost/benchbuild            alpine                         5f46312b417d   9 hours ago    535 MB
docker.io/library/alpine        latest                         a24bb4013296   2 months ago   5.85 MB

❯ bpodman images
REPOSITORY                     TAG                           IMAGE ID      CREATED       SIZE
localhost/raw/x264/benchbuild  538f09b5b9-tbbt-small-sintel  654da99bfbc8  9 hours ago   1.18 GB
localhost/x264/benchbuild      538f09b5b9-tbbt-small-sintel  2445d5af67f7  9 hours ago   1.18 GB
localhost/benchbuild           alpine                        5f46312b417d  9 hours ago   535 MB
docker.io/library/alpine       latest                        a24bb4013296  2 months ago  5.85 MB

In the completed implementation, benchbuild will spawn the container and execute the experiments on the configured projects.
As a test, you can do this manually for now:

bpodman run --rm -it raw/x264/benchbuild:538f09b5b9-tbbt-small-sintel benchbuild -vvvvv run -E raw x264/benchbuild@538f09b5b9

Note: This will re-download static video files, due to a missing feature in the http downloader module. This is not a problem in these tests and will be fixed in the final release. Git-Downloads do not suffer from this.
The above command should yield the same results as a standard benchbuild run command:

benchbuild -vvvvv run -E raw x264/benchbuild@538f09b5b9

@simbuerg
simbuerg force-pushed the f/container-support branch 2 times, most recently from d0e8d09 to 1cac450 Compare August 18, 2020 23:29
@simbuerg
simbuerg force-pushed the f/container-support branch from 8b5c955 to aa78152 Compare September 1, 2020 16:46
@codecov

codecov Bot commented Sep 1, 2020

Copy link
Copy Markdown

Codecov Report

Merging #293 into master will increase coverage by 0.62%.
The diff coverage is 58.05%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #293      +/-   ##
==========================================
+ Coverage   53.71%   54.34%   +0.62%     
==========================================
  Files         112      124      +12     
  Lines        6404     7092     +688     
  Branches      666      730      +64     
==========================================
+ Hits         3440     3854     +414     
- Misses       2835     3110     +275     
+ Partials      129      128       -1     
Impacted Files Coverage Δ
benchbuild/settings.py 100.00% <ø> (ø)
benchbuild/source/git.py 76.36% <0.00%> (+0.92%) ⬆️
setup.py 0.00% <0.00%> (ø)
benchbuild/projects/benchbuild/bzip2.py 39.39% <16.66%> (+3.91%) ⬆️
benchbuild/environments/service_layer/handlers.py 23.52% <23.52%> (ø)
benchbuild/environments/entrypoints/cli.py 24.03% <24.03%> (ø)
benchbuild/cli/bootstrap.py 40.00% <33.33%> (-5.46%) ⬇️
benchbuild/projects/benchbuild/povray.py 27.11% <33.33%> (+2.55%) ⬆️
benchbuild/source/base.py 87.80% <35.71%> (-10.83%) ⬇️
...enchbuild/environments/service_layer/messagebus.py 39.47% <39.47%> (ø)
... and 57 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 162bb66...7ae2032. Read the comment docs.

Comment thread benchbuild/project.py
Comment thread benchbuild/project.py Outdated

@vulder vulder left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finish the rest of the review at home later :)

Comment thread benchbuild/cli/project.py Outdated
Comment thread benchbuild/cli/run.py Outdated
Comment thread benchbuild/environments/service_layer/messagebus.py
Comment thread benchbuild/environments/domain/declarative.py Outdated
self.append(model.AddLayer(sources, tgt))
return self

def copy_(self, sources: tp.Iterable[str], tgt: str) -> 'ContainerImage':

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it this method name ending in a _

Comment thread benchbuild/environments/domain/model.py
Comment thread benchbuild/environments/entrypoints/cli.py Outdated
Comment thread benchbuild/environments/service_layer/ui.py Outdated
Comment thread benchbuild/environments/service_layer/ui.py Outdated
Comment thread benchbuild/environments/entrypoints/cli.py
Comment thread benchbuild/environments/domain/declarative.py Outdated
Comment thread benchbuild/source/git.py
Comment thread benchbuild/utils/run.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants