Skip to content

Commit a03bab0

Browse files
authored
Replace create.py with spack stack extension
Move create.py functionality into Spack extension in the jcsda_emc_spack_stack branch of Spack. This uses Spack Python code directly for interacting with YAML and composing environments. It also offers more flexibility into adding more custom commands such as meta_module creation and stack management. To use: `spack stack create env/container -h`.
1 parent 5171076 commit a03bab0

File tree

17 files changed

+49
-42
lines changed

17 files changed

+49
-42
lines changed

.github/actions/setup-spack-stack/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ runs:
163163
fi
164164
165165
source setup.sh
166-
./create.py environment --site default --app ${{ inputs.app }} --name ${{ inputs.app }}
166+
spack stack create env --site default --app ${{ inputs.app }} --name ${{ inputs.app }}
167167
spack env activate envs/${{ inputs.app }}
168168
169169
# LLVM Clang not in PATH, search for it specifically

.github/workflows/unit-tests.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: unit-tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
workflow_dispatch:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: checkout
14+
uses: actions/checkout@v2
15+
with:
16+
submodules: true
17+
18+
- name: run-unit-tests
19+
run: |
20+
source ./setup.sh
21+
spack unit-test --extension=stack

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
envs
33
__pycache__
44
cache
5+
.vscode

.spackstack

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lets spack stack command find top-level spack-stack directory for config location

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ spack-stack is a collaborative effort between the NOAA Environmental Modeling Ce
44

55
[spack](https://github.com/spack/spack) is a community-supported, multi-platform, Python-based package manager originally developed by the Lawrence Livermore National Laboratory (LLNL; https://computing.llnl.gov/projects/spack-hpc-package-manager). It is provided as a submodule so that a stable version can be referenced. [See the Spack Documentation for more information](https://spack.readthedocs.io/en/latest/)
66

7-
spack-stack is mainly a collection of Spack configuration files, but provides a few Python scripts to simplify the installation process:
8-
- `create.py` is provided to copy common, site-specific, and application-specific configuration files into a coherent Spack environment and to create container recipes
7+
spack-stack is mainly a collection of Spack configuration files, but provides a Spack extension to simplify the installation process:
8+
- `spack stack create` is provided to copy common, site-specific, and application-specific configuration files into a coherent Spack environment and to create container recipes
99
- `meta_modules/setup_meta_modules.py` creates compiler, MPI and Python meta-modules for a convenient setup of a user environment using modules (lua and tcl)
1010

1111
spack-stack is maintained by:
@@ -42,17 +42,17 @@ cd spack-stack
4242
source setup.sh
4343
4444
# Basic usage of create.py
45-
./create.py -h
45+
spack stack create -h
4646
```
4747

4848
### Create local environment
4949
```
5050
# See a list of sites and apps
51-
./create.py environment -h
51+
spack stack create env -h
5252
5353
# Create a pre-configured Spack environment in envs/<app>.<site>
5454
# (copies site-specific, application-specific, and common config files into the environment directory)
55-
./create.py environment --site hera --app jedi-fv3 --name jedi-fv3.hera
55+
spack stack create env --site hera --app jedi-fv3 --name jedi-fv3.hera
5656
5757
# Activate the newly created environment
5858
# Optional: decorate the command line prompt using -p
@@ -81,13 +81,13 @@ spack module lmod refresh
8181
### Create container
8282
```
8383
# See a list of preconfigured containers
84-
./create.py container -h
84+
spack stack create container -h
8585
8686
# Create container spack definition (spack.yaml) in directory envs/<spec>.<config>
87-
./create.py container --config docker-ubuntu-gcc-openmpi --spec esmf
87+
spack stack create container docker-ubuntu-gcc-openmpi --app ufs-weather-model
8888
8989
# Descend into container environment directory
90-
cd envs/esmf.docker-ubuntu-gcc-openmpi
90+
cd envs/docker-ubuntu-gcc-openmpi.ufs-weather-model
9191
9292
# Optionally edit config file
9393
emacs spack.yaml
@@ -102,7 +102,7 @@ docker run -it myimage
102102
## Generating new site config
103103
Recommended: Start with an empty (default) site config. Then run `spack external find` to locate common external packages such as git, Perl, CMake, etc., and run `spack compiler find` to locate compilers in your path. Compilers or external packages with modules need to be added manually.
104104
```
105-
./create.py environment --site default --app jedi-ufs --name jedi-ufs.mysite
105+
spack stack create env --site default --app jedi-ufs --name jedi-ufs.mysite
106106
107107
# Descend into site config directory
108108
cd envs/jedi-ufs.mysite/site

configs/apps/empty/spack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ spack:
22
concretization: separately
33
view: false
44

5-
@CONFIG_INCLUDES@
5+
include: []
66

77
specs: []

configs/apps/jedi-ewok/spack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ spack:
22
concretization: separately
33
view: false
44

5-
@CONFIG_INCLUDES@
5+
include: []
66

77
specs:
88
- jedi-ewok-env

configs/apps/jedi-fv3/spack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ spack:
22
concretization: separately
33
view: false
44

5-
@CONFIG_INCLUDES@
5+
include: []
66

77
specs:
88
- jedi-fv3-bundle-env

configs/apps/jedi-tools/spack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ spack:
22
concretization: separately
33
view: false
44

5-
@CONFIG_INCLUDES@
5+
include: []
66

77
specs:
88
- jedi-tools-env

configs/apps/jedi-ufs/spack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ spack:
22
concretization: separately
33
view: false
44

5-
@CONFIG_INCLUDES@
5+
include: []
66

77
specs:
88
- jedi-ufs-bundle-env

configs/apps/jedi-um/spack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ spack:
22
concretization: separately
33
view: false
44

5-
@CONFIG_INCLUDES@
5+
include: []
66

77
specs:
88
- jedi-um-bundle-env

configs/apps/nceplibs/spack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ spack:
33
concretization: separately
44
view: false
55

6-
@CONFIG_INCLUDES@
6+
include: []
77

88
specs:
99
- nceplibs-bundle-env

configs/apps/soca/spack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ spack:
22
concretization: separately
33
view: false
44

5-
@CONFIG_INCLUDES@
5+
include: []
66

77
specs:
88
- soca-bundle-env

configs/apps/spack.template.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ spack:
33
concretization: separately
44
view: false
55

6-
@CONFIG_INCLUDES@
6+
# Custom includes which can be a directory containg
7+
# Spack config files or a file itself.
8+
include: []
79

810
# File in specs
911
specs:

configs/apps/ufs-weather-model/spack.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
# Template spack.yaml for apps
21
spack:
32
concretization: separately
43
view: false
54

6-
@CONFIG_INCLUDES@
5+
include: []
76

87
specs:
98
- ufs-weather-model-env

configs/containers/docker-ubuntu-gcc-openmpi.yaml

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ spack:
2222
extra_rpaths: []
2323

2424
# Basic package config from configs/common/packages.yaml
25-
@PACKAGE_CONFIG@
2625
# Additional package config for container
26+
packages:
2727
gcc:
2828
buildable: False
2929
externals:
@@ -40,22 +40,7 @@ spack:
4040
- spec: git-lfs@2
4141
prefix: /usr
4242

43-
specs:
44-
### Not yet tested
45-
#- jedi-ewok-env
46-
#- jedi-um-bundle-env
47-
#- jedi-tools-env
48-
#- ufs-weather-model-env
49-
#- nceplibs-bundle-env
50-
### Tested to work - increasing level of complexity
51-
#- wget
52-
#- esmf
53-
#- base-env
54-
#- jedi-base-env
55-
#- jedi-fv3-bundle-env
56-
#- jedi-ufs-bundle-env
57-
#- jedi-um-bundle-env
58-
- @SPEC@
43+
specs: []
5944

6045
container:
6146

@@ -91,15 +76,13 @@ spack:
9176
- g++-10
9277
- gfortran-10
9378
- cpp-10
94-
#- libgomp
9579
- git
9680
- git-lfs
9781
final:
9882
- gcc-10
9983
- g++-10
10084
- gfortran-10
10185
- cpp-10
102-
#- libgomp
10386
- git
10487
- git-lfs
10588

@@ -114,5 +97,5 @@ spack:
11497

11598
# Labels for the image
11699
labels:
117-
app: "@SPEC@"
100+
app: ""
118101
mpi: "openmpi"

spack

Submodule spack updated from 1fb4a7b to 4c357f8

0 commit comments

Comments
 (0)