Only run containers where the docker image exists
from __future__ import absolute_import
import argparse
+import docker
import os
import random
import sys
@@ -88,6 +89,14 @@ def main():
list_algorithms(args.definitions)
sys.exit(0)
+ # See which Docker images we have available
+ docker_client = docker.from_env()
+ docker_tags = set()
+ for image in docker_client.images.list():
+ for tag in image.tags:
+ tag, _ = tag.split(':')
+ docker_tags.add(tag)
+
# Nmslib specific code
# Remove old indices stored on disk
if os.path.exists(INDEX_DIR):
@@ -112,6 +121,10 @@ def main():
print('running only', args.docker_tag)
definitions = [d for d in definitions if d.docker_tag == args.docker_tag]
+ if set(d.docker_tag for d in definitions).difference(docker_tags):
+ definitions = [d for d in definitions if d.docker_tag in docker_tags]
+ print('not all docker images available, only:', set(d.docker_tag for d in definitions))
+
if args.max_n_algorithms >= 0:
definitions = definitions[:args.max_n_algorithms]
