Skip to content

Commit 4509025

Browse files
p3rf Teamcopybara-github
authored andcommitted
Fix Path issues for Slurm clusters and handle non-standard installation paths.
PiperOrigin-RevId: 963831976
1 parent b9f71b7 commit 4509025

2 files changed

Lines changed: 46 additions & 7 deletions

File tree

perfkitbenchmarker/cluster.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,14 @@ def RemoteCommand(
247247
248248
Returns:
249249
A tuple of stdout and stderr from running the command.
250-
251-
Raises:
252-
RemoteCommandError: If there was a problem issuing the command.
253250
"""
251+
slurm_path = (
252+
'export PATH=$PATH:/usr/local/bin:/usr/local/sbin:'
253+
'/apps/slurm/current/bin:/apps/slurm/bin:'
254+
'/opt/slurm/bin:/usr/local/slurm/bin; '
255+
)
254256
return self.headnode_vm.RemoteCommand(
255-
f'{env} srun -N {self.num_workers} {command}',
257+
f'{slurm_path}{env} srun -N {self.num_workers} {command}',
256258
ignore_failure=ignore_failure,
257259
timeout=timeout,
258260
**kwargs,
@@ -372,14 +374,19 @@ def Delete(self):
372374
@vm_util.Retry(
373375
fuzz=0,
374376
timeout=1800,
375-
max_retries=5,
377+
max_retries=30,
376378
retryable_exceptions=(errors.Resource.RetryableCreationError,),
377379
)
378380
def _WaitForClusterReady(self):
379381
if self.unmanaged:
380382
return
383+
slurm_path = (
384+
'export PATH=$PATH:/usr/local/bin:/usr/local/sbin:'
385+
'/apps/slurm/current/bin:/apps/slurm/bin:'
386+
'/opt/slurm/bin:/usr/local/slurm/bin; '
387+
)
381388
if not self.headnode_vm.TryRemoteCommand(
382-
f'srun -N {self.num_workers} hostname'
389+
f'{slurm_path}srun -N {self.num_workers} hostname'
383390
):
384391
raise errors.Resource.RetryableCreationError('Cluster not ready.')
385392

perfkitbenchmarker/data/cluster/cluster_toolkit.yaml.j2

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,35 @@ vars:
77
region: {{ region }}
88
zone: {{ zone }}
99

10+
{% if 'staging' in zone %}
11+
# Add skip validators for staging
12+
validators:
13+
- {validator: test_zone_exists, skip: true}
14+
- {validator: test_zone_in_region, skip: true}
15+
- {validator: test_region_exists, skip: true}
16+
- {validator: test_machine_type_in_zone, skip: true}
17+
- {validator: test_disk_type_in_zone, skip: true}
18+
19+
# Add provider overrides for staging
20+
terraform_providers:
21+
google:
22+
source: hashicorp/google
23+
version: ">= 6.22.0"
24+
configuration:
25+
project: $(vars.project_id)
26+
region: $(vars.region)
27+
zone: $(vars.zone)
28+
compute_custom_endpoint: "https://compute.mtls.googleapis.com/compute/staging_v1/"
29+
google-beta:
30+
source: hashicorp/google-beta
31+
version: ">= 6.22.0"
32+
configuration:
33+
project: $(vars.project_id)
34+
region: $(vars.region)
35+
zone: $(vars.zone)
36+
compute_custom_endpoint: "https://compute.mtls.googleapis.com/compute/staging_v1/"
37+
{% endif %}
38+
1039
deployment_groups:
1140
- group: primary
1241
modules:
@@ -32,7 +61,10 @@ deployment_groups:
3261
enable_public_ips: true
3362
enable_oslogin: false
3463
machine_type: {{ worker_machine_type }}
35-
disk_type: pd-balanced
64+
disk_type: {{ 'hyperdisk-balanced' if 'h4d' in worker_machine_type else 'pd-balanced' }}
65+
{% if 'h4d' in worker_machine_type %}
66+
on_host_maintenance: TERMINATE
67+
{% endif %}
3668
bandwidth_tier: gvnic_enabled
3769
allow_automatic_updates: false
3870
instance_image_custom: true

0 commit comments

Comments
 (0)