Skip to content

Commit e745a54

Browse files
committed
Seperate controller and compute zips
1 parent 72e7d8d commit e745a54

3 files changed

Lines changed: 86 additions & 13 deletions

File tree

community/modules/internal/slurm-gcp/instance_template/files/startup_sh_unlinted

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,15 @@ fi
7676

7777
SCRIPTS_ZIP="$HOME/slurm-gcp-scripts.zip"
7878
export CLOUDSDK_CORE_UNIVERSE_DOMAIN="$UNIVERSE_DOMAIN"
79-
until gcloud storage cp "$BUCKET/slurm-gcp-devel.zip" "$SCRIPTS_ZIP"; do
79+
80+
INSTANCE_ROLE="$($CURL $URL/instance/attributes/slurm_instance_role)"
81+
82+
if [ "$INSTANCE_ROLE" == "controller" ]; then
83+
DEVEL_ZIP="slurm-gcp-devel-controller.zip"
84+
else
85+
DEVEL_ZIP="slurm-gcp-devel.zip"
86+
fi
87+
until gcloud storage cp "$BUCKET/$DEVEL_ZIP" "$SCRIPTS_ZIP"; do
8088
echo "WARN: Could not download SlurmGCP scripts, retrying in 5 seconds."
8189
# Remove marker used to determine if gcloud is being used in a GCE VM.
8290
# This can get mistakenly set to False in some cases.

community/modules/scheduler/schedmd-slurm-gcp-v6-controller/modules/slurm_files/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ No modules.
4343
| [google_storage_bucket_object.config](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket_object) | resource |
4444
| [google_storage_bucket_object.controller_startup_scripts](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket_object) | resource |
4545
| [google_storage_bucket_object.devel](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket_object) | resource |
46+
| [google_storage_bucket_object.devel_compute](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket_object) | resource |
4647
| [google_storage_bucket_object.epilog_scripts](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket_object) | resource |
4748
| [google_storage_bucket_object.nodeset_config](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket_object) | resource |
4849
| [google_storage_bucket_object.nodeset_dyn_config](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket_object) | resource |
@@ -52,7 +53,8 @@ No modules.
5253
| [google_storage_bucket_object.task_epilog_scripts](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket_object) | resource |
5354
| [google_storage_bucket_object.task_prolog_scripts](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket_object) | resource |
5455
| [random_uuid.cluster_id](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid) | resource |
55-
| [archive_file.slurm_gcp_devel_zip](https://registry.terraform.io/providers/hashicorp/archive/latest/docs/data-sources/file) | data source |
56+
| [archive_file.slurm_gcp_devel_compute_zip](https://registry.terraform.io/providers/hashicorp/archive/latest/docs/data-sources/file) | data source |
57+
| [archive_file.slurm_gcp_devel_controller_zip](https://registry.terraform.io/providers/hashicorp/archive/latest/docs/data-sources/file) | data source |
5658
| [google_storage_bucket.this](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/storage_bucket) | data source |
5759
| [local_file.chs_gpu_health_check](https://registry.terraform.io/providers/hashicorp/local/latest/docs/data-sources/file) | data source |
5860
| [local_file.external_epilog](https://registry.terraform.io/providers/hashicorp/local/latest/docs/data-sources/file) | data source |

community/modules/scheduler/schedmd-slurm-gcp-v6-controller/modules/slurm_files/main.tf

Lines changed: 74 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,29 +169,92 @@ resource "google_storage_bucket_object" "nodeset_tpu_config" {
169169
locals {
170170
build_dir = abspath("${path.module}/build")
171171

172-
slurm_gcp_devel_zip = "slurm-gcp-devel.zip"
173-
slurm_gcp_devel_zip_bucket = format("%s/%s", local.bucket_dir, local.slurm_gcp_devel_zip)
172+
slurm_gcp_devel_controller_zip = "slurm-gcp-devel-controller.zip"
173+
slurm_gcp_devel_compute_zip = "slurm-gcp-devel.zip"
174+
slurm_gcp_devel_zip_bucket = format("%s/%s", local.bucket_dir, local.slurm_gcp_devel_controller_zip)
175+
slurm_gcp_devel_compute_zip_bucket = format("%s/%s", local.bucket_dir, local.slurm_gcp_devel_compute_zip)
176+
177+
controller_files = [
178+
"tools/gpu-test",
179+
"tools/task-epilog",
180+
"tools/task-prolog",
181+
"conf.py",
182+
"file_cache.py",
183+
"get_tpu_vmcount.py",
184+
"job_submit.lua.tpl",
185+
"load_bq.py",
186+
"local_pubsub.py",
187+
"mig_flex.py",
188+
"resume_wrapper.sh",
189+
"resume.py",
190+
"setup_network_storage.py",
191+
"setup.py",
192+
"slurmsync.py",
193+
"sort_nodes.py",
194+
"suspend_wrapper.sh",
195+
"suspend.py",
196+
"tpu.py",
197+
"util.py",
198+
"watch_delete_vm_op.py",
199+
]
200+
201+
compute_files = [
202+
"tools/gpu-test",
203+
"tools/task-epilog",
204+
"tools/task-prolog",
205+
"file_cache.py",
206+
"get_tpu_vmcount.py",
207+
"job_submit.lua.tpl",
208+
"local_pubsub.py",
209+
"mig_flex.py",
210+
"setup_network_storage.py",
211+
"setup.py",
212+
"slurmsync.py",
213+
"sort_nodes.py",
214+
"suspend.py",
215+
"tpu.py",
216+
"util.py",
217+
"watch_delete_vm_op.py",
218+
]
174219
}
175220

176-
data "archive_file" "slurm_gcp_devel_zip" {
177-
output_path = "${local.build_dir}/${local.slurm_gcp_devel_zip}"
221+
data "archive_file" "slurm_gcp_devel_controller_zip" {
222+
output_path = "${local.build_dir}/${local.slurm_gcp_devel_controller_zip}"
178223
type = "zip"
179-
source_dir = local.scripts_dir
180224

181-
excludes = flatten([
182-
fileset(local.scripts_dir, "tests/**"),
183-
# TODO: consider removing (including nested) __pycache__ and all .* files
184-
# Though it only affects developers
185-
])
225+
dynamic "source" {
226+
for_each = local.controller_files
227+
content {
228+
content = file("${local.scripts_dir}/${source.value}")
229+
filename = source.value
230+
}
231+
}
232+
}
233+
234+
data "archive_file" "slurm_gcp_devel_compute_zip" {
235+
output_path = "${local.build_dir}/${local.slurm_gcp_devel_compute_zip}"
236+
type = "zip"
186237

238+
dynamic "source" {
239+
for_each = local.compute_files
240+
content {
241+
content = file("${local.scripts_dir}/${source.value}")
242+
filename = source.value
243+
}
244+
}
187245
}
188246

189247
resource "google_storage_bucket_object" "devel" {
190248
bucket = var.bucket_name
191249
name = local.slurm_gcp_devel_zip_bucket
192-
source = data.archive_file.slurm_gcp_devel_zip.output_path
250+
source = data.archive_file.slurm_gcp_devel_controller_zip.output_path
193251
}
194252

253+
resource "google_storage_bucket_object" "devel_compute" {
254+
bucket = var.bucket_name
255+
name = local.slurm_gcp_devel_compute_zip_bucket
256+
source = data.archive_file.slurm_gcp_devel_compute_zip.output_path
257+
}
195258

196259
###########
197260
# SCRIPTS #

0 commit comments

Comments
 (0)