Jelajahi Sumber

Leave test images after stopping them (#3565)

This is in order to keep the cached images between benchmark runs to
speed them up.
Mike Smith 7 tahun lalu
induk
melakukan
8b0913fb11

+ 1 - 1
README.md

@@ -45,7 +45,7 @@ That run script is pretty wordy, but each and every flag is required. Unfortunat
 
 You may not want to call step 4 from above every time. You can add an `alias` to your `~/.bash_aliases` file to shorten it since it will not change once configured:
 
-`$ alias tfb="docker run -it --network=tfb -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source=[ABS PATH TO THIS DIR],target=/FrameworkBenchmarks techempower/tfb"`
+`$ alias tfb="docker network create tfb > /dev/null 2>&1 && docker run -it --network=tfb -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source=[ABS PATH TO THIS DIR],target=/FrameworkBenchmarks techempower/tfb"`
 
 `$ source ~/.bash_aliases`
 

+ 1 - 1
deployment/vagrant/bootstrap.sh

@@ -39,7 +39,7 @@ Welcome to the FrameworkBenchmarks project!
 EOF
 
   cat <<EOF > /home/vagrant/.bash_aliases
-alias tfb="docker run -it --network=tfb -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source=/home/vagrant/FrameworkBenchmarks,target=/FrameworkBenchmarks techempower/tfb"
+alias tfb="docker network create tfb > /dev/null 2>&1 && docker run -it --network=tfb -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source=/home/vagrant/FrameworkBenchmarks,target=/FrameworkBenchmarks techempower/tfb"
 EOF
 
   sudo mv motd /etc/

+ 0 - 8
toolset/run-tests.py

@@ -82,11 +82,6 @@ def main(argv=None):
         ''')
 
     # Suite options
-    parser.add_argument(
-        '--publish',
-        action='store_true',
-        default=False,
-        help='Builds and publishes all the docker images in the suite')
     parser.add_argument(
         '--build',
         nargs='+',
@@ -216,9 +211,6 @@ def main(argv=None):
     if config.new:
         Scaffolding(config)
 
-    elif config.publish:
-        docker_helper.publish(config)
-
     elif config.build:
         docker_helper.build(config, config.build)
 

+ 0 - 1
toolset/utils/benchmark_config.py

@@ -29,7 +29,6 @@ class BenchmarkConfig:
 
         self.duration = args.duration
         self.exclude = args.exclude
-        self.publish = args.publish
         self.build = args.build
         self.quiet = args.quiet
         self.server_host = args.server_host

+ 1 - 49
toolset/utils/docker_helper.py

@@ -1,7 +1,6 @@
 import os
 import socket
 import fnmatch
-import multiprocessing
 import json
 import docker
 import time
@@ -29,7 +28,7 @@ def clean(benchmarker_config):
         if len(image.tags) > 0:
             # 'techempower/tfb.test.gemini:0.1' -> 'techempower/tfb.test.gemini'
             image_tag = image.tags[0].split(':')[0]
-            if image_tag != 'techempower/tfb':
+            if image_tag != 'techempower/tfb' and 'techempower' in image_tag:
                 client.images.remove(image.id, force=True)
     client.images.prune()
 
@@ -47,41 +46,6 @@ def clean(benchmarker_config):
     client.images.prune()
 
 
-def publish(benchmarker_config):
-    '''
-    Builds fresh versions of all the docker container images known in the 
-    system and attempts to publish them to dockerhub.
-    Note: this requires `docker login` to have been performed prior to the
-    call.
-    '''
-    start_time = time.time()
-
-    docker_buildargs = {
-        'CPU_COUNT': str(multiprocessing.cpu_count()),
-        'MAX_CONCURRENCY': str(max(benchmarker_config.concurrency_levels)),
-        'TFB_DATABASE': str(benchmarker_config.database_host)
-    }
-
-    # Force building instead of pulling
-    benchmarker_config.build = True
-    tests = gather_tests(benchmarker_config=benchmarker_config)
-    for test in tests:
-        __build_dependencies(benchmarker_config, test, docker_buildargs)
-
-    client = docker.DockerClient(
-        base_url=benchmarker_config.server_docker_host)
-
-    client.login("USERNAME", "PASSWORD")
-
-    for image in client.images.list():
-        has_tags = len(image.tags) > 0
-        if has_tags and 'techempower' in image.tags[0] and 'tfb.test' not in image.tags[0]:
-            log("Pushing docker image: %s" % image.tags[0].split(':')[0])
-            client.images.push(image.tags[0].split(':')[0])
-
-    log("Publish took: %s seconds" % (time.time() - start_time))
-
-
 def build(benchmarker_config, test_names, build_log_dir=os.devnull):
     '''
     Builds the dependency chain as well as the test implementation docker images
@@ -262,9 +226,6 @@ def stop(benchmarker_config=None,
         # Stop all our running containers
         for container in containers:
             container.stop()
-            # 'techempower/tfb.test.gemini:0.1' -> 'techempower/tfb.test.gemini'
-            client.images.remove(
-                container.image.tags[0].split(':')[0], force=True)
 
     database_client = docker.DockerClient(
         base_url=benchmarker_config.database_docker_host)
@@ -281,15 +242,6 @@ def stop(benchmarker_config=None,
     else:
         database_container.stop()
 
-    client.images.prune()
-    client.containers.prune()
-    client.volumes.prune()
-
-    if benchmarker_config.server_docker_host != benchmarker_config.database_docker_host:
-        database_client.images.prune()
-        database_client.containers.prune()
-        database_client.volumes.prune()
-
 
 def find(path, pattern):
     '''