diff options
author | Andrew W Elble <aweits@rit.edu> | 2020-01-27 23:53:52 -0500 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2020-01-27 20:53:52 -0800 |
commit | 3f5bed2e36640798c6d1d7097885e8411931f1a6 (patch) | |
tree | 0d025fb355da941e8754b40a69ad5482c3df9501 /lib | |
parent | f58004e4369a97d514bc143284f423aeaead3964 (diff) | |
download | spack-3f5bed2e36640798c6d1d7097885e8411931f1a6.tar.gz spack-3f5bed2e36640798c6d1d7097885e8411931f1a6.tar.bz2 spack-3f5bed2e36640798c6d1d7097885e8411931f1a6.tar.xz spack-3f5bed2e36640798c6d1d7097885e8411931f1a6.zip |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/load.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/spack/spack/cmd/load.py b/lib/spack/spack/cmd/load.py index 80c7263a7a..09f3fd31ee 100644 --- a/lib/spack/spack/cmd/load.py +++ b/lib/spack/spack/cmd/load.py @@ -12,6 +12,7 @@ import spack.cmd.common.arguments as arguments import spack.environment as ev import spack.util.environment import spack.user_environment as uenv +import spack.store description = "add package to the user environment" section = "user environment" @@ -63,15 +64,17 @@ def load(parser, args): tty.msg(*msg) return 1 - if 'dependencies' in args.things_to_load: - include_roots = 'package' in args.things_to_load - specs = [dep for spec in specs - for dep in spec.traverse(root=include_roots, order='post')] + with spack.store.db.read_transaction(): + if 'dependencies' in args.things_to_load: + include_roots = 'package' in args.things_to_load + specs = [dep for spec in specs + for dep in + spec.traverse(root=include_roots, order='post')] - env_mod = spack.util.environment.EnvironmentModifications() - for spec in specs: - env_mod.extend(uenv.environment_modifications_for_spec(spec)) - env_mod.prepend_path(uenv.spack_loaded_hashes_var, spec.dag_hash()) - cmds = env_mod.shell_modifications(args.shell) + env_mod = spack.util.environment.EnvironmentModifications() + for spec in specs: + env_mod.extend(uenv.environment_modifications_for_spec(spec)) + env_mod.prepend_path(uenv.spack_loaded_hashes_var, spec.dag_hash()) + cmds = env_mod.shell_modifications(args.shell) - sys.stdout.write(cmds) + sys.stdout.write(cmds) |