Skip to content

Commit 7dfac17

Browse files
committed
fix: Pass instance type into aws batch job definition even when num_replicas = 1
1 parent 1e464ae commit 7dfac17

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

torchx/schedulers/aws_batch_scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def _role_to_node_properties(
255255
container["jobRoleArn"] = job_role_arn
256256
if execution_role_arn:
257257
container["executionRoleArn"] = execution_role_arn
258-
if role.num_replicas > 1:
258+
if role.num_replicas > 0:
259259
instance_type = instance_type_from_resource(role.resource)
260260
if instance_type is not None:
261261
container["instanceType"] = instance_type

torchx/schedulers/test/aws_batch_scheduler_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,15 @@ def test_submit_dryrun_instance_type_multinode(self) -> None:
195195
node_groups[0]["container"]["instanceType"],
196196
)
197197

198-
def test_submit_dryrun_no_instance_type_singlenode(self) -> None:
198+
def test_submit_dryrun_instance_type_singlenode(self) -> None:
199199
cfg = AWSBatchOpts({"queue": "ignored_in_test", "privileged": True})
200200
resource = specs.named_resources_aws.aws_p3dn_24xlarge()
201201
app = _test_app(num_replicas=1, resource=resource)
202202
info = create_scheduler("test").submit_dryrun(app, cfg)
203203
# pyre-ignore[16]
204204
node_groups = info.request.job_def["nodeProperties"]["nodeRangeProperties"]
205205
self.assertEqual(1, len(node_groups))
206-
self.assertTrue("instanceType" not in node_groups[0]["container"])
206+
self.assertTrue("instanceType" in node_groups[0]["container"])
207207

208208
def test_submit_dryrun_no_instance_type_non_aws(self) -> None:
209209
cfg = AWSBatchOpts({"queue": "ignored_in_test", "privileged": True})

0 commit comments

Comments
 (0)