From 45870ba529a29619d3252b8febaed8aa1821a4c7 Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Thu, 13 Jul 2023 15:57:27 -0700 Subject: [PATCH 1/3] Split spack functionality into setup and execute modules --- .../modules/scripts/spack-execute/README.md | 63 +++++++++++++ .../modules/scripts/spack-execute/main.tf | 69 ++++++++++++++ .../modules/scripts/spack-execute/outputs.tf | 35 ++++++++ .../templates/execute_commands.yml.tpl | 0 .../scripts/spack-execute/variables.tf | 89 +++++++++++++++++++ .../modules/scripts/spack-execute/versions.tf | 25 ++++++ .../modules/scripts/spack-install/README.md | 16 ++-- .../modules/scripts/spack-install/main.tf | 47 ++++------ .../modules/scripts/spack-install/outputs.tf | 12 ++- .../scripts/spack-install/variables.tf | 63 ++++--------- .../modules/scripts/spack-install/versions.tf | 5 ++ modules/scripts/startup-script/README.md | 2 +- modules/scripts/startup-script/variables.tf | 2 +- tools/duplicate-diff.py | 2 +- 14 files changed, 342 insertions(+), 88 deletions(-) create mode 100644 community/modules/scripts/spack-execute/README.md create mode 100644 community/modules/scripts/spack-execute/main.tf create mode 100644 community/modules/scripts/spack-execute/outputs.tf rename community/modules/scripts/{spack-install => spack-execute}/templates/execute_commands.yml.tpl (100%) create mode 100644 community/modules/scripts/spack-execute/variables.tf create mode 100644 community/modules/scripts/spack-execute/versions.tf diff --git a/community/modules/scripts/spack-execute/README.md b/community/modules/scripts/spack-execute/README.md new file mode 100644 index 0000000000..e516796f9a --- /dev/null +++ b/community/modules/scripts/spack-execute/README.md @@ -0,0 +1,63 @@ + +Copyright 2023 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.0.0 | +| [local](#requirement\_local) | ~> 2.0.0 | + +## Providers + +| Name | Version | +|------|---------| +| [local](#provider\_local) | ~> 2.0.0 | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [startup\_script](#module\_startup\_script) | github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script | v1.20.0 | + +## Resources + +| Name | Type | +|------|------| +| [local_file.debug_file_ansible_execute](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [commands](#input\_commands) | String of commands to run within this module | `string` | `null` | no | +| [data\_files](#input\_data\_files) | A list of files to be transferred prior to running commands.
It must specify one of 'source' (absolute local file path) or 'content' (string).
It must specify a 'destination' with absolute path where file should be placed. | `list(map(string))` | `[]` | no | +| [deployment\_name](#input\_deployment\_name) | Name of deployment, used to name bucket containing spack scripts. | `string` | n/a | yes | +| [gcs\_bucket\_path](#input\_gcs\_bucket\_path) | The GCS path for storage bucket and the object, starting with `gs://`. | `string` | n/a | yes | +| [labels](#input\_labels) | Key-value pairs of labels to be added to created resources. | `map(string)` | n/a | yes | +| [log\_file](#input\_log\_file) | Defines the logfile that script output will be written to | `string` | `"/var/log/spack.log"` | no | +| [project\_id](#input\_project\_id) | Project in which the HPC deployment will be created. | `string` | n/a | yes | +| [region](#input\_region) | Region to place bucket containing spack scripts. | `string` | n/a | yes | +| [spack\_runner](#input\_spack\_runner) | Runner from previous spack-install or spack-execute to be chained with scripts generated by this module. |
object({
type = string
content = string
destination = string
})
| n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [controller\_startup\_script](#output\_controller\_startup\_script) | Path to the Spack installation script, duplicate for SLURM controller. | +| [gcs\_bucket\_path](#output\_gcs\_bucket\_path) | Bucket containing the startup scripts for spack, to be reused by spack-execute module. | +| [spack\_runner](#output\_spack\_runner) | Single runner that combines scripts from this module and any previously chained spack-execute or spack-install modules. | +| [startup\_script](#output\_startup\_script) | Path to the Spack installation script. | + diff --git a/community/modules/scripts/spack-execute/main.tf b/community/modules/scripts/spack-execute/main.tf new file mode 100644 index 0000000000..9838ac76e5 --- /dev/null +++ b/community/modules/scripts/spack-execute/main.tf @@ -0,0 +1,69 @@ +/** + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +locals { + # This label allows for billing report tracking based on module. + labels = merge(var.labels, { ghpc_module = "spack-execute" }) +} + +locals { + commands_content = var.commands == null ? "echo 'no spack commands provided'" : indent(4, yamlencode(var.commands)) + + execute_contents = templatefile( + "${path.module}/templates/execute_commands.yml.tpl", + { + pre_script = ". /etc/profile.d/spack.sh" + log_file = var.log_file + commands = local.commands_content + } + ) + + data_runners = [for data_file in var.data_files : merge(data_file, { type = "data" })] + + execute_md5 = substr(md5(local.execute_contents), 0, 4) + execute_runner = { + type = "ansible-local" + content = local.execute_contents + destination = "spack_execute_${local.execute_md5}.yml" + } + + runners = concat([var.spack_runner], local.data_runners, [local.execute_runner]) + + # Destinations should be unique while also being known at time of apply + combined_unique_string = join("\n", [for runner in local.runners : runner["destination"]]) + combined_md5 = substr(md5(local.combined_unique_string), 0, 4) + combined_runner = { + type = "shell" + content = module.startup_script.startup_script + destination = "combined_install_spack_${local.combined_md5}.sh" + } +} + +module "startup_script" { + source = "github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script?ref=v1.20.0" + + labels = local.labels + project_id = var.project_id + deployment_name = var.deployment_name + region = var.region + runners = local.runners + gcs_bucket_path = var.gcs_bucket_path +} + +resource "local_file" "debug_file_ansible_execute" { + content = local.execute_contents + filename = "${path.module}/debug_execute_${local.execute_md5}.yml" +} diff --git a/community/modules/scripts/spack-execute/outputs.tf b/community/modules/scripts/spack-execute/outputs.tf new file mode 100644 index 0000000000..65fae325b7 --- /dev/null +++ b/community/modules/scripts/spack-execute/outputs.tf @@ -0,0 +1,35 @@ +/** + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +output "startup_script" { + description = "Path to the Spack installation script." + value = module.startup_script.startup_script +} + +output "controller_startup_script" { + description = "Path to the Spack installation script, duplicate for SLURM controller." + value = module.startup_script.startup_script +} + +output "spack_runner" { + description = "Single runner that combines scripts from this module and any previously chained spack-execute or spack-install modules." + value = local.combined_runner +} + +output "gcs_bucket_path" { + description = "Bucket containing the startup scripts for spack, to be reused by spack-execute module." + value = var.gcs_bucket_path +} diff --git a/community/modules/scripts/spack-install/templates/execute_commands.yml.tpl b/community/modules/scripts/spack-execute/templates/execute_commands.yml.tpl similarity index 100% rename from community/modules/scripts/spack-install/templates/execute_commands.yml.tpl rename to community/modules/scripts/spack-execute/templates/execute_commands.yml.tpl diff --git a/community/modules/scripts/spack-execute/variables.tf b/community/modules/scripts/spack-execute/variables.tf new file mode 100644 index 0000000000..03a5d94d4b --- /dev/null +++ b/community/modules/scripts/spack-execute/variables.tf @@ -0,0 +1,89 @@ +/** + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +variable "project_id" { + description = "Project in which the HPC deployment will be created." + type = string +} + +variable "deployment_name" { + description = "Name of deployment, used to name bucket containing spack scripts." + type = string +} + +variable "region" { + description = "Region to place bucket containing spack scripts." + type = string +} + +variable "labels" { + description = "Key-value pairs of labels to be added to created resources." + type = map(string) +} + +variable "log_file" { + description = "Defines the logfile that script output will be written to" + default = "/var/log/spack.log" + type = string +} + +variable "data_files" { + description = <<-EOT + A list of files to be transferred prior to running commands. + It must specify one of 'source' (absolute local file path) or 'content' (string). + It must specify a 'destination' with absolute path where file should be placed. + EOT + type = list(map(string)) + default = [] + validation { + condition = alltrue([for r in var.data_files : substr(r["destination"], 0, 1) == "/"]) + error_message = "All destinations must be absolute paths and start with '/'." + } + validation { + condition = alltrue([ + for r in var.data_files : + can(r["content"]) != can(r["source"]) + ]) + error_message = "A data_file must specify either 'content' or 'source', but never both." + } + validation { + condition = alltrue([ + for r in var.data_files : + lookup(r, "content", lookup(r, "source", null)) != null + ]) + error_message = "A data_file must specify a non-null 'content' or 'source'." + } +} + +variable "commands" { + description = "String of commands to run within this module" + type = string + default = null +} + +variable "spack_runner" { + description = "Runner from previous spack-install or spack-execute to be chained with scripts generated by this module." + type = object({ + type = string + content = string + destination = string + }) +} + +variable "gcs_bucket_path" { + description = "The GCS path for storage bucket and the object, starting with `gs://`." + type = string +} diff --git a/community/modules/scripts/spack-execute/versions.tf b/community/modules/scripts/spack-execute/versions.tf new file mode 100644 index 0000000000..c9927a3d15 --- /dev/null +++ b/community/modules/scripts/spack-execute/versions.tf @@ -0,0 +1,25 @@ +/** + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +terraform { + required_version = ">= 1.0.0" + required_providers { + local = { + source = "hashicorp/local" + version = "~> 2.0.0" + } + } +} diff --git a/community/modules/scripts/spack-install/README.md b/community/modules/scripts/spack-install/README.md index f47b872879..f9f56d2114 100644 --- a/community/modules/scripts/spack-install/README.md +++ b/community/modules/scripts/spack-install/README.md @@ -190,12 +190,14 @@ limitations under the License. | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0.0 | +| [google](#requirement\_google) | >= 4.42 | | [local](#requirement\_local) | >= 2.0.0 | ## Providers | Name | Version | |------|---------| +| [google](#provider\_google) | >= 4.42 | | [local](#provider\_local) | >= 2.0.0 | ## Modules @@ -208,7 +210,7 @@ limitations under the License. | Name | Type | |------|------| -| [local_file.debug_file_ansible_execute](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file) | resource | +| [google_storage_bucket.bucket](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket) | resource | | [local_file.debug_file_shell_install](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file) | resource | ## Inputs @@ -219,19 +221,17 @@ limitations under the License. | [chgrp\_group](#input\_chgrp\_group) | Group to chgrp the Spack clone to. Default will not modify the clone. | `string` | `null` | no | | [chmod\_mode](#input\_chmod\_mode) | Mode to chmod the Spack clone to. Defaults to null (i.e. do not modify).
For usage information see:
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html#parameter-mode | `string` | `"a+rwxs"` | no | | [chown\_owner](#input\_chown\_owner) | Owner to chown the Spack clone to. Default will not modify the clone. | `string` | `null` | no | -| [commands](#input\_commands) | String of commands to run within this module | `string` | `null` | no | | [compilers](#input\_compilers) | DEPRECATED

The following `commands` can be used to install compilers:
spack install gcc@10.3.0 target=x86_64
spack load gcc@10.3.0 target=x86_64
spack compiler find --scope site
spack clean -s
spack unload gcc@10.3.0
Defines compilers for spack to install before installing packages. | `list(string)` | `null` | no | -| [concretize\_flags](#input\_concretize\_flags) | DEPRECATED - spack concretize is now performed using the `commands` variable. | `string` | `null` | no | +| [concretize\_flags](#input\_concretize\_flags) | DEPRECATED - spack concretize is now performed using the [spack-execute](../spack-execute/) module `commands` variable. | `string` | `null` | no | | [configs](#input\_configs) | DEPRECATED

The following `commands` can be used to add a single config:
spack config --scope defaults add config:default:true
Alternatively, use `data_files` to transfer a config file and use the `spack config add -f ` command to add the config.

List of configuration options to set within spack. | `list(map(any))` | `null` | no | -| [data\_files](#input\_data\_files) | A list of files to be transferred prior to running commands.
It must specify one of 'source' (absolute local file path) or 'content' (string).
It must specify a 'destination' with absolute path where file should be placed. | `list(map(string))` | `[]` | no | | [deployment\_name](#input\_deployment\_name) | Name of deployment, used to name bucket containing startup script. | `string` | n/a | yes | | [environments](#input\_environments) | DEPRECATED

The following `commands` can be used to configure an environment:
if ! spack env list \| grep -q my-env; then
spack env create my-env
fi
spack env activate my-env
spack add intel-mpi@2018.4.274 %gcc@10.3.0
spack concretize
spack install
Defines spack environments to configure.
For more information, see: https://spack.readthedocs.io/en/latest/environments.html. | `any` | `null` | no | | [gpg\_keys](#input\_gpg\_keys) | DEPRECATED

The following `commands` can be used to create a new GPG key:
spack gpg init
spack gpg create
Alternatively, `data_files` can be used to transfer an existing GPG key. Then use `spack gpg trust ` to add the key to the keyring.

GPG Keys to trust within spack. | `list(map(any))` | `null` | no | | [install\_dir](#input\_install\_dir) | Directory to install spack into. | `string` | `"/sw/spack"` | no | -| [install\_flags](#input\_install\_flags) | DEPRECATED - spack install is now performed using the `commands` variable. | `string` | `null` | no | +| [install\_flags](#input\_install\_flags) | DEPRECATED - spack install is now performed using the [spack-execute](../spack-execute/) module `commands` variable. | `string` | `null` | no | | [labels](#input\_labels) | Key-value pairs of labels to be added to created resources. | `map(string)` | n/a | yes | -| [licenses](#input\_licenses) | DEPRECATED

Use `data_files` variable to install license files:
data_files = [{
source = "/abs/path/on/deployment/machine/license.lic"
destination = "/sw/spack/etc/spack/licenses/license.lic"
}]
List of software licenses to install within spack. |
list(object({
source = string
dest = string
}))
| `null` | no | -| [log\_file](#input\_log\_file) | Defines the logfile that script output will be written to | `string` | `"/var/log/spack.log"` | no | +| [licenses](#input\_licenses) | DEPRECATED

Use [spack-execute](../spack-execute/) module with `data_files` variable to install license files:
data_files = [{
source = "/abs/path/on/deployment/machine/license.lic"
destination = "/sw/spack/etc/spack/licenses/license.lic"
}]
List of software licenses to install within spack. |
list(object({
source = string
dest = string
}))
| `null` | no | +| [log\_file](#input\_log\_file) | DEPRECATED

All install logs are printed to stdout/stderr.
Execution log\_file location can be set on spack-execute module. | `string` | `null` | no | | [packages](#input\_packages) | DEPRECATED

The following `commands` can be used to install a package:
spack install intel-mpi@2018.4.274 %gcc@10.3.0
Defines root packages for spack to install. | `list(string)` | `null` | no | | [project\_id](#input\_project\_id) | Project in which the HPC deployment will be created. | `string` | n/a | yes | | [region](#input\_region) | Region to place bucket containing startup script. | `string` | n/a | yes | @@ -245,9 +245,11 @@ limitations under the License. | Name | Description | |------|-------------| | [controller\_startup\_script](#output\_controller\_startup\_script) | Path to the Spack installation script, duplicate for SLURM controller. | +| [gcs\_bucket\_path](#output\_gcs\_bucket\_path) | Bucket containing the startup scripts for spack, to be reused by spack-execute module. | | [install\_spack\_deps\_runner](#output\_install\_spack\_deps\_runner) | Runner to install dependencies for spack using an ansible playbook. The
startup-script module will automatically handle installation of ansible.
- id: example-startup-script
source: modules/scripts/startup-script
settings:
runners:
- $(your-spack-id.install\_spack\_deps\_runner)
... | | [install\_spack\_runner](#output\_install\_spack\_runner) | Runner to install Spack using the startup-script module | | [setup\_spack\_runner](#output\_setup\_spack\_runner) | Adds Spack setup-env.sh script to /etc/profile.d so that it is called at shell startup. Among other things this adds Spack binary to user PATH. | | [spack\_path](#output\_spack\_path) | Path to the root of the spack installation | +| [spack\_runner](#output\_spack\_runner) | Runner to install Spack using the startup-script module | | [startup\_script](#output\_startup\_script) | Path to the Spack installation script. | diff --git a/community/modules/scripts/spack-install/main.tf b/community/modules/scripts/spack-install/main.tf index c3ab3eae09..4b8ede607a 100644 --- a/community/modules/scripts/spack-install/main.tf +++ b/community/modules/scripts/spack-install/main.tf @@ -59,40 +59,27 @@ locals { "content" = local.script_content "destination" = "install_spack.yml" } -} - -locals { - commands_content = var.commands == null ? "echo 'no spack commands provided'" : indent(4, yamlencode(var.commands)) - - execute_contents = templatefile( - "${path.module}/templates/execute_commands.yml.tpl", - { - pre_script = ". /etc/profile.d/spack.sh" - log_file = var.log_file - commands = local.commands_content - } - ) - data_runners = [for data_file in var.data_files : merge(data_file, { type = "data" })] + bucket_md5 = substr(md5("${var.project_id}.${var.deployment_name}"), 0, 4) + bucket_name = "spack-scripts-${local.bucket_md5}" + runners = [local.install_spack_deps_runner, local.install_spack_runner] - execute_md5 = substr(md5(local.execute_contents), 0, 4) - execute_runner = { - "type" = "ansible-local" - "content" = local.execute_contents - "destination" = "spack_execute_${local.execute_md5}.yml" - } - - runners = concat([local.install_spack_runner], local.data_runners, [local.execute_runner]) - - combined_unique_string = join("\n", [for runner in local.runners : try(runner["content"], runner["source"])]) - combined_md5 = substr(md5(local.combined_unique_string), 0, 4) - combined_install_execute_runner = { + combined_runner = { "type" = "shell" "content" = module.startup_script.startup_script - "destination" = "combined_install_spack_${local.combined_md5}.sh" + "destination" = "spack-install-and-setup.sh" } } +resource "google_storage_bucket" "bucket" { + project = var.project_id + name = local.bucket_name + uniform_bucket_level_access = true + location = var.region + storage_class = "REGIONAL" + labels = local.labels +} + module "startup_script" { source = "github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script?ref=v1.19.1" @@ -101,14 +88,10 @@ module "startup_script" { deployment_name = var.deployment_name region = var.region runners = local.runners + gcs_bucket_path = "gs://${google_storage_bucket.bucket.name}" } resource "local_file" "debug_file_shell_install" { content = local.script_content filename = "${path.module}/debug_install.yml" } - -resource "local_file" "debug_file_ansible_execute" { - content = local.execute_contents - filename = "${path.module}/debug_execute_${local.execute_md5}.yml" -} diff --git a/community/modules/scripts/spack-install/outputs.tf b/community/modules/scripts/spack-install/outputs.tf index e02dbf227b..ea68b9d37c 100644 --- a/community/modules/scripts/spack-install/outputs.tf +++ b/community/modules/scripts/spack-install/outputs.tf @@ -40,7 +40,7 @@ output "install_spack_deps_runner" { output "install_spack_runner" { description = "Runner to install Spack using the startup-script module" - value = local.combined_install_execute_runner + value = local.combined_runner } output "setup_spack_runner" { @@ -61,3 +61,13 @@ output "spack_path" { description = "Path to the root of the spack installation" value = var.install_dir } + +output "spack_runner" { + description = "Runner to install Spack using the startup-script module" + value = local.combined_runner +} + +output "gcs_bucket_path" { + description = "Bucket containing the startup scripts for spack, to be reused by spack-execute module." + value = "gs://${google_storage_bucket.bucket.name}" +} diff --git a/community/modules/scripts/spack-install/variables.tf b/community/modules/scripts/spack-install/variables.tf index e4768e27fd..b152c77584 100644 --- a/community/modules/scripts/spack-install/variables.tf +++ b/community/modules/scripts/spack-install/variables.tf @@ -67,48 +67,6 @@ variable "spack_virtualenv_path" { type = string } -# spack-build variables - -variable "log_file" { - description = "Defines the logfile that script output will be written to" - default = "/var/log/spack.log" - type = string -} - -variable "data_files" { - description = <<-EOT - A list of files to be transferred prior to running commands. - It must specify one of 'source' (absolute local file path) or 'content' (string). - It must specify a 'destination' with absolute path where file should be placed. - EOT - type = list(map(string)) - default = [] - validation { - condition = alltrue([for r in var.data_files : substr(r["destination"], 0, 1) == "/"]) - error_message = "All destinations must be absolute paths and start with '/'." - } - validation { - condition = alltrue([ - for r in var.data_files : - can(r["content"]) != can(r["source"]) - ]) - error_message = "A data_file must specify either 'content' or 'source', but never both." - } - validation { - condition = alltrue([ - for r in var.data_files : - lookup(r, "content", lookup(r, "source", null)) != null - ]) - error_message = "A data_file must specify a non-null 'content' or 'source'." - } -} - -variable "commands" { - description = "String of commands to run within this module" - type = string - default = null -} - variable "deployment_name" { description = "Name of deployment, used to name bucket containing startup script." type = string @@ -126,6 +84,21 @@ variable "labels" { # variables to be deprecated +variable "log_file" { + description = <<-EOT + DEPRECATED + + All install logs are printed to stdout/stderr. + Execution log_file location can be set on spack-execute module. + EOT + default = null + type = string + validation { + condition = var.log_file == null + error_message = "log_file is deprecated. See spack-execute module for similar functionality." + } +} + variable "spack_cache_url" { description = <<-EOT DEPRECATED @@ -200,7 +173,7 @@ variable "licenses" { description = <<-EOT DEPRECATED - Use `data_files` variable to install license files: + Use [spack-execute](../spack-execute/) module with `data_files` variable to install license files: ``` data_files = [{ @@ -244,7 +217,7 @@ variable "packages" { } variable "install_flags" { - description = "DEPRECATED - spack install is now performed using the `commands` variable." + description = "DEPRECATED - spack install is now performed using the [spack-execute](../spack-execute/) module `commands` variable." default = null type = string validation { @@ -254,7 +227,7 @@ variable "install_flags" { } variable "concretize_flags" { - description = "DEPRECATED - spack concretize is now performed using the `commands` variable." + description = "DEPRECATED - spack concretize is now performed using the [spack-execute](../spack-execute/) module `commands` variable." default = null type = string validation { diff --git a/community/modules/scripts/spack-install/versions.tf b/community/modules/scripts/spack-install/versions.tf index b708682f88..ff1180fc1b 100644 --- a/community/modules/scripts/spack-install/versions.tf +++ b/community/modules/scripts/spack-install/versions.tf @@ -17,6 +17,11 @@ terraform { required_version = ">= 1.0.0" required_providers { + google = { + source = "hashicorp/google" + version = ">= 4.42" + } + local = { source = "hashicorp/local" version = ">= 2.0.0" diff --git a/modules/scripts/startup-script/README.md b/modules/scripts/startup-script/README.md index 9863f5ad3a..09b052ceb5 100644 --- a/modules/scripts/startup-script/README.md +++ b/modules/scripts/startup-script/README.md @@ -235,7 +235,7 @@ No modules. | [configure\_ssh\_host\_patterns](#input\_configure\_ssh\_host\_patterns) | If specified, it will automate ssh configuration by:
- Defining a Host block for every element of this variable and setting StrictHostKeyChecking to 'No'.
Ex: "hpc*", "hpc01*", "ml*"
- The first time users log-in, it will create ssh keys that are added to the authorized keys list
This requires a shared /home filesystem and relies on specifying the right prefix. | `list(string)` | `[]` | no | | [debug\_file](#input\_debug\_file) | Path to an optional local to be written with 'startup\_script'. | `string` | `null` | no | | [deployment\_name](#input\_deployment\_name) | Name of the HPC deployment, used to name GCS bucket for startup scripts. | `string` | n/a | yes | -| [gcs\_bucket\_path](#input\_gcs\_bucket\_path) | The GCS path for storage bucket and the object. | `string` | `null` | no | +| [gcs\_bucket\_path](#input\_gcs\_bucket\_path) | The GCS path for storage bucket and the object, starting with `gs://`. | `string` | `null` | no | | [install\_ansible](#input\_install\_ansible) | Run Ansible installation script if either set to true or unset and runner of type 'ansible-local' are used. | `bool` | `null` | no | | [install\_cloud\_ops\_agent](#input\_install\_cloud\_ops\_agent) | Run Google Ops Agent installation script if set to true. | `bool` | `false` | no | | [labels](#input\_labels) | Labels for the created GCS bucket. Key-value pairs. | `map(string)` | n/a | yes | diff --git a/modules/scripts/startup-script/variables.tf b/modules/scripts/startup-script/variables.tf index 157f1da54e..ca3f774fb2 100644 --- a/modules/scripts/startup-script/variables.tf +++ b/modules/scripts/startup-script/variables.tf @@ -30,7 +30,7 @@ variable "region" { } variable "gcs_bucket_path" { - description = "The GCS path for storage bucket and the object." + description = "The GCS path for storage bucket and the object, starting with `gs://`." type = string default = null } diff --git a/tools/duplicate-diff.py b/tools/duplicate-diff.py index cd7e2bfd95..9130e956a6 100644 --- a/tools/duplicate-diff.py +++ b/tools/duplicate-diff.py @@ -47,7 +47,7 @@ ], [ "community/modules/scripts/ramble-execute/templates/ramble_execute.yml.tpl", - "community/modules/scripts/spack-install/templates/execute_commands.yml.tpl", + "community/modules/scripts/spack-execute/templates/execute_commands.yml.tpl", ], [ "community/modules/scripts/spack-install/templates/spack_setup.yml.tftpl", From fcf1377462cc91343fe619bdf63da56b650a2a34 Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Thu, 13 Jul 2023 16:04:55 -0700 Subject: [PATCH 2/3] Update deprecated variable documentation to point to spack-execute module --- .../modules/scripts/spack-install/README.md | 14 ++++----- .../scripts/spack-install/variables.tf | 30 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/community/modules/scripts/spack-install/README.md b/community/modules/scripts/spack-install/README.md index f9f56d2114..49fcf49a6c 100644 --- a/community/modules/scripts/spack-install/README.md +++ b/community/modules/scripts/spack-install/README.md @@ -217,25 +217,25 @@ limitations under the License. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [caches\_to\_populate](#input\_caches\_to\_populate) | DEPRECATED

The following `commands` can be used to populate a cache:
MIRROR_URL=gs://my-bucket
spack buildcache create --mirror-url $MIRROR_URL -af \$(spack find --format /{hash});
spack gpg publish --mirror-url $MIRROR_URL;
spack buildcache update-index --mirror-url $MIRROR_URL --keys;
Defines caches which will be populated with the installed packages.

NOTE: GPG Keys should be installed before trying to populate a cache
with packages.

NOTE: The gpg\_keys variable can be used to install existing GPG keys
and create new GPG keys, both of which are acceptable for populating a
cache. | `list(map(any))` | `null` | no | +| [caches\_to\_populate](#input\_caches\_to\_populate) | DEPRECATED

Use [spack-execute](../spack-execute/) module with the following `commands` can be used to populate a cache:
MIRROR_URL=gs://my-bucket
spack buildcache create --mirror-url $MIRROR_URL -af \$(spack find --format /{hash});
spack gpg publish --mirror-url $MIRROR_URL;
spack buildcache update-index --mirror-url $MIRROR_URL --keys;
Defines caches which will be populated with the installed packages.

NOTE: GPG Keys should be installed before trying to populate a cache
with packages.

NOTE: The gpg\_keys variable can be used to install existing GPG keys
and create new GPG keys, both of which are acceptable for populating a
cache. | `list(map(any))` | `null` | no | | [chgrp\_group](#input\_chgrp\_group) | Group to chgrp the Spack clone to. Default will not modify the clone. | `string` | `null` | no | | [chmod\_mode](#input\_chmod\_mode) | Mode to chmod the Spack clone to. Defaults to null (i.e. do not modify).
For usage information see:
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html#parameter-mode | `string` | `"a+rwxs"` | no | | [chown\_owner](#input\_chown\_owner) | Owner to chown the Spack clone to. Default will not modify the clone. | `string` | `null` | no | -| [compilers](#input\_compilers) | DEPRECATED

The following `commands` can be used to install compilers:
spack install gcc@10.3.0 target=x86_64
spack load gcc@10.3.0 target=x86_64
spack compiler find --scope site
spack clean -s
spack unload gcc@10.3.0
Defines compilers for spack to install before installing packages. | `list(string)` | `null` | no | +| [compilers](#input\_compilers) | DEPRECATED

Use [spack-execute](../spack-execute/) module with the following `commands` can be used to install compilers:
spack install gcc@10.3.0 target=x86_64
spack load gcc@10.3.0 target=x86_64
spack compiler find --scope site
spack clean -s
spack unload gcc@10.3.0
Defines compilers for spack to install before installing packages. | `list(string)` | `null` | no | | [concretize\_flags](#input\_concretize\_flags) | DEPRECATED - spack concretize is now performed using the [spack-execute](../spack-execute/) module `commands` variable. | `string` | `null` | no | -| [configs](#input\_configs) | DEPRECATED

The following `commands` can be used to add a single config:
spack config --scope defaults add config:default:true
Alternatively, use `data_files` to transfer a config file and use the `spack config add -f ` command to add the config.

List of configuration options to set within spack. | `list(map(any))` | `null` | no | +| [configs](#input\_configs) | DEPRECATED

Use [spack-execute](../spack-execute/) module with the following `commands` can be used to add a single config:
spack config --scope defaults add config:default:true
Alternatively, use `data_files` to transfer a config file and use the `spack config add -f ` command to add the config.

List of configuration options to set within spack. | `list(map(any))` | `null` | no | | [deployment\_name](#input\_deployment\_name) | Name of deployment, used to name bucket containing startup script. | `string` | n/a | yes | -| [environments](#input\_environments) | DEPRECATED

The following `commands` can be used to configure an environment:
if ! spack env list \| grep -q my-env; then
spack env create my-env
fi
spack env activate my-env
spack add intel-mpi@2018.4.274 %gcc@10.3.0
spack concretize
spack install
Defines spack environments to configure.
For more information, see: https://spack.readthedocs.io/en/latest/environments.html. | `any` | `null` | no | -| [gpg\_keys](#input\_gpg\_keys) | DEPRECATED

The following `commands` can be used to create a new GPG key:
spack gpg init
spack gpg create
Alternatively, `data_files` can be used to transfer an existing GPG key. Then use `spack gpg trust ` to add the key to the keyring.

GPG Keys to trust within spack. | `list(map(any))` | `null` | no | +| [environments](#input\_environments) | DEPRECATED

Use [spack-execute](../spack-execute/) module with the following `commands` can be used to configure an environment:
if ! spack env list \| grep -q my-env; then
spack env create my-env
fi
spack env activate my-env
spack add intel-mpi@2018.4.274 %gcc@10.3.0
spack concretize
spack install
Defines spack environments to configure.
For more information, see: https://spack.readthedocs.io/en/latest/environments.html. | `any` | `null` | no | +| [gpg\_keys](#input\_gpg\_keys) | DEPRECATED

Use [spack-execute](../spack-execute/) module with the following `commands` can be used to create a new GPG key:
spack gpg init
spack gpg create
Alternatively, `data_files` can be used to transfer an existing GPG key. Then use `spack gpg trust ` to add the key to the keyring.

GPG Keys to trust within spack. | `list(map(any))` | `null` | no | | [install\_dir](#input\_install\_dir) | Directory to install spack into. | `string` | `"/sw/spack"` | no | | [install\_flags](#input\_install\_flags) | DEPRECATED - spack install is now performed using the [spack-execute](../spack-execute/) module `commands` variable. | `string` | `null` | no | | [labels](#input\_labels) | Key-value pairs of labels to be added to created resources. | `map(string)` | n/a | yes | | [licenses](#input\_licenses) | DEPRECATED

Use [spack-execute](../spack-execute/) module with `data_files` variable to install license files:
data_files = [{
source = "/abs/path/on/deployment/machine/license.lic"
destination = "/sw/spack/etc/spack/licenses/license.lic"
}]
List of software licenses to install within spack. |
list(object({
source = string
dest = string
}))
| `null` | no | | [log\_file](#input\_log\_file) | DEPRECATED

All install logs are printed to stdout/stderr.
Execution log\_file location can be set on spack-execute module. | `string` | `null` | no | -| [packages](#input\_packages) | DEPRECATED

The following `commands` can be used to install a package:
spack install intel-mpi@2018.4.274 %gcc@10.3.0
Defines root packages for spack to install. | `list(string)` | `null` | no | +| [packages](#input\_packages) | DEPRECATED

Use [spack-execute](../spack-execute/) module with the following `commands` can be used to install a package:
spack install intel-mpi@2018.4.274 %gcc@10.3.0
Defines root packages for spack to install. | `list(string)` | `null` | no | | [project\_id](#input\_project\_id) | Project in which the HPC deployment will be created. | `string` | n/a | yes | | [region](#input\_region) | Region to place bucket containing startup script. | `string` | n/a | yes | -| [spack\_cache\_url](#input\_spack\_cache\_url) | DEPRECATED

The following `commands` can be used to add a build cache:
spack mirror add --scope site  gs://my-build-cache
spack buildcache keys --install --trust
List of build caches for Spack. |
list(object({
mirror_name = string
mirror_url = string
}))
| `null` | no | +| [spack\_cache\_url](#input\_spack\_cache\_url) | DEPRECATED

Use [spack-execute](../spack-execute/) module with the following `commands` can be used to add a build cache:
spack mirror add --scope site  gs://my-build-cache
spack buildcache keys --install --trust
List of build caches for Spack. |
list(object({
mirror_name = string
mirror_url = string
}))
| `null` | no | | [spack\_ref](#input\_spack\_ref) | Git ref to checkout for spack. | `string` | `"v0.20.0"` | no | | [spack\_url](#input\_spack\_url) | URL to clone the spack repo from. | `string` | `"https://github.com/spack/spack"` | no | | [spack\_virtualenv\_path](#input\_spack\_virtualenv\_path) | Virtual environment path in which to install Spack Python interpreter and other dependencies | `string` | `"/usr/local/spack-python"` | no | diff --git a/community/modules/scripts/spack-install/variables.tf b/community/modules/scripts/spack-install/variables.tf index b152c77584..e2c0ca5920 100644 --- a/community/modules/scripts/spack-install/variables.tf +++ b/community/modules/scripts/spack-install/variables.tf @@ -103,7 +103,7 @@ variable "spack_cache_url" { description = <<-EOT DEPRECATED - The following `commands` can be used to add a build cache: + Use [spack-execute](../spack-execute/) module with the following `commands` can be used to add a build cache: ``` spack mirror add --scope site gs://my-build-cache @@ -119,7 +119,7 @@ variable "spack_cache_url" { default = null validation { condition = var.spack_cache_url == null - error_message = "spack_cache_url is deprecated. Use commands instead. See variable documentation for proposed alternative commands." + error_message = "spack_cache_url is deprecated. Use spack-execute.commands instead. See variable documentation for proposed alternative commands." } } @@ -127,7 +127,7 @@ variable "configs" { description = <<-EOT DEPRECATED - The following `commands` can be used to add a single config: + Use [spack-execute](../spack-execute/) module with the following `commands` can be used to add a single config: ``` spack config --scope defaults add config:default:true @@ -141,7 +141,7 @@ variable "configs" { type = list(map(any)) validation { condition = var.configs == null - error_message = "configs is deprecated. Use commands instead. See variable documentation for proposed alternative commands." + error_message = "configs is deprecated. Use spack-execute.commands instead. See variable documentation for proposed alternative commands." } } @@ -149,7 +149,7 @@ variable "compilers" { description = <<-EOT DEPRECATED - The following `commands` can be used to install compilers: + Use [spack-execute](../spack-execute/) module with the following `commands` can be used to install compilers: ``` spack install gcc@10.3.0 target=x86_64 @@ -165,7 +165,7 @@ variable "compilers" { default = null validation { condition = var.compilers == null - error_message = "compilers is deprecated. Use commands instead. See variable documentation for proposed alternative commands." + error_message = "compilers is deprecated. Use spack-execute.commands instead. See variable documentation for proposed alternative commands." } } @@ -192,7 +192,7 @@ variable "licenses" { })) validation { condition = var.licenses == null - error_message = "licenses is deprecated. Use commands instead. See variable documentation for proposed alternative commands." + error_message = "licenses is deprecated. Use spack-execute.commands instead. See variable documentation for proposed alternative commands." } } @@ -200,7 +200,7 @@ variable "packages" { description = <<-EOT DEPRECATED - The following `commands` can be used to install a package: + Use [spack-execute](../spack-execute/) module with the following `commands` can be used to install a package: ``` spack install intel-mpi@2018.4.274 %gcc@10.3.0 @@ -212,7 +212,7 @@ variable "packages" { default = null validation { condition = var.packages == null - error_message = "packages is deprecated. Use commands instead. See variable documentation for proposed alternative commands." + error_message = "packages is deprecated. Use spack-execute.commands instead. See variable documentation for proposed alternative commands." } } @@ -240,7 +240,7 @@ variable "gpg_keys" { description = < Date: Thu, 13 Jul 2023 23:46:52 -0700 Subject: [PATCH 3/3] Update blueprints to reflect spack module split --- community/examples/AMD/hpc-amd-slurm.yaml | 12 ++++++++---- community/examples/hpc-slurm-gromacs.yaml | 16 +++++++--------- community/examples/hpc-slurm-ramble-gromacs.yaml | 12 ++++++++---- docs/tutorials/gromacs/spack-gromacs.yaml | 10 +++++++--- docs/tutorials/openfoam/spack-openfoam.yaml | 10 +++++++--- docs/tutorials/wrfv3/spack-wrfv3.yaml | 10 +++++++--- .../hcls-blueprint.yaml | 9 +++++++-- examples/serverless-batch-mpi.yaml | 12 ++++++++---- tools/validate_configs/ramble.yaml | 3 +-- .../test_configs/centos8-ss.yaml | 12 +++++++----- .../validate_configs/test_configs/debian-ss.yaml | 12 +++++++----- .../test_configs/hpc-centos-ss.yaml | 12 +++++++----- .../validate_configs/test_configs/rocky-ss.yaml | 12 +++++++----- .../test_configs/spack-buildcache.yaml | 11 +++++++---- .../test_configs/spack-environments.yaml | 11 +++++++---- .../validate_configs/test_configs/ubuntu-ss.yaml | 12 +++++++----- 16 files changed, 109 insertions(+), 67 deletions(-) diff --git a/community/examples/AMD/hpc-amd-slurm.yaml b/community/examples/AMD/hpc-amd-slurm.yaml index 710aec046e..ca17bc65b7 100644 --- a/community/examples/AMD/hpc-amd-slurm.yaml +++ b/community/examples/AMD/hpc-amd-slurm.yaml @@ -39,11 +39,16 @@ deployment_groups: settings: local_mount: /sw - - id: spack + - id: spack-setup source: community/modules/scripts/spack-install settings: install_dir: /sw/spack spack_ref: v0.18.1 + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: log_file: /var/log/spack.log data_files: - destination: /tmp/projections-config.yaml @@ -113,8 +118,7 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - $(spack.install_spack_deps_runner) - - $(spack.install_spack_runner) + - $(spack-execute.spack_runner) - type: shell destination: shutdown.sh content: | @@ -128,7 +132,7 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - $(spack.setup_spack_runner) + - $(spack-setup.setup_spack_runner) # the following installation of AOCC may be automated in the future # with a clear direction to the user to read the EULA at # https://developer.amd.com/aocc-compiler-eula/ diff --git a/community/examples/hpc-slurm-gromacs.yaml b/community/examples/hpc-slurm-gromacs.yaml index b284915c46..3f87fb02a8 100644 --- a/community/examples/hpc-slurm-gromacs.yaml +++ b/community/examples/hpc-slurm-gromacs.yaml @@ -45,10 +45,15 @@ deployment_groups: local_mount: /home ## Install Scripts - - id: spack + - id: spack-setup source: community/modules/scripts/spack-install settings: install_dir: /sw/spack + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: log_file: /var/log/spack.log data_files: - destination: /tmp/projections-config.yaml @@ -77,13 +82,6 @@ deployment_groups: spack install intel-mpi@2018.4.274%gcc@10.3.0 spack install gromacs@2023.1 %gcc@10.3.0 ^intel-mpi@2018.4.274 ^cmake@3.26.3 %gcc@4.8.5 - - id: spack-startup - source: modules/scripts/startup-script - settings: - runners: - - $(spack.install_spack_deps_runner) - - $(spack.install_spack_runner) - - id: compute_partition source: community/modules/compute/SchedMD-slurm-on-gcp-partition use: @@ -111,7 +109,7 @@ deployment_groups: - homefs - appsfs - slurm_controller - - spack-startup + - spack-execute settings: login_machine_type: c2-standard-4 login_scopes: diff --git a/community/examples/hpc-slurm-ramble-gromacs.yaml b/community/examples/hpc-slurm-ramble-gromacs.yaml index 306a2de624..d66523a394 100644 --- a/community/examples/hpc-slurm-ramble-gromacs.yaml +++ b/community/examples/hpc-slurm-ramble-gromacs.yaml @@ -35,10 +35,15 @@ deployment_groups: source: modules/network/vpc ## Install Scripts - - id: spack + - id: spack-install source: community/modules/scripts/spack-install settings: install_dir: /opt/apps/spack + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-install] + settings: log_file: /var/log/spack.log commands: | # Un-comment and update mirror_url to install from spack cache @@ -55,7 +60,7 @@ deployment_groups: - id: ramble-execute source: community/modules/scripts/ramble-execute - use: [spack, ramble-setup] + use: [spack-install, ramble-setup] settings: commands: | ramble workspace create gromacs -c /opt/apps/gromacs_scaling.yaml -t /opt/apps/execute_experiment.tpl @@ -66,8 +71,7 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - $(spack.install_spack_deps_runner) - - $(spack.install_spack_runner) + - $(spack-execute.spack_runner) - type: data destination: /opt/apps/gromacs_scaling.yaml content: | diff --git a/docs/tutorials/gromacs/spack-gromacs.yaml b/docs/tutorials/gromacs/spack-gromacs.yaml index 85c6b93fc0..b1036d5bb6 100644 --- a/docs/tutorials/gromacs/spack-gromacs.yaml +++ b/docs/tutorials/gromacs/spack-gromacs.yaml @@ -32,10 +32,15 @@ deployment_groups: source: modules/monitoring/dashboard ## Install Scripts - - id: spack + - id: spack-setup source: community/modules/scripts/spack-install settings: install_dir: /apps/spack + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: log_file: /var/log/spack.log data_files: - destination: /tmp/projections-config.yaml @@ -99,8 +104,7 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - $(spack.install_spack_deps_runner) - - $(spack.install_spack_runner) + - $(spack-execute.spack_runner) - type: shell destination: setup_gromacs.sh content: | diff --git a/docs/tutorials/openfoam/spack-openfoam.yaml b/docs/tutorials/openfoam/spack-openfoam.yaml index 1cd694f9f0..973692e926 100644 --- a/docs/tutorials/openfoam/spack-openfoam.yaml +++ b/docs/tutorials/openfoam/spack-openfoam.yaml @@ -32,10 +32,15 @@ deployment_groups: source: modules/monitoring/dashboard ## Install Scripts - - id: spack + - id: spack-setup source: community/modules/scripts/spack-install settings: install_dir: /apps/spack + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: log_file: /var/log/spack.log data_files: - destination: /tmp/projections-config.yaml @@ -106,8 +111,7 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - $(spack.install_spack_deps_runner) - - $(spack.install_spack_runner) + - $(spack-execute.spack_runner) - type: shell destination: setup_openfoam.sh content: | diff --git a/docs/tutorials/wrfv3/spack-wrfv3.yaml b/docs/tutorials/wrfv3/spack-wrfv3.yaml index 15944153ab..9bb7571054 100644 --- a/docs/tutorials/wrfv3/spack-wrfv3.yaml +++ b/docs/tutorials/wrfv3/spack-wrfv3.yaml @@ -32,10 +32,15 @@ deployment_groups: source: modules/monitoring/dashboard ## Install Scripts - - id: spack + - id: spack-setup source: community/modules/scripts/spack-install settings: install_dir: /apps/spack + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: log_file: /var/log/spack.log data_files: - destination: /tmp/projections-config.yaml @@ -99,8 +104,7 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - $(spack.install_spack_deps_runner) - - $(spack.install_spack_runner) + - $(spack-execute.spack_runner) - type: shell destination: wrfv3_setup.sh content: | diff --git a/docs/videos/healthcare-and-life-sciences/hcls-blueprint.yaml b/docs/videos/healthcare-and-life-sciences/hcls-blueprint.yaml index 7e8b8a86e5..64ff214639 100644 --- a/docs/videos/healthcare-and-life-sciences/hcls-blueprint.yaml +++ b/docs/videos/healthcare-and-life-sciences/hcls-blueprint.yaml @@ -113,10 +113,15 @@ deployment_groups: ### Software ### - - id: spack + - id: spack-setup source: community/modules/scripts/spack-install settings: install_dir: /apps/spack + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: data_files: - destination: /tmp/projections-config.yaml content: | @@ -185,7 +190,7 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - $(spack.install_spack_deps_runner) + - $(spack-execute.spack_runner) - type: data destination: /tmp/install_spack.sh diff --git a/examples/serverless-batch-mpi.yaml b/examples/serverless-batch-mpi.yaml index 36a6d63bae..aa0766a146 100644 --- a/examples/serverless-batch-mpi.yaml +++ b/examples/serverless-batch-mpi.yaml @@ -34,11 +34,16 @@ deployment_groups: settings: local_mount: /share - - id: spack + - id: spack-setup source: community/modules/scripts/spack-install settings: spack_ref: v0.19.0 install_dir: /share/spack + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: data_files: - destination: /tmp/projections-config.yaml content: | @@ -92,8 +97,7 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - $(spack.install_spack_deps_runner) - - $(spack.install_spack_runner) + - $(spack-execute.spack_runner) - type: shell destination: wrfv3_setup.sh content: | @@ -153,7 +157,7 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - $(spack.setup_spack_runner) + - $(spack-setup.setup_spack_runner) - id: batch-login source: modules/scheduler/batch-login-node diff --git a/tools/validate_configs/ramble.yaml b/tools/validate_configs/ramble.yaml index e0de6ed2a8..3e4b26897f 100644 --- a/tools/validate_configs/ramble.yaml +++ b/tools/validate_configs/ramble.yaml @@ -49,8 +49,7 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - $(spack.install_spack_deps_runner) - - $(spack.install_spack_runner) + - $(spack.spack_runner) - $(ramble-execute.ramble_runner) - id: ramble-vm diff --git a/tools/validate_configs/test_configs/centos8-ss.yaml b/tools/validate_configs/test_configs/centos8-ss.yaml index 58bd6f769b..b6f5722bf4 100644 --- a/tools/validate_configs/test_configs/centos8-ss.yaml +++ b/tools/validate_configs/test_configs/centos8-ss.yaml @@ -41,10 +41,15 @@ deployment_groups: settings: auto_delete_disk: true - - id: spack + - id: spack-setup source: ./community//modules/scripts/spack-install settings: install_dir: /apps/spack + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: commands: | spack install gcc@10.3.0 target=x86_64 spack load gcc@10.3.0 target=x86_64 @@ -66,10 +71,7 @@ deployment_groups: echo $2 tar zxvf /tmp/$1 -C / args: "foo.tgz 'Expanding the file'" - - $(spack.install_spack_deps_runner) - - type: shell - content: $(spack.startup_script) - destination: "/apps/spack-install.sh" + - $(spack-execute.spack_runner) - id: instance source: ./modules/compute/vm-instance diff --git a/tools/validate_configs/test_configs/debian-ss.yaml b/tools/validate_configs/test_configs/debian-ss.yaml index 7d02949510..15fe0d40e7 100644 --- a/tools/validate_configs/test_configs/debian-ss.yaml +++ b/tools/validate_configs/test_configs/debian-ss.yaml @@ -41,10 +41,15 @@ deployment_groups: settings: auto_delete_disk: true - - id: spack + - id: spack-setup source: ./community//modules/scripts/spack-install settings: install_dir: /apps/spack + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: commands: | spack install gcc@10.3.0 target=x86_64 spack load gcc@10.3.0 target=x86_64 @@ -66,10 +71,7 @@ deployment_groups: echo $2 tar zxvf /tmp/$1 -C / args: "foo.tgz 'Expanding the file'" - - $(spack.install_spack_deps_runner) - - type: shell - content: $(spack.startup_script) - destination: "/apps/spack-install.sh" + - $(spack-execute.spack_runner) - id: instance source: ./modules/compute/vm-instance diff --git a/tools/validate_configs/test_configs/hpc-centos-ss.yaml b/tools/validate_configs/test_configs/hpc-centos-ss.yaml index e364b3528a..385b399c89 100644 --- a/tools/validate_configs/test_configs/hpc-centos-ss.yaml +++ b/tools/validate_configs/test_configs/hpc-centos-ss.yaml @@ -41,10 +41,15 @@ deployment_groups: settings: auto_delete_disk: true - - id: spack + - id: spack-setup source: ./community//modules/scripts/spack-install settings: install_dir: /apps/spack + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: commands: | spack install gcc@10.3.0 target=x86_64 spack load gcc@10.3.0 target=x86_64 @@ -66,10 +71,7 @@ deployment_groups: echo $2 tar zxvf /tmp/$1 -C / args: "foo.tgz 'Expanding the file'" - - $(spack.install_spack_deps_runner) - - type: shell - content: $(spack.startup_script) - destination: "/apps/spack-install.sh" + - $(spack-execute.spack_runner) - id: instance source: ./modules/compute/vm-instance diff --git a/tools/validate_configs/test_configs/rocky-ss.yaml b/tools/validate_configs/test_configs/rocky-ss.yaml index 8234e720d8..9852a9ee95 100644 --- a/tools/validate_configs/test_configs/rocky-ss.yaml +++ b/tools/validate_configs/test_configs/rocky-ss.yaml @@ -42,10 +42,15 @@ deployment_groups: image: rocky-linux-cloud/rocky-linux-8 auto_delete_disk: true - - id: spack + - id: spack-setup source: ./community//modules/scripts/spack-install settings: install_dir: /apps/spack + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: commands: | spack install gcc@10.3.0 target=x86_64 spack load gcc@10.3.0 target=x86_64 @@ -67,10 +72,7 @@ deployment_groups: echo $2 tar zxvf /tmp/$1 -C / args: "foo.tgz 'Expanding the file'" - - $(spack.install_spack_deps_runner) - - type: shell - content: $(spack.startup_script) - destination: "/apps/spack-install.sh" + - $(spack-execute.spack_runner) - id: instance source: ./modules/compute/vm-instance diff --git a/tools/validate_configs/test_configs/spack-buildcache.yaml b/tools/validate_configs/test_configs/spack-buildcache.yaml index f70f0ee7f2..d11d108e7b 100644 --- a/tools/validate_configs/test_configs/spack-buildcache.yaml +++ b/tools/validate_configs/test_configs/spack-buildcache.yaml @@ -28,10 +28,15 @@ deployment_groups: - id: network1 source: modules/network/pre-existing-vpc - - id: spack + - id: spack-setup source: ./community/modules/scripts/spack-install settings: install_dir: /apps/spack + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: log_file: /var/log/spack.log data_files: - source: /path/to/local/spack_gpg_key.pub @@ -70,9 +75,7 @@ deployment_groups: - type: ansible-local source: modules/spack-install/scripts/install_spack_deps.yml destination: install_spack_deps.yml - - type: shell - content: $(spack.startup_script) - destination: install_spack.sh + - $(spack-execute.spack_runner) - type: shell destination: shutdown.sh content: shutdown -h diff --git a/tools/validate_configs/test_configs/spack-environments.yaml b/tools/validate_configs/test_configs/spack-environments.yaml index 8ca29f1fed..bcdd731d3e 100644 --- a/tools/validate_configs/test_configs/spack-environments.yaml +++ b/tools/validate_configs/test_configs/spack-environments.yaml @@ -28,12 +28,17 @@ deployment_groups: - id: network1 source: modules/network/pre-existing-vpc - - id: spack + - id: spack-setup source: ./community/modules/scripts/spack-install settings: install_dir: /apps/spack spack_url: https://github.com/spack/spack spack_ref: v0.17.1 + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: log_file: /var/log/spack.log data_files: - destination: /apps/spack/env_file.yaml @@ -114,9 +119,7 @@ deployment_groups: - type: ansible-local source: modules/spack-install/scripts/install_spack_deps.yml destination: install_spack_deps.yml - - type: shell - content: $(spack.startup_script) - destination: install_spack.sh + - $(spack-execute.spack_runner) - type: shell destination: shutdown.sh content: shutdown -h diff --git a/tools/validate_configs/test_configs/ubuntu-ss.yaml b/tools/validate_configs/test_configs/ubuntu-ss.yaml index ca16c98f6f..761c0d71c5 100644 --- a/tools/validate_configs/test_configs/ubuntu-ss.yaml +++ b/tools/validate_configs/test_configs/ubuntu-ss.yaml @@ -41,10 +41,15 @@ deployment_groups: settings: auto_delete_disk: true - - id: spack + - id: spack-setup source: ./community//modules/scripts/spack-install settings: install_dir: /apps/spack + + - id: spack-execute + source: community/modules/scripts/spack-execute + use: [spack-setup] + settings: commands: | spack install gcc@10.3.0 target=x86_64 spack load gcc@10.3.0 target=x86_64 @@ -70,10 +75,7 @@ deployment_groups: echo $2 tar zxvf /tmp/$1 -C / args: "foo.tgz 'Expanding the file'" - - $(spack.install_spack_deps_runner) - - type: shell - content: $(spack.startup_script) - destination: "/apps/spack-install.sh" + - $(spack-execute.spack_runner) - id: instance source: ./modules/compute/vm-instance