Skip to content

Commit

Permalink
continuing installation even if single algos fail. status of each als…
Browse files Browse the repository at this point in the history
…o is printed at the end
  • Loading branch information
stephenleo committed Dec 4, 2020
1 parent 931a957 commit 7ef46a1
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ def build(library, args):
q = " ".join(["--build-arg " + x.replace(" ", "\\ ") for x in args])
else:
q = ""
subprocess.check_call(
'docker build %s --rm -t ann-benchmarks-%s -f'
' install/Dockerfile.%s .' % (q, library, library), shell=True)

try:
subprocess.check_call(
'docker build %s --rm -t ann-benchmarks-%s -f'
' install/Dockerfile.%s .' % (q, library, library), shell=True)
return {library: 'success'}
except subprocess.CalledProcessError:
return {library: 'fail'}


def build_multiprocess(args):
Expand Down Expand Up @@ -56,9 +61,11 @@ def build_multiprocess(args):
tags = [fn.split('.')[-1] for fn in os.listdir('install') if fn.startswith('Dockerfile.')]

if args.proc == 1:
[build(tag, args.build_arg) for tag in tags]
install_status = [build(tag, args.build_arg) for tag in tags]
else:
pool = Pool(processes=args.proc)
pool.map(build_multiprocess, [(tag, args.build_arg) for tag in tags])
install_status = pool.map(build_multiprocess, [(tag, args.build_arg) for tag in tags])
pool.close()
pool.join()

print('\n\nInstall Status:\n' + '\n'.join(str(algo) for algo in install_status))

0 comments on commit 7ef46a1

Please sign in to comment.