make the new 'spack load' faster (#14628)
before, a 'time spack load singularity' 4.129u 0.346s 0:04.47 99.7% 0+0k 0+8io 0pf+0w after, a 'time spack load singularity' 0.844u 0.319s 0:01.16 99.1% 0+0k 0+16io 0pf+0w
This commit is contained in:
parent
f58004e436
commit
3f5bed2e36
@ -12,6 +12,7 @@
|
|||||||
import spack.environment as ev
|
import spack.environment as ev
|
||||||
import spack.util.environment
|
import spack.util.environment
|
||||||
import spack.user_environment as uenv
|
import spack.user_environment as uenv
|
||||||
|
import spack.store
|
||||||
|
|
||||||
description = "add package to the user environment"
|
description = "add package to the user environment"
|
||||||
section = "user environment"
|
section = "user environment"
|
||||||
@ -63,15 +64,17 @@ def load(parser, args):
|
|||||||
tty.msg(*msg)
|
tty.msg(*msg)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if 'dependencies' in args.things_to_load:
|
with spack.store.db.read_transaction():
|
||||||
include_roots = 'package' in args.things_to_load
|
if 'dependencies' in args.things_to_load:
|
||||||
specs = [dep for spec in specs
|
include_roots = 'package' in args.things_to_load
|
||||||
for dep in spec.traverse(root=include_roots, order='post')]
|
specs = [dep for spec in specs
|
||||||
|
for dep in
|
||||||
|
spec.traverse(root=include_roots, order='post')]
|
||||||
|
|
||||||
env_mod = spack.util.environment.EnvironmentModifications()
|
env_mod = spack.util.environment.EnvironmentModifications()
|
||||||
for spec in specs:
|
for spec in specs:
|
||||||
env_mod.extend(uenv.environment_modifications_for_spec(spec))
|
env_mod.extend(uenv.environment_modifications_for_spec(spec))
|
||||||
env_mod.prepend_path(uenv.spack_loaded_hashes_var, spec.dag_hash())
|
env_mod.prepend_path(uenv.spack_loaded_hashes_var, spec.dag_hash())
|
||||||
cmds = env_mod.shell_modifications(args.shell)
|
cmds = env_mod.shell_modifications(args.shell)
|
||||||
|
|
||||||
sys.stdout.write(cmds)
|
sys.stdout.write(cmds)
|
||||||
|
Loading…
Reference in New Issue
Block a user