Skip to content

Commit 55b68d5

Browse files
COMPUTE-1764_no_selector_extra_args
(feat) dx.py - relaxed exclusivity to allow instance type in runtime to allow cluster spec.
1 parent a1c5beb commit 55b68d5

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/python/dxpy/scripts/dx.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3244,12 +3244,6 @@ def run_body(args, executable, dest_proj, dest_path, preset_inputs=None, input_n
32443244
requested_fpga_driver = cloned_fpga_driver
32453245
requested_nvidia_driver = cloned_nvidia_driver
32463246

3247-
# Validate mutual exclusivity: instanceTypeSelector and clusterSpec cannot coexist
3248-
# Note: instanceType can override instanceTypeSelector, so we only raise error if no instanceType is present
3249-
# instanceTypeSelector is build-time only and should never be in runtime systemRequirements
3250-
if cloned_instance_type_selector.as_dict() and requested_cluster_spec.as_dict() and not requested_instance_type.as_dict():
3251-
raise DXCLIError("Cannot combine clusterSpec with instanceTypeSelector without providing instanceType. "
3252-
"instanceTypeSelector and clusterSpec are mutually exclusive.")
32533247

32543248
# combine the requested instance type, full cluster spec, fpga spec, nvidia spec
32553249
# into the runtime systemRequirements

src/python/test/test_dxclient.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3480,10 +3480,15 @@ def test_dx_run_clone_with_instance_type_selector(self):
34803480
cloned_job_id_3 = run(f"dx run --clone {origin_job_id} --instance-count 3 --instance-type mem2_hdd2_x4 --brief -y").strip()
34813481
assert cloned_job_id_3.startswith("job-")
34823482
cloned_job_desc_3 = dxpy.api.job_describe(cloned_job_id_3)
3483-
# Verify both instanceType and clusterSpec are present
3483+
# Verify instanceType override is applied
34843484
assert "instanceType" in cloned_job_desc_3["systemRequirements"]["*"]
34853485
assert cloned_job_desc_3["systemRequirements"]["*"]["instanceType"] == "mem2_hdd2_x4"
3486+
# Verify initialInstanceCount from --instance-count is present
3487+
# Note: Since the applet uses instanceTypeSelector and doesn't define a full clusterSpec,
3488+
# only initialInstanceCount will be present in clusterSpec
34863489
assert "clusterSpec" in cloned_job_desc_3["systemRequirements"]["*"]
3490+
assert "initialInstanceCount" in cloned_job_desc_3["systemRequirements"]["*"]["clusterSpec"]
3491+
assert cloned_job_desc_3["systemRequirements"]["*"]["clusterSpec"]["initialInstanceCount"] == 3
34873492

34883493
def test_dx_run_clone(self):
34893494
applet_id = dxpy.api.applet_new({"project": self.project,

0 commit comments

Comments
 (0)