Inlined llnl.util.multiproc.execute (abstraction was not very useful)
This commit is contained in:
parent
675f944a3a
commit
477ce206c2
@ -32,26 +32,6 @@ def _deferred_call():
|
|||||||
return _impl
|
return _impl
|
||||||
|
|
||||||
|
|
||||||
def invoke(f):
|
|
||||||
return f()
|
|
||||||
|
|
||||||
|
|
||||||
def execute(command_list, map_fn=map, transformation=invoke):
|
|
||||||
"""Execute a list of packaged commands and return their result.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
command_list: list of commands to be executed
|
|
||||||
map_fn: object that execute each command. Must have the
|
|
||||||
same semantic as ``map``
|
|
||||||
transformation: callable invoked on each item to construct
|
|
||||||
the output list
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
List of results
|
|
||||||
"""
|
|
||||||
return map_fn(transformation, command_list)
|
|
||||||
|
|
||||||
|
|
||||||
class Barrier:
|
class Barrier:
|
||||||
"""Simple reusable semaphore barrier.
|
"""Simple reusable semaphore barrier.
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
import multiprocessing.pool
|
import multiprocessing.pool
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import llnl.util.multiproc
|
|
||||||
from llnl.util.lang import list_modules
|
from llnl.util.lang import list_modules
|
||||||
|
|
||||||
import spack.paths
|
import spack.paths
|
||||||
@ -196,7 +195,7 @@ def find_compilers(*paths):
|
|||||||
tags.extend(t), commands.extend(c)
|
tags.extend(t), commands.extend(c)
|
||||||
|
|
||||||
tp = multiprocessing.pool.ThreadPool()
|
tp = multiprocessing.pool.ThreadPool()
|
||||||
compiler_versions = llnl.util.multiproc.execute(commands, tp.map)
|
compiler_versions = tp.map(lambda x: x(), commands)
|
||||||
tp.close()
|
tp.close()
|
||||||
|
|
||||||
return spack.compiler.make_compiler_list(tags, compiler_versions)
|
return spack.compiler.make_compiler_list(tags, compiler_versions)
|
||||||
|
Loading…
Reference in New Issue
Block a user