Skip to content

Commit

Permalink
Slurm6. Automagicaly set nodeset.name from module id. (#2068)
Browse files Browse the repository at this point in the history
Slurm6. Automagicaly set `nodeset.name` from module id.
  • Loading branch information
mr0re1 authored Jan 3, 2024
1 parent 3d1072d commit f9086a7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
1 change: 0 additions & 1 deletion community/examples/hpc-slurm6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ deployment_groups:
source: community/modules/compute/schedmd-slurm-gcp-v6-nodeset
use: [network]
settings:
name: ns1
node_count_dynamic_max: 4
machine_type: n2-standard-2
enable_placement: false # the default is: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ No modules.
| <a name="input_machine_type"></a> [machine\_type](#input\_machine\_type) | Compute Platform machine type to use for this partition compute nodes. | `string` | `"c2-standard-60"` | no |
| <a name="input_metadata"></a> [metadata](#input\_metadata) | Metadata, provided as a map. | `map(string)` | `{}` | no |
| <a name="input_min_cpu_platform"></a> [min\_cpu\_platform](#input\_min\_cpu\_platform) | The name of the minimum CPU platform that you want the instance to use. | `string` | `null` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the nodeset. | `string` | `"ghpc"` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the nodeset. Automatically populated by the module id if not set | `string` | n/a | yes |
| <a name="input_node_conf"></a> [node\_conf](#input\_node\_conf) | Map of Slurm node line configuration. | `map(any)` | `{}` | no |
| <a name="input_node_count_dynamic_max"></a> [node\_count\_dynamic\_max](#input\_node\_count\_dynamic\_max) | Maximum number of dynamic nodes allowed in this partition. | `number` | `1` | no |
| <a name="input_node_count_static"></a> [node\_count\_static](#input\_node\_count\_static) | Number of nodes to be statically created. | `number` | `0` | no |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ locals {
}

locals {
name = substr(replace(var.name, "/[^a-z0-9]/", ""), 0, 6)

additional_disks = [
for ad in var.additional_disks : {
disk_name = ad.disk_name
Expand All @@ -34,7 +36,7 @@ locals {
node_count_static = var.node_count_static
node_count_dynamic_max = var.node_count_dynamic_max
node_conf = var.node_conf
nodeset_name = var.name
nodeset_name = local.name

disk_auto_delete = var.disk_auto_delete
disk_labels = merge(local.labels, var.disk_labels)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
spec:
requirements:
services: []
ghpc:
inject_module_id: name
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@
# limitations under the License.

variable "name" {
description = "Name of the nodeset."
description = "Name of the nodeset. Automatically populated by the module id if not set"
type = string
default = "ghpc"

validation {
condition = can(regex("^[a-z](?:[a-z0-9]{0,5})$", var.name))
error_message = "Nodeset name (var.name) must begin with a letter, be fully alphanumeric and be 6 characters or less. Regexp: '^[a-z](?:[a-z0-9]{0,5})$'."
}
}

variable "node_conf" {
Expand Down

0 comments on commit f9086a7

Please sign in to comment.