Skip to content

Commit 19c386b

Browse files
authored
raising a work around for command job and spark job name lowering case (#35688)
* fixing sweep job service response parsing issue * fixing sweep job service response parsing issue * raising a work around for cmd job and spark job name lowering case * fixing black issue * fixing serialization issue in sweep job * include black fix * found and fix the issue in compute validation * fixing a corrupt wokspace arm template * fixing the failed test case
1 parent 45e7222 commit 19c386b

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/sweep_job.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ def _to_rest_object(self) -> JobBase:
268268
self.resources._to_rest_object() if self.resources and not isinstance(self.resources, dict) else None
269269
),
270270
)
271+
272+
if not sweep_job.resources and sweep_job.trial.resources:
273+
sweep_job.resources = sweep_job.trial.resources
274+
271275
sweep_job_resource = JobBase(properties=sweep_job)
272276
sweep_job_resource.name = self.name
273277
return sweep_job_resource
@@ -323,7 +327,7 @@ def _load_from_rest(cls, obj: JobBase) -> "SweepJob":
323327
search_space=_search_space, # type: ignore[arg-type]
324328
limits=SweepJobLimits._from_rest_object(properties.limits),
325329
early_termination=early_termination,
326-
objective=properties.objective,
330+
objective=Objective._from_rest_object(properties.objective) if properties.objective else None,
327331
inputs=from_rest_inputs_to_dataset_literal(properties.inputs),
328332
outputs=from_rest_data_outputs(properties.outputs),
329333
identity=(

sdk/ml/azure-ai-ml/azure/ai/ml/operations/_job_operations.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,11 @@ def _resolve_arm_id_for_sweep_job(self, job: SweepJob, resolver: _AssetResolver)
14731473
Code(base_path=job._base_path, path=job.trial.code),
14741474
azureml_type=AzureMLResourceType.CODE,
14751475
)
1476-
if job.trial is not None:
1476+
if (
1477+
job.trial is not None
1478+
and job.trial.environment is not None
1479+
and not is_ARM_id_for_resource(job.trial.environment, AzureMLResourceType.ENVIRONMENT)
1480+
):
14771481
job.trial.environment = resolver( # type: ignore[assignment]
14781482
job.trial.environment, azureml_type=AzureMLResourceType.ENVIRONMENT
14791483
)

sdk/ml/azure-ai-ml/tests/sweep_job/e2etests/test_sweep_job.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ def test_sweep_job_builder(self, randstr: Callable[[str], str], client: MLClient
209209

210210
result = client.create_or_update(sweep_node)
211211
assert result.description == "new-description"
212-
assert result.trial.environment == "AzureML-sklearn-1.0-ubuntu20.04-py38-cpu:33"
212+
assert (
213+
result.trial.environment
214+
== "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/environments/AzureML-sklearn-1.0-ubuntu20.04-py38-cpu/versions/33"
215+
)
213216
assert result.display_name == "new_builder_command_job"
214217
assert result.compute == "testCompute"
215218
assert result.experiment_name == "mfe-test1-dataset"

0 commit comments

Comments
 (0)