Skip to content

Commit 44410e2

Browse files
mujtaba1747Syed Jafri
andauthored
fix: Made CPT integ tests dry run for optimize for capacity constraints (#6194)
* fix: Made CPT integ tests dry run for optimize for capacity constraints * fix: add dryrun to test name for visibility in logs --------- Co-authored-by: Syed Jafri <syedjfr@amazon.com>
1 parent 06a2c1a commit 44410e2

2 files changed

Lines changed: 43 additions & 34 deletions

File tree

‎sagemaker-train/tests/integ/train/test_cpt_data_mixing_hyperpod.py‎

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@
4646

4747
# Test configuration
4848
REGION = "us-east-1"
49-
CLUSTER_NAME = "riv-rig"
50-
INSTANCE_TYPE = "ml.p5.48xlarge"
49+
CLUSTER_NAME = "pysdk-hp-integ-tests"
50+
# Using g6 to pass instance count validation. This recipe actually needs p5.48xlarge
51+
INSTANCE_TYPE = "ml.g6.48xlarge"
5152
NODE_COUNT = 2
5253
MODEL_NAME = "nova-textgeneration-micro"
5354
DATA_PREFIX = "test-cpt-data-mixing-integ"
@@ -124,9 +125,10 @@ def training_resources(sagemaker_session_us_east_1):
124125
}
125126

126127

128+
# TODO: Remove dry-run when capacity is available in future
127129
@pytest.mark.gpu_intensive
128130
@pytest.mark.us_east_1
129-
def test_cpt_trainer_nova_micro_with_data_mixing_hyperpod(
131+
def test_cpt_trainer_nova_micro_with_data_mixing_hyperpod_dryrun(
130132
sagemaker_session_us_east_1, training_resources
131133
):
132134
"""Test CPTTrainer with Nova Micro model and data mixing on HyperPod.
@@ -162,26 +164,28 @@ def test_cpt_trainer_nova_micro_with_data_mixing_hyperpod(
162164
base_job_name=f"hp-datamix-m1-{unique_id}",
163165
)
164166

167+
dry_run = True
165168
logger.info("Submitting CPT HyperPod training job with data mixing config...")
166169
try:
167-
job_name = cpt_trainer.train(wait=False)
170+
job_name = cpt_trainer.train(wait=False, dry_run=dry_run)
168171
except ValueError as e:
169172
if "Failed to download" in str(e) or "Forge subscription" in str(e):
170173
pytest.skip(
171174
"Skipping: account does not have Forge subscription for data mixing recipes."
172175
)
173176
raise
174177

175-
# _train_hyperpod returns the job name as a string
176-
assert job_name is not None
177-
logger.info(f"HyperPod CPT job submitted: {job_name}")
178-
179-
# Verify the job exists on the cluster via hyperpod get-job
180-
get_job_result = subprocess.run(
181-
["hyperpod", "get-job", "--job-name", job_name],
182-
capture_output=True, text=True,
183-
)
184-
assert get_job_result.returncode == 0, (
185-
f"hyperpod get-job failed for '{job_name}': {get_job_result.stderr}"
186-
)
187-
logger.info(f"Verified job '{job_name}' exists on the cluster.")
178+
if not dry_run:
179+
# _train_hyperpod returns the job name as a string
180+
assert job_name is not None
181+
logger.info(f"HyperPod CPT job submitted: {job_name}")
182+
183+
# Verify the job exists on the cluster via hyperpod get-job
184+
get_job_result = subprocess.run(
185+
["hyperpod", "get-job", "--job-name", job_name],
186+
capture_output=True, text=True,
187+
)
188+
assert get_job_result.returncode == 0, (
189+
f"hyperpod get-job failed for '{job_name}': {get_job_result.stderr}"
190+
)
191+
logger.info(f"Verified job '{job_name}' exists on the cluster.")

‎sagemaker-train/tests/integ/train/test_cpt_hyperpod.py‎

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@
4545

4646
# Test configuration
4747
REGION = "us-east-1"
48-
CLUSTER_NAME = "riv-rig"
49-
INSTANCE_TYPE = "ml.p5.48xlarge"
48+
CLUSTER_NAME = "pysdk-hp-integ-tests"
49+
# Using g6 to pass instance count validation. This recipe actually needs p5.48xlarge
50+
INSTANCE_TYPE = "ml.g6.48xlarge"
5051
NODE_COUNT = 2
5152
MODEL_NAME = "nova-textgeneration-micro"
5253
DATA_PREFIX = "test-cpt-integ"
@@ -123,9 +124,10 @@ def training_resources(sagemaker_session_us_east_1):
123124
}
124125

125126

127+
# TODO: Remove dry-run when capacity is available in future
126128
@pytest.mark.gpu_intensive
127129
@pytest.mark.us_east_1
128-
def test_cpt_trainer_nova_micro_hyperpod(
130+
def test_cpt_trainer_nova_micro_hyperpod_dryrun(
129131
sagemaker_session_us_east_1, training_resources
130132
):
131133
"""Test CPTTrainer with Nova Micro model on HyperPod (no data mixing).
@@ -152,18 +154,21 @@ def test_cpt_trainer_nova_micro_hyperpod(
152154
)
153155

154156
logger.info("Submitting CPT HyperPod training job (no data mixing)...")
155-
job_name = cpt_trainer.train(wait=False)
156157

157-
# _train_hyperpod returns the job name as a string
158-
assert job_name is not None
159-
logger.info(f"HyperPod CPT job submitted: {job_name}")
160-
161-
# Verify the job exists on the cluster via hyperpod get-job
162-
get_job_result = subprocess.run(
163-
["hyperpod", "get-job", "--job-name", job_name],
164-
capture_output=True, text=True,
165-
)
166-
assert get_job_result.returncode == 0, (
167-
f"hyperpod get-job failed for '{job_name}': {get_job_result.stderr}"
168-
)
169-
logger.info(f"Verified job '{job_name}' exists on the cluster.")
158+
dry_run = True
159+
job_name = cpt_trainer.train(wait=False, dry_run=dry_run)
160+
161+
if not dry_run:
162+
# _train_hyperpod returns the job name as a string
163+
assert job_name is not None
164+
logger.info(f"HyperPod CPT job submitted: {job_name}")
165+
166+
# Verify the job exists on the cluster via hyperpod get-job
167+
get_job_result = subprocess.run(
168+
["hyperpod", "get-job", "--job-name", job_name],
169+
capture_output=True, text=True,
170+
)
171+
assert get_job_result.returncode == 0, (
172+
f"hyperpod get-job failed for '{job_name}': {get_job_result.stderr}"
173+
)
174+
logger.info(f"Verified job '{job_name}' exists on the cluster.")

0 commit comments

Comments
 (0)