Skip to content

Commit d82e2b7

Browse files
authored
[ML] Fix ml_client.jobs.download for BatchJob (Azure#29316)
* fix: Avoid matching BatchJob child by name during Job.downlaod When downloading a BatchJob, the SDK needed to do a manual search through the BatchJob's children to find the output. The SDK attempted to make the child by name, but a recent service change caused that search to fail. BatchJobs only have one child, so matching by name is largely unnecessary anyway. * Update CHANGELOG.md
1 parent fe5e9dd commit d82e2b7

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

sdk/ml/azure-ai-ml/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- Error message improvement when a local path fails to match with data asset type.
3030
- Error message improvement when an asset does not exist in a registry
3131
- Fix an issue when submit spark pipeline job with referring a registered component
32+
- Fix an issue that prevented Job.download from downloading the output of a BatchJob
3233

3334
### Other Changes
3435

sdk/ml/azure-ai-ml/azure/ai/ml/constants/_common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
REF_DOC_YAML_SCHEMA_ERROR_MSG_FORMAT = "\nVisit this link to refer to the {} schema if needed: {}."
116116
STORAGE_AUTH_MISMATCH_ERROR = "AuthorizationPermissionMismatch"
117117
SWEEP_JOB_BEST_CHILD_RUN_ID_PROPERTY_NAME = "best_child_run_id"
118-
BATCH_JOB_CHILD_RUN_NAME = "batchscoring"
119118
BATCH_JOB_CHILD_RUN_OUTPUT_NAME = "score"
120119
DEFAULT_ARTIFACT_STORE_OUTPUT_NAME = "default"
121120
DEFAULT_EXPERIMENT_NAME = "Default"

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
from azure.ai.ml.constants._common import (
5151
API_URL_KEY,
5252
AZUREML_RESOURCE_PROVIDER,
53-
BATCH_JOB_CHILD_RUN_NAME,
5453
BATCH_JOB_CHILD_RUN_OUTPUT_NAME,
5554
COMMON_RUNTIME_ENV_VAR,
5655
DEFAULT_ARTIFACT_STORE_OUTPUT_NAME,
@@ -831,12 +830,13 @@ def _get_named_output_uri(
831830
def _get_batch_job_scoring_output_uri(self, job_name: str) -> Optional[str]:
832831
uri = None
833832
# Download scoring output, which is the "score" output of the child job named "batchscoring"
833+
# Batch Jobs are pipeline jobs with only one child, so this should terminate after an iteration
834834
for child in self._runs_operations.get_run_children(job_name):
835-
if child.properties.get("azureml.moduleName", None) == BATCH_JOB_CHILD_RUN_NAME:
836-
uri = self._get_named_output_uri(child.name, BATCH_JOB_CHILD_RUN_OUTPUT_NAME).get(
837-
BATCH_JOB_CHILD_RUN_OUTPUT_NAME, None
838-
)
839-
# After the correct child is found, break to prevent unnecessary looping
835+
uri = self._get_named_output_uri(child.name, BATCH_JOB_CHILD_RUN_OUTPUT_NAME).get(
836+
BATCH_JOB_CHILD_RUN_OUTPUT_NAME, None
837+
)
838+
# After the correct child is found, break to prevent unnecessary looping
839+
if uri is not None:
840840
break
841841
return uri
842842

0 commit comments

Comments
 (0)